[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1401264283-9353-2-git-send-email-mkl@pengutronix.de>
Date: Wed, 28 May 2014 10:04:43 +0200
From: Marc Kleine-Budde <mkl@...gutronix.de>
To: netdev@...r.kernel.org
Cc: davem@...emloft.net, linux-can@...r.kernel.org,
kernel@...gutronix.de, Oliver Hartkopp <socketcan@...tkopp.net>,
Fabio Baltieri <fabio.baltieri@...il.com>,
linux-stable <stable@...r.kernel.org>,
Marc Kleine-Budde <mkl@...gutronix.de>
Subject: [PATCH] can: only rename enabled led triggers when changing the netdev name
From: Oliver Hartkopp <socketcan@...tkopp.net>
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.
Cc: Fabio Baltieri <fabio.baltieri@...il.com>
Signed-off-by: Oliver Hartkopp <socketcan@...tkopp.net>
Acked-by: Kurt Van Dijck <dev.kurt@...dijck-laurijssen.be>
Cc: linux-stable <stable@...r.kernel.org> # >= v3.9
Signed-off-by: Marc Kleine-Budde <mkl@...gutronix.de>
---
drivers/net/can/led.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/net/can/led.c b/drivers/net/can/led.c
index a3d99a8..ab7f1b0 100644
--- a/drivers/net/can/led.c
+++ b/drivers/net/can/led.c
@@ -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);
--
2.0.0.rc2
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists