Message ID | 20230419210743.3594-2-ansuelsmth@gmail.com |
---|---|
State | New |
Headers | show |
Series | leds: trigger: netdev: fixup preparation for LEDs hw control | expand |
On Wed, Apr 19, 2023 at 11:07:39PM +0200, Christian Marangi wrote: > Dev can be renamed also while up for supported device. We currently > wrongly clear the NETDEV_LED_MODE_LINKUP flag on NETDEV_CHANGENAME > event. > > Fix this by rechecking if the carrier is ok on NETDEV_CHANGENAME and > correctly set the NETDEV_LED_MODE_LINKUP bit. > > Fixes: 5f820ed52371 ("leds: trigger: netdev: fix handling on interface rename") > Signed-off-by: Christian Marangi <ansuelsmth@gmail.com> > Cc: stable@vger.kernel.org # v5.5+ Since this is a fix, it should be posted on its own. It should then get merged faster and backported to stable. Reviewed-by: Andrew Lunn <andrew@lunn.ch> Andrew
On Wed, 19 Apr 2023, Christian Marangi wrote: > Dev can be renamed also while up for supported device. We currently > wrongly clear the NETDEV_LED_MODE_LINKUP flag on NETDEV_CHANGENAME > event. > > Fix this by rechecking if the carrier is ok on NETDEV_CHANGENAME and > correctly set the NETDEV_LED_MODE_LINKUP bit. > > Fixes: 5f820ed52371 ("leds: trigger: netdev: fix handling on interface rename") > Signed-off-by: Christian Marangi <ansuelsmth@gmail.com> > Cc: stable@vger.kernel.org # v5.5+ > --- > drivers/leds/trigger/ledtrig-netdev.c | 3 +++ > 1 file changed, 3 insertions(+) Applied, thanks
diff --git a/drivers/leds/trigger/ledtrig-netdev.c b/drivers/leds/trigger/ledtrig-netdev.c index d5e774d83021..f4d670ec30bc 100644 --- a/drivers/leds/trigger/ledtrig-netdev.c +++ b/drivers/leds/trigger/ledtrig-netdev.c @@ -318,6 +318,9 @@ static int netdev_trig_notify(struct notifier_block *nb, clear_bit(NETDEV_LED_MODE_LINKUP, &trigger_data->mode); switch (evt) { case NETDEV_CHANGENAME: + if (netif_carrier_ok(dev)) + set_bit(NETDEV_LED_MODE_LINKUP, &trigger_data->mode); + fallthrough; case NETDEV_REGISTER: if (trigger_data->net_dev) dev_put(trigger_data->net_dev);
Dev can be renamed also while up for supported device. We currently wrongly clear the NETDEV_LED_MODE_LINKUP flag on NETDEV_CHANGENAME event. Fix this by rechecking if the carrier is ok on NETDEV_CHANGENAME and correctly set the NETDEV_LED_MODE_LINKUP bit. Fixes: 5f820ed52371 ("leds: trigger: netdev: fix handling on interface rename") Signed-off-by: Christian Marangi <ansuelsmth@gmail.com> Cc: stable@vger.kernel.org # v5.5+ --- drivers/leds/trigger/ledtrig-netdev.c | 3 +++ 1 file changed, 3 insertions(+)