diff options
author | Shuah Khan <shuah.kh@samsung.com> | 2013-06-20 15:08:44 -0400 |
---|---|---|
committer | Bryan Wu <cooloney@gmail.com> | 2013-06-20 20:36:45 -0400 |
commit | 73e1ab41a80d36207e8ea7cc2c9897afdeeef387 (patch) | |
tree | c88854d110b08c7d106c3981f4af23ca3e62ced8 /drivers/leds/led-class.c | |
parent | ae6cdb03ef1d352c489d6c86e0bcec51365a2c64 (diff) |
leds: Convert led class driver from legacy pm ops to dev_pm_ops
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>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
Diffstat (limited to 'drivers/leds/led-class.c')
-rw-r--r-- | drivers/leds/led-class.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/drivers/leds/led-class.c b/drivers/leds/led-class.c index a20752f562bc..4336e37a97f4 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) | |||
156 | } | 156 | } |
157 | EXPORT_SYMBOL_GPL(led_classdev_resume); | 157 | EXPORT_SYMBOL_GPL(led_classdev_resume); |
158 | 158 | ||
159 | static int led_suspend(struct device *dev, pm_message_t state) | 159 | static int led_suspend(struct device *dev) |
160 | { | 160 | { |
161 | struct led_classdev *led_cdev = dev_get_drvdata(dev); | 161 | struct led_classdev *led_cdev = dev_get_drvdata(dev); |
162 | 162 | ||
@@ -176,6 +176,11 @@ static int led_resume(struct device *dev) | |||
176 | return 0; | 176 | return 0; |
177 | } | 177 | } |
178 | 178 | ||
179 | static const struct dev_pm_ops leds_class_dev_pm_ops = { | ||
180 | .suspend = led_suspend, | ||
181 | .resume = led_resume, | ||
182 | }; | ||
183 | |||
179 | /** | 184 | /** |
180 | * led_classdev_register - register a new object of led_classdev class. | 185 | * led_classdev_register - register a new object of led_classdev class. |
181 | * @parent: The device to register. | 186 | * @parent: The device to register. |
@@ -252,8 +257,7 @@ static int __init leds_init(void) | |||
252 | leds_class = class_create(THIS_MODULE, "leds"); | 257 | leds_class = class_create(THIS_MODULE, "leds"); |
253 | if (IS_ERR(leds_class)) | 258 | if (IS_ERR(leds_class)) |
254 | return PTR_ERR(leds_class); | 259 | return PTR_ERR(leds_class); |
255 | leds_class->suspend = led_suspend; | 260 | leds_class->pm = &leds_class_dev_pm_ops; |
256 | leds_class->resume = led_resume; | ||
257 | leds_class->dev_attrs = led_class_attrs; | 261 | leds_class->dev_attrs = led_class_attrs; |
258 | return 0; | 262 | return 0; |
259 | } | 263 | } |