]> git.sur5r.net Git - groeck-nct6775/commitdiff
Convert to use SIMPLE_DEV_PM_OPS
authorGuenter Roeck <linux@roeck-us.net>
Fri, 13 Feb 2015 04:20:33 +0000 (20:20 -0800)
committerGuenter Roeck <linux@roeck-us.net>
Fri, 13 Feb 2015 04:20:33 +0000 (20:20 -0800)
Get rid of #ifdef CONFIG_PM by using SIMPLE_DEV_PM_OPS and declaring suspend
and resume functions with __maybe_unused.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
nct6775.c

index 3272356015af5478fda2d31588cb2056c05156cf..f847ba529ddbcad83dcda4a56c445c61f1d0865b 100644 (file)
--- a/nct6775.c
+++ b/nct6775.c
@@ -885,12 +885,11 @@ struct nct6775_data {
        u16 have_temp;
        u16 have_temp_fixed;
        u16 have_in;
-#ifdef CONFIG_PM
+
        /* Remember extra register values over suspend/resume */
        u8 vbat;
        u8 fandiv1;
        u8 fandiv2;
-#endif
 };
 
 struct nct6775_sio_data {
@@ -4031,8 +4030,7 @@ static void nct6791_enable_io_mapping(int sioaddr)
        }
 }
 
-#ifdef CONFIG_PM
-static int nct6775_suspend(struct device *dev)
+static int __maybe_unused nct6775_suspend(struct device *dev)
 {
        struct nct6775_data *data = nct6775_update_device(dev);
 
@@ -4047,7 +4045,7 @@ static int nct6775_suspend(struct device *dev)
        return 0;
 }
 
-static int nct6775_resume(struct device *dev)
+static int __maybe_unused nct6775_resume(struct device *dev)
 {
        struct nct6775_data *data = dev_get_drvdata(dev);
        int i, j, err = 0;
@@ -4108,23 +4106,13 @@ abort:
        return err;
 }
 
-static const struct dev_pm_ops nct6775_dev_pm_ops = {
-       .suspend = nct6775_suspend,
-       .resume = nct6775_resume,
-       .freeze = nct6775_suspend,
-       .restore = nct6775_resume,
-};
-
-#define NCT6775_DEV_PM_OPS     (&nct6775_dev_pm_ops)
-#else
-#define NCT6775_DEV_PM_OPS     NULL
-#endif /* CONFIG_PM */
+static SIMPLE_DEV_PM_OPS(nct6775_dev_pm_ops, nct6775_suspend, nct6775_resume);
 
 static struct platform_driver nct6775_driver = {
        .driver = {
                .owner  = THIS_MODULE,
                .name   = DRVNAME,
-               .pm     = NCT6775_DEV_PM_OPS,
+               .pm     = &nct6775_dev_pm_ops,
        },
        .probe          = nct6775_probe,
 #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 13, 0)