From 437a4240f26461610cc0d90950b1c88348d9babe Mon Sep 17 00:00:00 2001 From: Jacek Anaszewski Date: Wed, 7 Oct 2015 11:10:40 +0200 Subject: leds: Rename brightness_set_sync op to brightness_set_blocking The initial purpose of brightness_set_sync op, introduced along with the LED flash class extension, was to add a means for setting torch LED brightness as soon as possible, which couldn't have been guaranteed by brightness_set op. This patch renames the op to brightness_set_blocking, which describes its purpose in a more generic way. It is beneficial in view of the prospective changes in the LED core, aiming at removing the need for using work queues in LED class drivers that can sleep or use delays while setting brightness. Signed-off-by: Jacek Anaszewski Acked-by: Andrew Lunn Acked-by: Pavel Machek Acked-by: Sakari Ailus --- drivers/leds/led-class-flash.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/leds/led-class-flash.c') diff --git a/drivers/leds/led-class-flash.c b/drivers/leds/led-class-flash.c index 3b2573411a37..300a2c9007ca 100644 --- a/drivers/leds/led-class-flash.c +++ b/drivers/leds/led-class-flash.c @@ -298,7 +298,7 @@ int led_classdev_flash_register(struct device *parent, led_cdev = &fled_cdev->led_cdev; if (led_cdev->flags & LED_DEV_CAP_FLASH) { - if (!led_cdev->brightness_set_sync) + if (!led_cdev->brightness_set_blocking) return -EINVAL; ops = fled_cdev->ops; -- cgit v1.2.3 From 13ae79bbe4c214047f51623304d83b46eb02897d Mon Sep 17 00:00:00 2001 From: Jacek Anaszewski Date: Wed, 7 Oct 2015 11:10:43 +0200 Subject: leds: core: Drivers shouldn't enforce SYNC/ASYNC brightness setting This patch removes SET_BRIGHTNESS_ASYNC and SET_BRIGHTNESS_SYNC flags. led_set_brightness() now calls led_set_brightness_nosleep() instead of choosing between sync and async op basing on the flags defined by the driver. From now on, if a user wants to make sure that brightness will be set synchronously, they have to use led_set_brightness_sync() API. It is now being made publicly available since it has become apparent that it is a caller who should decide whether brightness is to be set in a synchronous or an asynchronous way. Signed-off-by: Jacek Anaszewski Acked-by: Sakari Ailus --- drivers/leds/led-class-flash.c | 4 ---- 1 file changed, 4 deletions(-) (limited to 'drivers/leds/led-class-flash.c') diff --git a/drivers/leds/led-class-flash.c b/drivers/leds/led-class-flash.c index 300a2c9007ca..f53783b8d5e8 100644 --- a/drivers/leds/led-class-flash.c +++ b/drivers/leds/led-class-flash.c @@ -316,10 +316,6 @@ int led_classdev_flash_register(struct device *parent, if (ret < 0) return ret; - /* Setting a torch brightness needs to have immediate effect */ - led_cdev->flags &= ~SET_BRIGHTNESS_ASYNC; - led_cdev->flags |= SET_BRIGHTNESS_SYNC; - return 0; } EXPORT_SYMBOL_GPL(led_classdev_flash_register); -- cgit v1.2.3 From abc196359bf91a53392d8fac272a4ea8a9ecc0c4 Mon Sep 17 00:00:00 2001 From: Jacek Anaszewski Date: Wed, 18 Nov 2015 16:32:37 +0100 Subject: leds: flash: Remove checking for state < 1 in flash_strobe_store() Strobe state variable is declared as unsigned long, remove the check for values less than zero then. Signed-off-by: Jacek Anaszewski Reported-by: David Binderman --- drivers/leds/led-class-flash.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/leds/led-class-flash.c') diff --git a/drivers/leds/led-class-flash.c b/drivers/leds/led-class-flash.c index f53783b8d5e8..cf398275a53c 100644 --- a/drivers/leds/led-class-flash.c +++ b/drivers/leds/led-class-flash.c @@ -108,7 +108,7 @@ static ssize_t flash_strobe_store(struct device *dev, if (ret) goto unlock; - if (state < 0 || state > 1) { + if (state > 1) { ret = -EINVAL; goto unlock; } -- cgit v1.2.3