backlight: ams369fg06: convert ams369fg06 to dev_pm_ops
Subsystems (2)
PATCH 1/1 backlight: ams369fg06: convert ams369fg06 to dev_pm_ops
Instead of using legacy suspend/resume methods, using newer dev_pm_ops structure allows better control over power management.
--- drivers/video/backlight/ams369fg06.c | 21 +++++++++++---------- 1 files changed, 11 insertions(+), 10 deletions(-)
drivers/video/backlight/ams369fg06.c +11 -10
@@ -534,11 +534,11 @@ static int ams369fg06_remove(struct spi_device *spi) }#if defined(CONFIG_PM ) -static int ams369fg06_suspend (struct spi_device *spi,pm_message_t mesg) +static int ams369fg06_suspend (struct device *dev) { -struct ams369fg06 *lcd =spi_get_drvdata (spi); +struct ams369fg06 *lcd =dev_get_drvdata (dev); -dev_dbg (&spi->dev,"lcd->power = %d\n" , lcd->power); +dev_dbg (dev,"lcd->power = %d\n" , lcd->power);/* * when lcd panel is suspend, lcd panel becomes off
@@ -547,17 +547,17 @@ static int ams369fg06_suspend(struct spi_device *spi, pm_message_t mesg)return ams369fg06_power (lcd,FB_BLANK_POWERDOWN ); } -static int ams369fg06_resume (struct spi_device *spi) +static int ams369fg06_resume (struct device *dev) { -struct ams369fg06 *lcd =spi_get_drvdata (spi); +struct ams369fg06 *lcd =dev_get_drvdata (dev); lcd->power =FB_BLANK_POWERDOWN ;return ams369fg06_power (lcd,FB_BLANK_UNBLANK ); } -#else -#define ams369fg06_suspend NULL -#define ams369fg06_resume NULL + +static SIMPLE_DEV_PM_OPS(ams369fg06_pm_ops, ams369fg06_suspend, + ams369fg06_resume);#endif static void ams369fg06_shutdown (struct spi_device *spi)
@@ -571,12 +571,13 @@ static struct spi_driver ams369fg06_driver = { .driver = { .name = "ams369fg06", .owner = THIS_MODULE, +#ifdef CONFIG_PM + .pm = &ams369fg06_pm_ops, +#endif }, .probe = ams369fg06_probe, .remove = ams369fg06_remove, .shutdown = ams369fg06_shutdown, - .suspend = ams369fg06_suspend, - .resume = ams369fg06_resume, };module_spi_driver (ams369fg06_driver);
Signature · 1 line
1.7.2.5
Quoted 6 lines · On Fri, 22 Feb 2013 19:42:59 +0900 Jingoo Han <[email protected]> wrote:
Instead of using legacy suspend/resume methods, using newer
dev_pm_opsstructure allows better control over power management....
drivers/video/backlight/ams369fg06.c static struct spi_driver ams369fg06_driver = { · line 580
Quoted 10 lines
drivers/video/backlight/ams369fg06.c +3
-0@@ -571,12 +571,13 @@ static struct spi_driver ams369fg06_driver = { .driver = { .name = "ams369fg06", .owner = THIS_MODULE, +#ifdef CONFIG_PM + .pm = &ams369fg06_pm_ops, +#endif }, .probe = ams369fg06_probe, .remove = ams369fg06_remove, .shutdown = ams369fg06_shutdown,
Are the ifdefs needed? There's various macro trickery in pm.h to clean this up - the rtc drivers use it.
Quoted 9 lines · Andrew Morton
Quoted 5 lines · On Fri, 22 Feb 2013 19:42:59 +0900 Jingoo Han <[email protected]> wrote:
Instead of using legacy suspend/resume methods, using newer
dev_pm_opsstructure allows better control over power management....
Quoted 14 lines
drivers/video/backlight/ams369fg06.c static struct spi_driver ams369fg06_driver = { · line 580
Quoted 11 lines
drivers/video/backlight/ams369fg06.c +3
-0@@ -571,12 +571,13 @@ static struct spi_driver ams369fg06_driver = { .driver = { .name = "ams369fg06", .owner = THIS_MODULE, +#ifdef CONFIG_PM + .pm = &ams369fg06_pm_ops, +#endif }, .probe = ams369fg06_probe, .remove = ams369fg06_remove, .shutdown = ams369fg06_shutdown,Are the ifdefs needed? There's various macro trickery in
pm.hto clean this up - the rtc drivers use it.
OK, you're right.
I will remove unnecessary '#ifdef CONFIG_PM'.
Thank you for your comment.
Best regards,
Jingoo Han
PATCH v2 1/1 backlight: ams369fg06: convert ams369fg06 to dev_pm_ops
In reply to Jingoo HanInstead of using legacy suspend/resume methods, using newer dev_pm_ops structure allows better control over power management.
---
Changes since v1:
- Remove unnecessary ifdefs.
drivers/video/backlight/ams369fg06.c | 21 ++++++++++----------- 1 files changed, 10 insertions(+), 11 deletions(-)
drivers/video/backlight/ams369fg06.c +10 -11
@@ -535,12 +535,12 @@ static int ams369fg06_remove(struct spi_device *spi)return 0 ; } -#if defined(CONFIG_PM ) -static int ams369fg06_suspend (struct spi_device *spi,pm_message_t mesg) +#ifdef CONFIG_PM_SLEEP +static int ams369fg06_suspend (struct device *dev) { -struct ams369fg06 *lcd =spi_get_drvdata (spi); +struct ams369fg06 *lcd =dev_get_drvdata (dev); -dev_dbg (&spi->dev,"lcd->power = %d\n" , lcd->power); +dev_dbg (dev,"lcd->power = %d\n" , lcd->power);/* * when lcd panel is suspend, lcd panel becomes off
@@ -549,19 +549,19 @@ static int ams369fg06_suspend(struct spi_device *spi, pm_message_t mesg)return ams369fg06_power (lcd,FB_BLANK_POWERDOWN ); } -static int ams369fg06_resume (struct spi_device *spi) +static int ams369fg06_resume (struct device *dev) { -struct ams369fg06 *lcd =spi_get_drvdata (spi); +struct ams369fg06 *lcd =dev_get_drvdata (dev); lcd->power =FB_BLANK_POWERDOWN ;return ams369fg06_power (lcd,FB_BLANK_UNBLANK ); } -#else -#define ams369fg06_suspend NULL -#define ams369fg06_resume NULL#endif +static SIMPLE_DEV_PM_OPS(ams369fg06_pm_ops, ams369fg06_suspend, + ams369fg06_resume); +static void ams369fg06_shutdown (struct spi_device *spi) {struct ams369fg06 *lcd =spi_get_drvdata (spi);
@@ -573,12 +573,11 @@ static struct spi_driver ams369fg06_driver = { .driver = { .name = "ams369fg06", .owner = THIS_MODULE, + .pm = &ams369fg06_pm_ops, }, .probe = ams369fg06_probe, .remove = ams369fg06_remove, .shutdown = ams369fg06_shutdown, - .suspend = ams369fg06_suspend, - .resume = ams369fg06_resume, };module_spi_driver (ams369fg06_driver);
Signature · 1 line
1.7.2.5