3385023168de17aba94166a3a9a515c7d146d5ab
[openwrt/staging/linusw.git] /
1 From cee4bd16c3195a701be683f7da9e88c6e11acb73 Mon Sep 17 00:00:00 2001
2 From: Christian Marangi <ansuelsmth@gmail.com>
3 Date: Wed, 19 Apr 2023 23:07:39 +0200
4 Subject: [PATCH 1/5] leds: trigger: netdev: Recheck NETDEV_LED_MODE_LINKUP on
5 dev rename
6
7 Dev can be renamed also while up for supported device. We currently
8 wrongly clear the NETDEV_LED_MODE_LINKUP flag on NETDEV_CHANGENAME
9 event.
10
11 Fix this by rechecking if the carrier is ok on NETDEV_CHANGENAME and
12 correctly set the NETDEV_LED_MODE_LINKUP bit.
13
14 Fixes: 5f820ed52371 ("leds: trigger: netdev: fix handling on interface rename")
15 Cc: stable@vger.kernel.org # v5.5+
16 Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
17 Reviewed-by: Andrew Lunn <andrew@lunn.ch>
18 Signed-off-by: Lee Jones <lee@kernel.org>
19 Link: https://lore.kernel.org/r/20230419210743.3594-2-ansuelsmth@gmail.com
20 ---
21 drivers/leds/trigger/ledtrig-netdev.c | 3 +++
22 1 file changed, 3 insertions(+)
23
24 --- a/drivers/leds/trigger/ledtrig-netdev.c
25 +++ b/drivers/leds/trigger/ledtrig-netdev.c
26 @@ -318,6 +318,9 @@ static int netdev_trig_notify(struct not
27 clear_bit(NETDEV_LED_MODE_LINKUP, &trigger_data->mode);
28 switch (evt) {
29 case NETDEV_CHANGENAME:
30 + if (netif_carrier_ok(dev))
31 + set_bit(NETDEV_LED_MODE_LINKUP, &trigger_data->mode);
32 + fallthrough;
33 case NETDEV_REGISTER:
34 if (trigger_data->net_dev)
35 dev_put(trigger_data->net_dev);