Skip to content

Commit

Permalink
led: triggers: Add LED_INIT_DEFAULT_TRIGGER flag
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
jacek-anaszewski committed Dec 10, 2018
1 parent c4f7bd4 commit 02d3176
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions drivers/leds/led-triggers.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
1 change: 1 addition & 0 deletions include/linux/leds.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ struct led_classdev {
#define LED_PANIC_INDICATOR BIT(20)
#define LED_BRIGHT_HW_CHANGED BIT(21)
#define LED_RETAIN_AT_SHUTDOWN BIT(22)
#define LED_INIT_DEFAULT_TRIGGER BIT(23)

/* set_brightness_work / blink_timer flags, atomic, private. */
unsigned long work_flags;
Expand Down

0 comments on commit 02d3176

Please sign in to comment.