diff options
author | Krzysztof Kozlowski <krzk@kernel.org> | 2018-12-10 10:29:59 +0100 |
---|---|---|
committer | Jacek Anaszewski <jacek.anaszewski@gmail.com> | 2018-12-10 21:31:55 +0100 |
commit | 8146aace60c7409cc60a1598bc9647a5bbb12eb4 (patch) | |
tree | 3cb0c275aaf82dfd79b9e952323a86130705f78a /drivers/leds | |
parent | 02d31765bb35101d711b862fc619a49857bb9070 (diff) |
led: triggers: Initialize LED_INIT_DEFAULT_TRIGGER if trigger is brought after class
Trigger driver can be initialized after the LED class device driver. In
such case led_trigger_set_default() won't be called and flag
LED_INIT_DEFAULT_TRIGGER should be set from led_trigger_register().
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
Diffstat (limited to 'drivers/leds')
-rw-r--r-- | drivers/leds/led-triggers.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/leds/led-triggers.c b/drivers/leds/led-triggers.c index f28ce25d24d0..2d451b6c24af 100644 --- a/drivers/leds/led-triggers.c +++ b/drivers/leds/led-triggers.c @@ -251,8 +251,10 @@ int led_trigger_register(struct led_trigger *trig) list_for_each_entry(led_cdev, &leds_list, node) { down_write(&led_cdev->trigger_lock); if (!led_cdev->trigger && led_cdev->default_trigger && - !strcmp(led_cdev->default_trigger, trig->name)) + !strcmp(led_cdev->default_trigger, trig->name)) { + led_cdev->flags |= LED_INIT_DEFAULT_TRIGGER; led_trigger_set(led_cdev, trig); + } up_write(&led_cdev->trigger_lock); } up_read(&leds_list_lock); |