Commit 66601a29 authored by Heiner Kallweit's avatar Heiner Kallweit Committed by Lee Jones

leds: class: If no default trigger is given, make hw_control trigger the default trigger

If a hw_control_trigger is defined, it's usually desirable to make it
the default trigger. Therefore make it the default trigger, except
the driver explicitly set a default trigger.
Signed-off-by: default avatarHeiner Kallweit <hkallweit1@gmail.com>
Link: https://lore.kernel.org/r/f33543de-3800-488f-a779-1fa282614462@gmail.comSigned-off-by: default avatarLee Jones <lee@kernel.org>
parent fd14a872
...@@ -552,6 +552,12 @@ int led_classdev_register_ext(struct device *parent, ...@@ -552,6 +552,12 @@ int led_classdev_register_ext(struct device *parent,
led_init_core(led_cdev); led_init_core(led_cdev);
#ifdef CONFIG_LEDS_TRIGGERS #ifdef CONFIG_LEDS_TRIGGERS
/*
* If no default trigger was given and hw_control_trigger is set,
* make it the default trigger.
*/
if (!led_cdev->default_trigger && led_cdev->hw_control_trigger)
led_cdev->default_trigger = led_cdev->hw_control_trigger;
led_trigger_set_default(led_cdev); led_trigger_set_default(led_cdev);
#endif #endif
......
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