diff options
author | Heiner Kallweit <hkallweit1@gmail.com> | 2023-12-22 22:32:28 +0100 |
---|---|---|
committer | Lee Jones <lee@kernel.org> | 2024-03-07 08:47:56 +0000 |
commit | 66601a29bb23b61f9676f51c0b4b78b38c601536 (patch) | |
tree | 05da19b7781dc5e9f1e7095beacd40f9d12df173 /drivers/leds | |
parent | fd14a87230ed4d47541f87a1e810ea123614907a (diff) | |
download | lwn-66601a29bb23b61f9676f51c0b4b78b38c601536.tar.gz lwn-66601a29bb23b61f9676f51c0b4b78b38c601536.zip |
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: Heiner Kallweit <hkallweit1@gmail.com>
Link: https://lore.kernel.org/r/f33543de-3800-488f-a779-1fa282614462@gmail.com
Signed-off-by: Lee Jones <lee@kernel.org>
Diffstat (limited to 'drivers/leds')
-rw-r--r-- | drivers/leds/led-class.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/leds/led-class.c b/drivers/leds/led-class.c index ba1be15cfd8e..24fcff682b24 100644 --- a/drivers/leds/led-class.c +++ b/drivers/leds/led-class.c @@ -552,6 +552,12 @@ int led_classdev_register_ext(struct device *parent, led_init_core(led_cdev); #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); #endif |