Commit 8146aace authored by Krzysztof Kozlowski's avatar Krzysztof Kozlowski Committed by Jacek Anaszewski

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: default avatarKrzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: default avatarJacek Anaszewski <jacek.anaszewski@gmail.com>
parent 02d31765
...@@ -251,8 +251,10 @@ int led_trigger_register(struct led_trigger *trig) ...@@ -251,8 +251,10 @@ int led_trigger_register(struct led_trigger *trig)
list_for_each_entry(led_cdev, &leds_list, node) { list_for_each_entry(led_cdev, &leds_list, node) {
down_write(&led_cdev->trigger_lock); down_write(&led_cdev->trigger_lock);
if (!led_cdev->trigger && led_cdev->default_trigger && 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); led_trigger_set(led_cdev, trig);
}
up_write(&led_cdev->trigger_lock); up_write(&led_cdev->trigger_lock);
} }
up_read(&leds_list_lock); up_read(&leds_list_lock);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment