backlight: lms501kf03: convert lms501kf03 to dev_pm_ops
authorJingoo Han <jg1.han@samsung.com>
Mon, 29 Apr 2013 23:17:36 +0000 (16:17 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 30 Apr 2013 01:28:15 +0000 (18:28 -0700)
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>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/video/backlight/lms501kf03.c

index b43882abefaf3211a8555983d39a672208af6fa1..cf01b9ac813182e0b250799503d40658ed34890e 100644 (file)
@@ -387,13 +387,12 @@ static int lms501kf03_remove(struct spi_device *spi)
        return 0;
 }
 
-#if defined(CONFIG_PM)
-
-static int lms501kf03_suspend(struct spi_device *spi, pm_message_t mesg)
+#ifdef CONFIG_PM_SLEEP
+static int lms501kf03_suspend(struct device *dev)
 {
-       struct lms501kf03 *lcd = spi_get_drvdata(spi);
+       struct lms501kf03 *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
@@ -402,19 +401,19 @@ static int lms501kf03_suspend(struct spi_device *spi, pm_message_t mesg)
        return lms501kf03_power(lcd, FB_BLANK_POWERDOWN);
 }
 
-static int lms501kf03_resume(struct spi_device *spi)
+static int lms501kf03_resume(struct device *dev)
 {
-       struct lms501kf03 *lcd = spi_get_drvdata(spi);
+       struct lms501kf03 *lcd = dev_get_drvdata(dev);
 
        lcd->power = FB_BLANK_POWERDOWN;
 
        return lms501kf03_power(lcd, FB_BLANK_UNBLANK);
 }
-#else
-#define lms501kf03_suspend     NULL
-#define lms501kf03_resume      NULL
 #endif
 
+static SIMPLE_DEV_PM_OPS(lms501kf03_pm_ops, lms501kf03_suspend,
+                       lms501kf03_resume);
+
 static void lms501kf03_shutdown(struct spi_device *spi)
 {
        struct lms501kf03 *lcd = spi_get_drvdata(spi);
@@ -426,12 +425,11 @@ static struct spi_driver lms501kf03_driver = {
        .driver = {
                .name   = "lms501kf03",
                .owner  = THIS_MODULE,
+               .pm     = &lms501kf03_pm_ops,
        },
        .probe          = lms501kf03_probe,
        .remove         = lms501kf03_remove,
        .shutdown       = lms501kf03_shutdown,
-       .suspend        = lms501kf03_suspend,
-       .resume         = lms501kf03_resume,
 };
 
 module_spi_driver(lms501kf03_driver);