Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1204922 > unrolled thread

[PATCH/RFC v5 02/57] leds: Add LED_BRIGHTNESS_BLOCKING flag

Started byJacek Anaszewski <j.anaszewski@samsung.com>
First post2015-08-11 11:40 +0200
Last post2015-08-13 16:20 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH/RFC v5 02/57] leds: Add LED_BRIGHTNESS_BLOCKING flag Jacek Anaszewski <j.anaszewski@samsung.com> - 2015-08-11 11:40 +0200
    Re: [PATCH/RFC v5 02/57] leds: Add LED_BRIGHTNESS_BLOCKING flag Andrew Lunn <andrew@lunn.ch> - 2015-08-13 16:20 +0200

#1204922 — [PATCH/RFC v5 02/57] leds: Add LED_BRIGHTNESS_BLOCKING flag

FromJacek Anaszewski <j.anaszewski@samsung.com>
Date2015-08-11 11:40 +0200
Subject[PATCH/RFC v5 02/57] leds: Add LED_BRIGHTNESS_BLOCKING flag
Message-ID<pWeci-17Z-25@gated-at.bofh.it>
This patch adds LED_BRIGHTNESS_BLOCKING flag to the LED core to make it
capable of discerning between drivers that implement brightness_set op
in the old manner, i.e. the ones which use work queue internally, and
drivers that implement brightness_set op in the new manner, i.e. they
are aware that brightness_set op will be called from a work queue task
by the LED core.
In the new approach all drivers that implement brightness_set op should
also set LED_BRIGHTNESS_BLOCKING flag.

Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
Cc: Bryan Wu <cooloney@gmail.com>
Cc: Andrew Lunn <andrew@lunn.ch>
Cc: Sakari Ailus <sakari.ailus@linux.intel.com>
Cc: Pavel Machek <pavel@ucw.cz>
Cc: Stas Sergeev <stsp@users.sourceforge.net>
---
 drivers/leds/led-class.c |    3 +++
 include/linux/leds.h     |    1 +
 2 files changed, 4 insertions(+)

diff --git a/drivers/leds/led-class.c b/drivers/leds/led-class.c
index ca51d58..2875e6a 100644
--- a/drivers/leds/led-class.c
+++ b/drivers/leds/led-class.c
@@ -279,6 +279,9 @@ int led_classdev_register(struct device *parent, struct led_classdev *led_cdev)
 	if (!led_cdev->max_brightness)
 		led_cdev->max_brightness = LED_FULL;
 
+	WARN_ON((led_cdev->flags & LED_BRIGHTNESS_BLOCKING) &&
+		!led_cdev->brightness_set);
+
 	led_cdev->flags |= SET_BRIGHTNESS_ASYNC;
 
 	led_update_brightness(led_cdev);
diff --git a/include/linux/leds.h b/include/linux/leds.h
index c32f1b8..ac9efe1 100644
--- a/include/linux/leds.h
+++ b/include/linux/leds.h
@@ -48,6 +48,7 @@ struct led_classdev {
 #define SET_BRIGHTNESS_ASYNC	(1 << 21)
 #define SET_BRIGHTNESS_SYNC	(1 << 22)
 #define LED_DEV_CAP_FLASH	(1 << 23)
+#define LED_BRIGHTNESS_BLOCKING	(1 << 24)
 
 	/* Set LED brightness level */
 	/* Must not sleep, use a workqueue if needed */
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1206841

FromAndrew Lunn <andrew@lunn.ch>
Date2015-08-13 16:20 +0200
Message-ID<pX1wm-5Ix-7@gated-at.bofh.it>
In reply to#1204922
On Tue, Aug 11, 2015 at 11:37:15AM +0200, Jacek Anaszewski wrote:
> This patch adds LED_BRIGHTNESS_BLOCKING flag to the LED core to make it
> capable of discerning between drivers that implement brightness_set op
> in the old manner, i.e. the ones which use work queue internally, and
> drivers that implement brightness_set op in the new manner, i.e. they
> are aware that brightness_set op will be called from a work queue task
> by the LED core.
> In the new approach all drivers that implement brightness_set op should
> also set LED_BRIGHTNESS_BLOCKING flag.

Hi Jacek

Why have the drivers set this flag? The core code can look at the two
ops function pointers and figure it out for itself.

    Andrew
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web