can: only rename enabled led triggers when changing the netdev name
PATCH 1/1 can: only rename enabled led triggers when changing the netdev name
Commit a1ef7bd9fce8 ("can: rename LED trigger name on netdev renames") renames the led trigger names according to the changed netdevice name.
As not every CAN driver supports and initializes the led triggers, checking for the CAN private datastructure with safe_candev_priv() in the notifier chain is not enough.
This patch adds a check when CONFIG_CAN_LEDS is enabled and the driver does not support led triggers.
For stable 3.9+
--- drivers/net/can/led.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/can/led.c +3 -0
@@ -97,6 +97,9 @@ static int can_led_notifier(struct notifier_block *nb, unsigned long msg,if (!priv)return NOTIFY_DONE ; +if (!priv->tx_led_trig || !priv->rx_led_trig) +return NOTIFY_DONE ; +if (msg ==NETDEV_CHANGENAME ) {snprintf (name,sizeof (name),"%s-tx" , netdev->name);led_trigger_rename_static (name, priv->tx_led_trig);
Signature · 1 line
2.0.0.rc4
Hey Oliver,
nice clean patch.
Quoted 40 lines · Oliver Hartkopp
Commit
a1ef7bd9fce8("can: rename LED trigger name on netdev renames") renames the led trigger names according to the changed netdevice name.As not every CAN driver supports and initializes the led triggers, checking for the CAN private datastructure with
safe_candev_priv()in the notifier chain is not enough.This patch adds a check when
CONFIG_CAN_LEDSis enabled and the driver does not support led triggers.For stable 3.9+
CC Kurt Van Dijck <[email protected]>CC Fabio Baltieri <[email protected]>Signed-off-by Oliver Hartkopp <[email protected]>--- drivers/net/can/led.c | 3 +++ 1 file changed, 3 insertions(+)drivers/net/can/led.c +3
-0@@ -97,6 +97,9 @@ static int can_led_notifier(struct notifier_block *nb, unsigned long msg,if (!priv)return NOTIFY_DONE ; +if (!priv->tx_led_trig || !priv->rx_led_trig) +return NOTIFY_DONE ; +if (msg ==NETDEV_CHANGENAME ) {snprintf (name,sizeof (name),"%s-tx" , netdev->name);led_trigger_rename_static (name, priv->tx_led_trig);Signature · 6 lines
2.0.0.rc4 -- To unsubscribe from this list: send the line "unsubscribe linux-can" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 7 lines · Oliver Hartkopp
Commit
a1ef7bd9fce8("can: rename LED trigger name on netdev renames") renames the led trigger names according to the changed netdevice name.As not every CAN driver supports and initializes the led triggers, checking for the CAN private datastructure with
safe_candev_priv()in the notifier chain is not enough.
Quoted 8 lines
This patch adds a check when
CONFIG_CAN_LEDSis enabled and the driver does not support led triggers.For stable 3.9+
CC Kurt Van Dijck <[email protected]>CC Fabio Baltieri <[email protected]>Signed-off-by Oliver Hartkopp <[email protected]>
Applied to can.
Thanks,
Marc
Signature · 4 lines
Pengutronix e.K. | Marc Kleine-Budde | Industrial Linux Solutions | Phone: +49-231-2826-924 | Vertretung West/Dortmund | Fax: +49-5121-206917-5555 | Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de |