mirror of
https://github.com/torvalds/linux
synced 2024-11-05 18:23:50 +00:00
backlight: hp680_bl: convert hp680bl 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: Jingoo Han <jg1.han@samsung.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
d7696aad5d
commit
b55bb78d29
1 changed files with 8 additions and 10 deletions
|
@ -64,29 +64,28 @@ static void hp680bl_send_intensity(struct backlight_device *bd)
|
|||
}
|
||||
|
||||
|
||||
#ifdef CONFIG_PM
|
||||
static int hp680bl_suspend(struct platform_device *pdev, pm_message_t state)
|
||||
#ifdef CONFIG_PM_SLEEP
|
||||
static int hp680bl_suspend(struct device *dev)
|
||||
{
|
||||
struct backlight_device *bd = platform_get_drvdata(pdev);
|
||||
struct backlight_device *bd = dev_get_drvdata(dev);
|
||||
|
||||
hp680bl_suspended = 1;
|
||||
hp680bl_send_intensity(bd);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int hp680bl_resume(struct platform_device *pdev)
|
||||
static int hp680bl_resume(struct device *dev)
|
||||
{
|
||||
struct backlight_device *bd = platform_get_drvdata(pdev);
|
||||
struct backlight_device *bd = dev_get_drvdata(dev);
|
||||
|
||||
hp680bl_suspended = 0;
|
||||
hp680bl_send_intensity(bd);
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
#define hp680bl_suspend NULL
|
||||
#define hp680bl_resume NULL
|
||||
#endif
|
||||
|
||||
static SIMPLE_DEV_PM_OPS(hp680bl_pm_ops, hp680bl_suspend, hp680bl_resume);
|
||||
|
||||
static int hp680bl_set_intensity(struct backlight_device *bd)
|
||||
{
|
||||
hp680bl_send_intensity(bd);
|
||||
|
@ -140,10 +139,9 @@ static int hp680bl_remove(struct platform_device *pdev)
|
|||
static struct platform_driver hp680bl_driver = {
|
||||
.probe = hp680bl_probe,
|
||||
.remove = hp680bl_remove,
|
||||
.suspend = hp680bl_suspend,
|
||||
.resume = hp680bl_resume,
|
||||
.driver = {
|
||||
.name = "hp680-bl",
|
||||
.pm = &hp680bl_pm_ops,
|
||||
},
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue