backlight: tosa: convert tosa to dev_pm_ops
authorJingoo Han <jg1.han@samsung.com>
Mon, 29 Apr 2013 23:18:00 +0000 (16:18 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 30 Apr 2013 01:28:18 +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/tosa_bl.c
drivers/video/backlight/tosa_lcd.c

index 2326fa810c5922ef1543671da152cfd13b3f4fc5..9df66ac68b344e46f8b5a9b0de8b532a3c9acb9a 100644 (file)
@@ -134,28 +134,27 @@ static int tosa_bl_remove(struct i2c_client *client)
        return 0;
 }
 
-#ifdef CONFIG_PM
-static int tosa_bl_suspend(struct i2c_client *client, pm_message_t pm)
+#ifdef CONFIG_PM_SLEEP
+static int tosa_bl_suspend(struct device *dev)
 {
-       struct tosa_bl_data *data = i2c_get_clientdata(client);
+       struct tosa_bl_data *data = dev_get_drvdata(dev);
 
        tosa_bl_set_backlight(data, 0);
 
        return 0;
 }
 
-static int tosa_bl_resume(struct i2c_client *client)
+static int tosa_bl_resume(struct device *dev)
 {
-       struct tosa_bl_data *data = i2c_get_clientdata(client);
+       struct tosa_bl_data *data = dev_get_drvdata(dev);
 
        backlight_update_status(data->bl);
        return 0;
 }
-#else
-#define tosa_bl_suspend NULL
-#define tosa_bl_resume NULL
 #endif
 
+static SIMPLE_DEV_PM_OPS(tosa_bl_pm_ops, tosa_bl_suspend, tosa_bl_resume);
+
 static const struct i2c_device_id tosa_bl_id[] = {
        { "tosa-bl", 0 },
        { },
@@ -165,11 +164,10 @@ static struct i2c_driver tosa_bl_driver = {
        .driver = {
                .name           = "tosa-bl",
                .owner          = THIS_MODULE,
+               .pm             = &tosa_bl_pm_ops,
        },
        .probe          = tosa_bl_probe,
        .remove         = tosa_bl_remove,
-       .suspend        = tosa_bl_suspend,
-       .resume         = tosa_bl_resume,
        .id_table       = tosa_bl_id,
 };
 
index 666fe2593ea4cfe44f6ea73bf2c9a38cc72c0f1a..bf081573e5b5938c7084c8d2206baa2512ff460f 100644 (file)
@@ -240,19 +240,19 @@ static int tosa_lcd_remove(struct spi_device *spi)
        return 0;
 }
 
-#ifdef CONFIG_PM
-static int tosa_lcd_suspend(struct spi_device *spi, pm_message_t state)
+#ifdef CONFIG_PM_SLEEP
+static int tosa_lcd_suspend(struct device *dev)
 {
-       struct tosa_lcd_data *data = spi_get_drvdata(spi);
+       struct tosa_lcd_data *data = dev_get_drvdata(dev);
 
        tosa_lcd_tg_off(data);
 
        return 0;
 }
 
-static int tosa_lcd_resume(struct spi_device *spi)
+static int tosa_lcd_resume(struct device *dev)
 {
-       struct tosa_lcd_data *data = spi_get_drvdata(spi);
+       struct tosa_lcd_data *data = dev_get_drvdata(dev);
 
        tosa_lcd_tg_init(data);
        if (POWER_IS_ON(data->lcd_power))
@@ -262,20 +262,18 @@ static int tosa_lcd_resume(struct spi_device *spi)
 
        return 0;
 }
-#else
-#define tosa_lcd_suspend       NULL
-#define tosa_lcd_resume NULL
 #endif
 
+static SIMPLE_DEV_PM_OPS(tosa_lcd_pm_ops, tosa_lcd_suspend, tosa_lcd_resume);
+
 static struct spi_driver tosa_lcd_driver = {
        .driver = {
                .name           = "tosa-lcd",
                .owner          = THIS_MODULE,
+               .pm             = &tosa_lcd_pm_ops,
        },
        .probe          = tosa_lcd_probe,
        .remove         = tosa_lcd_remove,
-       .suspend        = tosa_lcd_suspend,
-       .resume         = tosa_lcd_resume,
 };
 
 module_spi_driver(tosa_lcd_driver);