]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
PM: Add pm_ops_ptr() macro
authorJingoo Han <jg1.han@samsung.com>
Tue, 30 Apr 2013 01:09:22 +0000 (01:09 +0000)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Sun, 12 May 2013 12:17:07 +0000 (14:17 +0200)
Add pm_ops_ptr() macro that allows the .pm entry in driver structures
to be assigned without having an #define xxx NULL for the case that
CONFIG_PM is not set.

[rjw: Changelog]
Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/i2c/busses/i2c-s3c2410.c
include/linux/pm.h

index 6e8ee92ab55398aec8f5517334166c38e9eb0ba8..e7b66398cfe4b2456bb330fcb0fdc0eff3abe9fb 100644 (file)
@@ -1218,7 +1218,6 @@ static int s3c24xx_i2c_resume(struct device *dev)
 }
 #endif
 
-#ifdef CONFIG_PM
 static const struct dev_pm_ops s3c24xx_i2c_dev_pm_ops = {
 #ifdef CONFIG_PM_SLEEP
        .suspend_noirq = s3c24xx_i2c_suspend_noirq,
@@ -1226,11 +1225,6 @@ static const struct dev_pm_ops s3c24xx_i2c_dev_pm_ops = {
 #endif
 };
 
-#define S3C24XX_DEV_PM_OPS (&s3c24xx_i2c_dev_pm_ops)
-#else
-#define S3C24XX_DEV_PM_OPS NULL
-#endif
-
 /* device driver for platform bus bits */
 
 static struct platform_driver s3c24xx_i2c_driver = {
@@ -1240,7 +1234,7 @@ static struct platform_driver s3c24xx_i2c_driver = {
        .driver         = {
                .owner  = THIS_MODULE,
                .name   = "s3c-i2c",
-               .pm     = S3C24XX_DEV_PM_OPS,
+               .pm     = pm_ops_ptr(&s3c24xx_i2c_dev_pm_ops),
                .of_match_table = of_match_ptr(s3c24xx_i2c_match),
        },
 };
index a224c7f5c377e796969a6d96b684d96b7779c9b5..bd50d154e5f9dbc6d9feb47eee4fd680070450d2 100644 (file)
@@ -55,8 +55,10 @@ struct device;
 
 #ifdef CONFIG_PM
 extern const char power_group_name[];          /* = "power" */
+#define pm_ops_ptr(_ptr)       (_ptr)
 #else
 #define power_group_name       NULL
+#define pm_ops_ptr(_ptr)       NULL
 #endif
 
 typedef struct pm_message {