mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] backlight: ams369fg06: convert ams369fg06 to dev_pm_ops
@ 2013-02-22 10:42 Jingoo Han
  2013-02-22 21:26 ` Andrew Morton
  2013-02-25  1:56 ` [PATCH V2] " Jingoo Han
  0 siblings, 2 replies; 4+ messages in thread
From: Jingoo Han @ 2013-02-22 10:42 UTC (permalink / raw)
  To: 'Andrew Morton'
  Cc: 'LKML', 'Richard Purdie', 'Jingoo Han'

Instead of using legacy suspend/resume methods, using newer dev_pm_ops
structure allows better control over power management.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
---
 drivers/video/backlight/ams369fg06.c |   21 +++++++++++----------
 1 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/drivers/video/backlight/ams369fg06.c b/drivers/video/backlight/ams369fg06.c
index c02aa2c..505d446 100644
--- a/drivers/video/backlight/ams369fg06.c
+++ b/drivers/video/backlight/ams369fg06.c
@@ -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);
-- 
1.7.2.5



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-02-25  1:57 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-22 10:42 [PATCH] backlight: ams369fg06: convert ams369fg06 to dev_pm_ops Jingoo Han
2013-02-22 21:26 ` Andrew Morton
2013-02-25  1:51   ` Jingoo Han
2013-02-25  1:56 ` [PATCH V2] " Jingoo Han

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome