diff options
author | Richard Purdie <rpurdie@linux.intel.com> | 2009-01-08 17:55:03 +0000 |
---|---|---|
committer | Richard Purdie <rpurdie@linux.intel.com> | 2009-01-08 17:55:03 +0000 |
commit | 859cb7f2a4244ea6da206d3fe9cc8a6810947a68 (patch) | |
tree | 3389fe6c191418d6acc30d84e11a0760608f7431 /drivers/leds/led-class.c | |
parent | 0081e8020ebd814a99e45720a10e869a54ee08a6 (diff) | |
download | linux-3.10-859cb7f2a4244ea6da206d3fe9cc8a6810947a68.tar.gz linux-3.10-859cb7f2a4244ea6da206d3fe9cc8a6810947a68.tar.bz2 linux-3.10-859cb7f2a4244ea6da206d3fe9cc8a6810947a68.zip |
leds: Add suspend/resume to the core class
Add suspend/resume to the core class and remove all the now unneeded
code from various drivers. Originally the class code couldn't support
suspend/resume but since class_device can there is no reason for
each driver doing its own suspend/resume anymore.
Diffstat (limited to 'drivers/leds/led-class.c')
-rw-r--r-- | drivers/leds/led-class.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/drivers/leds/led-class.c b/drivers/leds/led-class.c index 1553d93b8c6..52f82e3ea13 100644 --- a/drivers/leds/led-class.c +++ b/drivers/leds/led-class.c @@ -91,6 +91,26 @@ 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) +{ + struct led_classdev *led_cdev = dev_get_drvdata(dev); + + if (led_cdev->flags & LED_CORE_SUSPENDRESUME) + led_classdev_suspend(led_cdev); + + return 0; +} + +static int led_resume(struct device *dev) +{ + struct led_classdev *led_cdev = dev_get_drvdata(dev); + + if (led_cdev->flags & LED_CORE_SUSPENDRESUME) + led_classdev_resume(led_cdev); + + return 0; +} + /** * led_classdev_register - register a new object of led_classdev class. * @parent: The device to register. @@ -174,6 +194,8 @@ 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; return 0; } |