summaryrefslogtreecommitdiffstats
path: root/drivers/leds
diff options
context:
space:
mode:
authorJacek Anaszewski <jacek.anaszewski@gmail.com>2018-12-10 10:29:58 +0100
committerJacek Anaszewski <jacek.anaszewski@gmail.com>2018-12-10 21:31:55 +0100
commit02d31765bb35101d711b862fc619a49857bb9070 (patch)
treec055c55324b7338f3c99a75c30b6f884d2c615f2 /drivers/leds
parentled: triggers: Break the for loop after default trigger is found (diff)
downloadlinux-02d31765bb35101d711b862fc619a49857bb9070.tar.xz
linux-02d31765bb35101d711b862fc619a49857bb9070.zip
led: triggers: Add LED_INIT_DEFAULT_TRIGGER flag
Add the flag LED_INIT_DEFAULT_TRIGGER for indicating that trigger being set is a default trigger for the LED class device, and thus it should be initialized with settings provided in the fwnode. Set the flag in the led_trigger_set_default(). It is expected to be cleared in the activate() op of a trigger after trigger fwnode initialization data is parsed and applied. This should happen only once after LED class device registration, to allow leaving triggers in the idle state on re-apply and let the users apply their own settings without interference from the default ones. Signed-off-by: Jacek Anaszewski <jacek.anaszewski@gmail.com> Acked-by: Pavel Machek <pavel@ucw.cz> Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Diffstat (limited to 'drivers/leds')
-rw-r--r--drivers/leds/led-triggers.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/leds/led-triggers.c b/drivers/leds/led-triggers.c
index 52b12e601ebe..f28ce25d24d0 100644
--- a/drivers/leds/led-triggers.c
+++ b/drivers/leds/led-triggers.c
@@ -201,6 +201,7 @@ void led_trigger_set_default(struct led_classdev *led_cdev)
down_write(&led_cdev->trigger_lock);
list_for_each_entry(trig, &trigger_list, next_trig) {
if (!strcmp(led_cdev->default_trigger, trig->name)) {
+ led_cdev->flags |= LED_INIT_DEFAULT_TRIGGER;
led_trigger_set(led_cdev, trig);
break;
}