Commit f10a46cf authored by Jingoo Han's avatar Jingoo Han Committed by Linus Torvalds

backlight: kb3886_bl: convert kb3886bl to dev_pm_ops

Instead of using legacy suspend/resume methods, using newer dev_pm_ops
structure allows better control over power management.
Signed-off-by: default avatarJingoo Han <jg1.han@samsung.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent b55bb78d
...@@ -106,29 +106,28 @@ static int kb3886bl_send_intensity(struct backlight_device *bd) ...@@ -106,29 +106,28 @@ static int kb3886bl_send_intensity(struct backlight_device *bd)
return 0; return 0;
} }
#ifdef CONFIG_PM #ifdef CONFIG_PM_SLEEP
static int kb3886bl_suspend(struct platform_device *pdev, pm_message_t state) static int kb3886bl_suspend(struct device *dev)
{ {
struct backlight_device *bd = platform_get_drvdata(pdev); struct backlight_device *bd = dev_get_drvdata(dev);
kb3886bl_flags |= KB3886BL_SUSPENDED; kb3886bl_flags |= KB3886BL_SUSPENDED;
backlight_update_status(bd); backlight_update_status(bd);
return 0; return 0;
} }
static int kb3886bl_resume(struct platform_device *pdev) static int kb3886bl_resume(struct device *dev)
{ {
struct backlight_device *bd = platform_get_drvdata(pdev); struct backlight_device *bd = dev_get_drvdata(dev);
kb3886bl_flags &= ~KB3886BL_SUSPENDED; kb3886bl_flags &= ~KB3886BL_SUSPENDED;
backlight_update_status(bd); backlight_update_status(bd);
return 0; return 0;
} }
#else
#define kb3886bl_suspend NULL
#define kb3886bl_resume NULL
#endif #endif
static SIMPLE_DEV_PM_OPS(kb3886bl_pm_ops, kb3886bl_suspend, kb3886bl_resume);
static int kb3886bl_get_intensity(struct backlight_device *bd) static int kb3886bl_get_intensity(struct backlight_device *bd)
{ {
return kb3886bl_intensity; return kb3886bl_intensity;
...@@ -179,10 +178,9 @@ static int kb3886bl_remove(struct platform_device *pdev) ...@@ -179,10 +178,9 @@ static int kb3886bl_remove(struct platform_device *pdev)
static struct platform_driver kb3886bl_driver = { static struct platform_driver kb3886bl_driver = {
.probe = kb3886bl_probe, .probe = kb3886bl_probe,
.remove = kb3886bl_remove, .remove = kb3886bl_remove,
.suspend = kb3886bl_suspend,
.resume = kb3886bl_resume,
.driver = { .driver = {
.name = "kb3886-bl", .name = "kb3886-bl",
.pm = &kb3886bl_pm_ops,
}, },
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment