@@ -83,7 +83,7 @@ static void power_supply_update_bat_leds(struct power_supply *psy)
switch (status.intval) {
case POWER_SUPPLY_STATUS_FULL:
- led_trigger_event(psy->charging_full_trig, LED_FULL);
+ led_trigger_event(psy->trig, LED_FULL);
led_trigger_event(psy->charging_trig, LED_OFF);
led_trigger_event(psy->full_trig, LED_FULL);
/* Going from blink to LED on requires a LED_OFF event to stop blink */
@@ -95,7 +95,7 @@ static void power_supply_update_bat_leds(struct power_supply *psy)
LED_FULL);
break;
case POWER_SUPPLY_STATUS_CHARGING:
- led_trigger_event(psy->charging_full_trig, LED_FULL);
+ led_trigger_event(psy->trig, LED_FULL);
led_trigger_event(psy->charging_trig, LED_FULL);
led_trigger_event(psy->full_trig, LED_OFF);
led_trigger_blink(psy->charging_blink_full_solid_trig, 0, 0);
@@ -105,7 +105,7 @@ static void power_supply_update_bat_leds(struct power_supply *psy)
LED_FULL);
break;
default:
- led_trigger_event(psy->charging_full_trig, LED_OFF);
+ led_trigger_event(psy->trig, LED_OFF);
led_trigger_event(psy->charging_trig, LED_OFF);
led_trigger_event(psy->full_trig, LED_OFF);
led_trigger_event(psy->charging_blink_full_solid_trig,
@@ -118,7 +118,7 @@ static void power_supply_update_bat_leds(struct power_supply *psy)
static void power_supply_remove_bat_triggers(struct power_supply *psy)
{
- power_supply_unregister_led_trigger(psy->charging_full_trig);
+ power_supply_unregister_led_trigger(psy->trig);
power_supply_unregister_led_trigger(psy->charging_trig);
power_supply_unregister_led_trigger(psy->full_trig);
power_supply_unregister_led_trigger(psy->charging_blink_full_solid_trig);
@@ -130,7 +130,7 @@ static int power_supply_create_bat_triggers(struct power_supply *psy)
int err = 0;
err |= power_supply_register_led_trigger(psy, "%s-charging-or-full",
- &psy->charging_full_trig);
+ &psy->trig);
err |= power_supply_register_led_trigger(psy, "%s-charging",
&psy->charging_trig);
err |= power_supply_register_led_trigger(psy, "%s-full",
@@ -163,19 +163,19 @@ static void power_supply_update_gen_leds(struct power_supply *psy)
dev_dbg(&psy->dev, "%s %d\n", __func__, online.intval);
if (online.intval)
- led_trigger_event(psy->online_trig, LED_FULL);
+ led_trigger_event(psy->trig, LED_FULL);
else
- led_trigger_event(psy->online_trig, LED_OFF);
+ led_trigger_event(psy->trig, LED_OFF);
}
static int power_supply_create_gen_triggers(struct power_supply *psy)
{
- return power_supply_register_led_trigger(psy, "%s-online", &psy->online_trig);
+ return power_supply_register_led_trigger(psy, "%s-online", &psy->trig);
}
static void power_supply_remove_gen_triggers(struct power_supply *psy)
{
- power_supply_unregister_led_trigger(psy->online_trig);
+ power_supply_unregister_led_trigger(psy->trig);
}
/* Choice what triggers to create&update. */
@@ -309,10 +309,9 @@ struct power_supply {
#endif
#ifdef CONFIG_LEDS_TRIGGERS
- struct led_trigger *charging_full_trig;
+ struct led_trigger *trig;
struct led_trigger *charging_trig;
struct led_trigger *full_trig;
- struct led_trigger *online_trig;
struct led_trigger *charging_blink_full_solid_trig;
struct led_trigger *charging_orange_full_green_trig;
#endif
Either 5 different LED triggers are registered for battery power-supply devices or a single online LED trigger is used for non battery power-supply devices. These 5 / 1 LED trigger(s) are never used at the same time. So there is no need for a separate LED trigger pointer for the online trigger. Rename the first battery trigger from charging_full_trig to just trig and use this for the online trigger too. Signed-off-by: Hans de Goede <hdegoede@redhat.com> --- drivers/power/supply/power_supply_leds.c | 18 +++++++++--------- include/linux/power_supply.h | 3 +-- 2 files changed, 10 insertions(+), 11 deletions(-)