* [PATCH] leds: Convert led class driver from legacy pm ops to dev_pm_ops
@ 2013-06-20 19:08 Shuah Khan
2013-06-20 23:23 ` Bryan Wu
0 siblings, 1 reply; 2+ messages in thread
From: Shuah Khan @ 2013-06-20 19:08 UTC (permalink / raw)
To: cooloney, rpurdie, linux-leds, linux-kernel; +Cc: Shuah Khan, shuahkhan
Convert drivers/leds/led-class to use dev_pm_ops for power management and
remove Legacy PM ops hooks. With this change, led class registers
suspend/resume callbacks via class->pm (dev_pm_ops) instead of Legacy
class->suspend/resume. When __device_suspend() runs call-backs, it will
find class->pm ops for the led class.
Signed-off-by: Shuah Khan <shuah.kh@samsung.com>
---
drivers/leds/led-class.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/drivers/leds/led-class.c b/drivers/leds/led-class.c
index a20752f..4336e37 100644
--- a/drivers/leds/led-class.c
+++ b/drivers/leds/led-class.c
@@ -156,7 +156,7 @@ void led_classdev_resume(struct led_classdev *led_cdev)
}
EXPORT_SYMBOL_GPL(led_classdev_resume);
-static int led_suspend(struct device *dev, pm_message_t state)
+static int led_suspend(struct device *dev)
{
struct led_classdev *led_cdev = dev_get_drvdata(dev);
@@ -176,6 +176,11 @@ static int led_resume(struct device *dev)
return 0;
}
+static const struct dev_pm_ops leds_class_dev_pm_ops = {
+ .suspend = led_suspend,
+ .resume = led_resume,
+};
+
/**
* led_classdev_register - register a new object of led_classdev class.
* @parent: The device to register.
@@ -252,8 +257,7 @@ static int __init leds_init(void)
leds_class = class_create(THIS_MODULE, "leds");
if (IS_ERR(leds_class))
return PTR_ERR(leds_class);
- leds_class->suspend = led_suspend;
- leds_class->resume = led_resume;
+ leds_class->pm = &leds_class_dev_pm_ops;
leds_class->dev_attrs = led_class_attrs;
return 0;
}
--
1.7.10.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] leds: Convert led class driver from legacy pm ops to dev_pm_ops
2013-06-20 19:08 [PATCH] leds: Convert led class driver from legacy pm ops to dev_pm_ops Shuah Khan
@ 2013-06-20 23:23 ` Bryan Wu
0 siblings, 0 replies; 2+ messages in thread
From: Bryan Wu @ 2013-06-20 23:23 UTC (permalink / raw)
To: Shuah Khan; +Cc: rpurdie, Linux LED Subsystem, lkml, Shuah Khan
On Thu, Jun 20, 2013 at 12:08 PM, Shuah Khan <shuah.kh@samsung.com> wrote:
> Convert drivers/leds/led-class to use dev_pm_ops for power management and
> remove Legacy PM ops hooks. With this change, led class registers
> suspend/resume callbacks via class->pm (dev_pm_ops) instead of Legacy
> class->suspend/resume. When __device_suspend() runs call-backs, it will
> find class->pm ops for the led class.
>
Looks good to me, merged.
Thanks,
-Bryan
> Signed-off-by: Shuah Khan <shuah.kh@samsung.com>
> ---
> drivers/leds/led-class.c | 10 +++++++---
> 1 file changed, 7 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/leds/led-class.c b/drivers/leds/led-class.c
> index a20752f..4336e37 100644
> --- a/drivers/leds/led-class.c
> +++ b/drivers/leds/led-class.c
> @@ -156,7 +156,7 @@ void led_classdev_resume(struct led_classdev *led_cdev)
> }
> EXPORT_SYMBOL_GPL(led_classdev_resume);
>
> -static int led_suspend(struct device *dev, pm_message_t state)
> +static int led_suspend(struct device *dev)
> {
> struct led_classdev *led_cdev = dev_get_drvdata(dev);
>
> @@ -176,6 +176,11 @@ static int led_resume(struct device *dev)
> return 0;
> }
>
> +static const struct dev_pm_ops leds_class_dev_pm_ops = {
> + .suspend = led_suspend,
> + .resume = led_resume,
> +};
> +
> /**
> * led_classdev_register - register a new object of led_classdev class.
> * @parent: The device to register.
> @@ -252,8 +257,7 @@ static int __init leds_init(void)
> leds_class = class_create(THIS_MODULE, "leds");
> if (IS_ERR(leds_class))
> return PTR_ERR(leds_class);
> - leds_class->suspend = led_suspend;
> - leds_class->resume = led_resume;
> + leds_class->pm = &leds_class_dev_pm_ops;
> leds_class->dev_attrs = led_class_attrs;
> return 0;
> }
> --
> 1.7.10.4
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-06-20 23:24 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-20 19:08 [PATCH] leds: Convert led class driver from legacy pm ops to dev_pm_ops Shuah Khan
2013-06-20 23:23 ` Bryan Wu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).