From: Jingoo Han Date: Tue, 30 Apr 2013 01:09:22 +0000 (+0000) Subject: PM: Add pm_ops_ptr() macro X-Git-Tag: next-20130521~61^2~1^2 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=5efb9ef8dce5a0bddad4f92e9d97e1e29a09a6f0;p=karo-tx-linux.git PM: Add pm_ops_ptr() macro 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 Signed-off-by: Rafael J. Wysocki --- diff --git a/drivers/i2c/busses/i2c-s3c2410.c b/drivers/i2c/busses/i2c-s3c2410.c index 6e8ee92ab553..e7b66398cfe4 100644 --- a/drivers/i2c/busses/i2c-s3c2410.c +++ b/drivers/i2c/busses/i2c-s3c2410.c @@ -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), }, }; diff --git a/include/linux/pm.h b/include/linux/pm.h index a224c7f5c377..bd50d154e5f9 100644 --- a/include/linux/pm.h +++ b/include/linux/pm.h @@ -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 {