From f31b65a870f7b8b133bccf879cb3c5fc909d5d86 Mon Sep 17 00:00:00 2001 From: Mieczyslaw Nalewaj Date: Wed, 15 Jul 2026 18:58:21 +0200 Subject: [PATCH] ledtrig-network: default missing family to WLAN on non-DT LEDs For LEDs that have no network trigger configuration in Device Tree (no mode or family properties), net_activate() infers the family from the LED name or function string. If that inference fails, the trigger previously returned -EINVAL and refused to activate. This is too strict for manual activation via sysfs (e.g. echo "network" > /sys/class/leds//trigger) on LEDs that were not declared for the network trigger in DT. In that case the user expects the trigger to load with sensible defaults. Change the non-DT activation path to fall back to NET_TRIG_WLAN instead of failing, while keeping the condition visible via pr_warn(). Device Tree paths with dt_mode or dt_family are left unchanged and continue to fail on invalid parameters Signed-off-by: Mieczyslaw Nalewaj Link: https://github.com/openwrt/openwrt/pull/24235 Signed-off-by: Jonas Jelonek --- .../generic/files/drivers/leds/trigger/ledtrig-network.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/linux/generic/files/drivers/leds/trigger/ledtrig-network.c b/target/linux/generic/files/drivers/leds/trigger/ledtrig-network.c index e2e60c3a26..e40497dd8b 100644 --- a/target/linux/generic/files/drivers/leds/trigger/ledtrig-network.c +++ b/target/linux/generic/files/drivers/leds/trigger/ledtrig-network.c @@ -1070,9 +1070,9 @@ static int net_activate(struct led_classdev *led_cdev) */ parsed = parse_family_token(fn, &online); if (parsed < 0) { - pr_info("network: unknown function '%s' for LED %s\n", + pr_warn("network: cannot infer family from '%s' for LED %s, defaulting to 'wlan'\n", fn ?: "", name); - return -EINVAL; + parsed = NET_TRIG_WLAN; } if (online) {