Commit 14c1b778 authored by Jingoo Han's avatar Jingoo Han Committed by Linus Torvalds

backlight: adp5520: convert adp5520_bl 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 d50d7ac0
...@@ -349,35 +349,34 @@ static int adp5520_bl_remove(struct platform_device *pdev) ...@@ -349,35 +349,34 @@ static int adp5520_bl_remove(struct platform_device *pdev)
return 0; return 0;
} }
#ifdef CONFIG_PM #ifdef CONFIG_PM_SLEEP
static int adp5520_bl_suspend(struct platform_device *pdev, static int adp5520_bl_suspend(struct device *dev)
pm_message_t state)
{ {
struct backlight_device *bl = platform_get_drvdata(pdev); struct backlight_device *bl = dev_get_drvdata(dev);
return adp5520_bl_set(bl, 0); return adp5520_bl_set(bl, 0);
} }
static int adp5520_bl_resume(struct platform_device *pdev) static int adp5520_bl_resume(struct device *dev)
{ {
struct backlight_device *bl = platform_get_drvdata(pdev); struct backlight_device *bl = dev_get_drvdata(dev);
backlight_update_status(bl); backlight_update_status(bl);
return 0; return 0;
} }
#else
#define adp5520_bl_suspend NULL
#define adp5520_bl_resume NULL
#endif #endif
static SIMPLE_DEV_PM_OPS(adp5520_bl_pm_ops, adp5520_bl_suspend,
adp5520_bl_resume);
static struct platform_driver adp5520_bl_driver = { static struct platform_driver adp5520_bl_driver = {
.driver = { .driver = {
.name = "adp5520-backlight", .name = "adp5520-backlight",
.owner = THIS_MODULE, .owner = THIS_MODULE,
.pm = &adp5520_bl_pm_ops,
}, },
.probe = adp5520_bl_probe, .probe = adp5520_bl_probe,
.remove = adp5520_bl_remove, .remove = adp5520_bl_remove,
.suspend = adp5520_bl_suspend,
.resume = adp5520_bl_resume,
}; };
module_platform_driver(adp5520_bl_driver); module_platform_driver(adp5520_bl_driver);
......
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