[PATCH v6 05/12] leds: cros_ec: Implement offloaded() trigger callback

From: Rong Zhang

Date: Tue Sep 01 2026 - 14:22:03 EST


"chromeos-auto" is a private hardware control trigger which always stays
in hardware control. Implement offloaded() callback with its return
value to be always true to reflect this.

Reviewed-by: Thomas Weißschuh <linux@xxxxxxxxxxxxxx>
Acked-by: Ike Panhc <ikepanhc@xxxxxxxxx>
Signed-off-by: Rong Zhang <i@xxxxxxxx>
---
Sashiko has reported this pre-existing issue in previous revisions:

- [High] Registering a global static `led_trigger` structure in a
driver's probe function causes list corruption and lock re-
initialization if the driver is probed multiple times.

The author is aware of it. Since the driver is very platform-specific
and the relevant platforms never have more than one such device, the bug
is never triggered on real devices. If a user manually binds the driver
to other devices, it's their fault. Therefore, fixing it is far beyond
the scope of the series.
---
drivers/leds/leds-cros_ec.c | 6 ++++++
1 file changed, 6 insertions(+)

diff --git a/drivers/leds/leds-cros_ec.c b/drivers/leds/leds-cros_ec.c
index 1844d0cd5f52..6db83d015277 100644
--- a/drivers/leds/leds-cros_ec.c
+++ b/drivers/leds/leds-cros_ec.c
@@ -85,12 +85,18 @@ static int cros_ec_led_trigger_activate(struct led_classdev *led_cdev)
return cros_ec_led_send_cmd(priv->cros_ec, &arg);
}

+static bool cros_ec_led_trigger_offloaded(struct led_classdev *led_cdev)
+{
+ return true;
+}
+
static struct led_hw_trigger_type cros_ec_led_trigger_type;

static struct led_trigger cros_ec_led_trigger = {
.name = "chromeos-auto",
.trigger_type = &cros_ec_led_trigger_type,
.activate = cros_ec_led_trigger_activate,
+ .offloaded = cros_ec_led_trigger_offloaded,
};

static int cros_ec_led_brightness_set_blocking(struct led_classdev *led_cdev,

--
2.55.0