From 81fe8e5b73e3f4de578ac7f53c1d956d4f58b8d4 Mon Sep 17 00:00:00 2001 From: Jacek Anaszewski Date: Wed, 7 Oct 2015 11:10:41 +0200 Subject: leds: core: Add led_set_brightness_nosleep{nopm} functions This patch adds led_set_brightness_nosleep() and led_set_brightness_nopm() functions, that guarantee setting LED brightness in a non-blocking way. The latter is used from pm_ops context and doesn't modify the brightness cached in the struct led_classdev. Its execution always ends up with a call to brightness setting op - either directly or through a set_brightness_work, regardless of LED_SUSPENDED flag state. The patch also replaces led_set_brightness_async() with led_set_brightness_nosleep() in all places where the most vital was setting brightness in a non sleeping way but not necessarily asynchronously, which is not needed for non-blocking drivers. Signed-off-by: Jacek Anaszewski Acked-by: Sakari Ailus --- drivers/leds/led-class.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/leds/led-class.c') diff --git a/drivers/leds/led-class.c b/drivers/leds/led-class.c index 7385f98dd54b..83a1dc725864 100644 --- a/drivers/leds/led-class.c +++ b/drivers/leds/led-class.c @@ -109,7 +109,7 @@ static const struct attribute_group *led_groups[] = { void led_classdev_suspend(struct led_classdev *led_cdev) { led_cdev->flags |= LED_SUSPENDED; - led_cdev->brightness_set(led_cdev, 0); + led_set_brightness_nopm(led_cdev, 0); } EXPORT_SYMBOL_GPL(led_classdev_suspend); @@ -119,7 +119,7 @@ EXPORT_SYMBOL_GPL(led_classdev_suspend); */ void led_classdev_resume(struct led_classdev *led_cdev) { - led_cdev->brightness_set(led_cdev, led_cdev->brightness); + led_set_brightness_nopm(led_cdev, led_cdev->brightness); if (led_cdev->flash_resume) led_cdev->flash_resume(led_cdev); -- cgit