generic: 6.1: backport various qca8k fixes patch
[openwrt/openwrt.git] / target / linux / generic / backport-6.1 / 826-v6.6-04-leds-trig-netdev-Disable-offload-on-deactivation-of-.patch
1 From e8fbcc47a8e935f36f044d85f21a99acecbd7bfb Mon Sep 17 00:00:00 2001
2 From: Andrew Lunn <andrew@lunn.ch>
3 Date: Tue, 8 Aug 2023 23:04:36 +0200
4 Subject: [PATCH 4/4] leds: trig-netdev: Disable offload on deactivation of
5 trigger
6
7 Ensure that the offloading of blinking is stopped when the trigger is
8 deactivated. Calling led_set_brightness() is documented as stopping
9 offload and setting the LED to a constant brightness.
10
11 Suggested-by: Daniel Golle <daniel@makrotopia.org>
12 Signed-off-by: Andrew Lunn <andrew@lunn.ch>
13 Reviewed-by: Simon Horman <simon.horman@corigine.com>
14 Tested-by: Daniel Golle <daniel@makrotopia.org>
15 Link: https://lore.kernel.org/r/20230808210436.838995-5-andrew@lunn.ch
16 Signed-off-by: Jakub Kicinski <kuba@kernel.org>
17 ---
18 drivers/leds/trigger/ledtrig-netdev.c | 2 ++
19 1 file changed, 2 insertions(+)
20
21 --- a/drivers/leds/trigger/ledtrig-netdev.c
22 +++ b/drivers/leds/trigger/ledtrig-netdev.c
23 @@ -595,6 +595,8 @@ static void netdev_trig_deactivate(struc
24
25 cancel_delayed_work_sync(&trigger_data->work);
26
27 + led_set_brightness(led_cdev, LED_OFF);
28 +
29 dev_put(trigger_data->net_dev);
30
31 kfree(trigger_data);