]> www.infradead.org Git - linux.git/commit
power: supply: leds: Add power_supply_[un]register_led_trigger()
authorHans de Goede <hdegoede@redhat.com>
Fri, 31 May 2024 13:47:00 +0000 (15:47 +0200)
committerSebastian Reichel <sebastian.reichel@collabora.com>
Sun, 2 Jun 2024 23:29:36 +0000 (01:29 +0200)
commit964a504b1261b641797d93cdbf79b68ff7d85720
treed63f7d30872f042743bfad2b3693543a51185986
parent447bbf76e6b08c6399462946c2b98d7c5eaed507
power: supply: leds: Add power_supply_[un]register_led_trigger()

Add power_supply_[un]register_led_trigger() helper functions.

The primary goal of this is as a preparation patch for adding an activate
callback to the power-supply LED triggers to ensure that power-supply
LEDs get the correct initial value when the LED gets registered after
the power_supply has been registered (this will use the psy back pointer).

There also is quite a lot of code duplication in the existing LED trigger
registration in the form of the kasprintf() for the name-template for each
trigger + related error handling. This duplication is removed by these
new helpers.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Andy Shevchenko <andy@kernel.org>
Link: https://lore.kernel.org/r/20240531134702.166145-2-hdegoede@redhat.com
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
drivers/power/supply/power_supply_leds.c
include/linux/power_supply.h