[PATCH/RFC v6 01/36] leds: Add brightness_set_blocking op
From: Jacek Anaszewski
Date: Thu Aug 20 2015 - 10:44:36 EST
This patch adds a new brightness_set_blocking op to the LED subsystem.
The op is intended for drivers that set brightness in a blocking way,
i.e. they either can sleep or use delays while setting brightness.
Signed-off-by: Jacek Anaszewski <j.anaszewski@xxxxxxxxxxx>
Cc: Andrew Lunn <andrew@xxxxxxx>
Cc: Sakari Ailus <sakari.ailus@xxxxxxxxxxxxxxx>
Cc: Pavel Machek <pavel@xxxxxx>
Cc: Stas Sergeev <stsp@xxxxxxxxxxxxxxxxxxxxx>
---
drivers/leds/led-class.c | 3 +++
include/linux/leds.h | 6 ++++++
2 files changed, 9 insertions(+)
diff --git a/drivers/leds/led-class.c b/drivers/leds/led-class.c
index ca51d58..93a2414 100644
--- a/drivers/leds/led-class.c
+++ b/drivers/leds/led-class.c
@@ -267,6 +267,9 @@ int led_classdev_register(struct device *parent, struct led_classdev *led_cdev)
dev_warn(parent, "Led %s renamed to %s due to name collision",
led_cdev->name, dev_name(led_cdev->dev));
+ WARN_ON(led_cdev->brightness_set &&
+ led_cdev->brightness_set_blocking);
+
#ifdef CONFIG_LEDS_TRIGGERS
init_rwsem(&led_cdev->trigger_lock);
#endif
diff --git a/include/linux/leds.h b/include/linux/leds.h
index b122eea..85fad6b 100644
--- a/include/linux/leds.h
+++ b/include/linux/leds.h
@@ -54,6 +54,12 @@ struct led_classdev {
void (*brightness_set)(struct led_classdev *led_cdev,
enum led_brightness brightness);
/*
+ * Intended for drivers that either can sleep or use delays while
+ * setting brightness.
+ */
+ int (*brightness_set_blocking)(struct led_classdev *led_cdev,
+ enum led_brightness brightness);
+ /*
* Set LED brightness level immediately - it can block the caller for
* the time required for accessing a LED device register.
*/
--
1.7.9.5
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/