diff options
author | Grygorii Strashko <Grygorii.Strashko@linaro.org> | 2015-01-14 16:11:21 +0200 |
---|---|---|
committer | Grygorii Strashko <Grygorii.Strashko@linaro.org> | 2015-02-09 23:28:41 +0800 |
commit | 2f29bbc43506e6ba5f5e46f26483f7d22324dd29 (patch) | |
tree | 78e1bee25393a86b33d2a71b0eb8e074713b4e3d | |
parent | c5da8f397ba5dbbc776d3808bc50ec667860e080 (diff) |
[hib-new-drv] leds: add hibernation callbacks
Setting a dev_pm_ops suspend/resume pair but not a set of
hibernation functions means those pm functions will not be
called upon hibernation - that leads to system crash during
freezing if gpio-led is used in combination with CPU led trigger.
Fix this by using SIMPLE_DEV_PM_OPS, which appropriately
assigns the suspend and hibernation handlers.
Signed-off-by: Grygorii Strashko <Grygorii.Strashko@linaro.org>
-rw-r--r-- | drivers/leds/led-class.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/leds/led-class.c b/drivers/leds/led-class.c index f37d63cf726..825545cdfb1 100644 --- a/drivers/leds/led-class.c +++ b/drivers/leds/led-class.c @@ -178,6 +178,7 @@ void led_classdev_resume(struct led_classdev *led_cdev) } EXPORT_SYMBOL_GPL(led_classdev_resume); +#ifdef CONFIG_PM_SLEEP static int led_suspend(struct device *dev) { struct led_classdev *led_cdev = dev_get_drvdata(dev); @@ -197,11 +198,9 @@ static int led_resume(struct device *dev) return 0; } +#endif -static const struct dev_pm_ops leds_class_dev_pm_ops = { - .suspend = led_suspend, - .resume = led_resume, -}; +static SIMPLE_DEV_PM_OPS(leds_class_dev_pm_ops, led_suspend, led_resume); /** * led_classdev_register - register a new object of led_classdev class. |