All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] can: only rename enabled led triggers when changing the netdev name
@ 2014-05-27 11:30 Oliver Hartkopp
  2014-05-27 13:00 ` Kurt Van Dijck
  2014-05-28  8:06 ` Marc Kleine-Budde
  0 siblings, 2 replies; 4+ messages in thread
From: Oliver Hartkopp @ 2014-05-27 11:30 UTC (permalink / raw)
  To: linux-can; +Cc: dev.kurt, fabio.baltieri, 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_LEDS is enabled and the driver does not
support led triggers.

For stable 3.9+

CC: Kurt Van Dijck <dev.kurt@vandijck-laurijssen.be>
CC: Fabio Baltieri <fabio.baltieri@gmail.com>
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
---
 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.rc4


^ permalink raw reply related	[flat|nested] 4+ messages in thread
* pull-request: can 2014-05-28
@ 2014-05-28  8:04 Marc Kleine-Budde
  2014-05-28  8:04 ` [PATCH] can: only rename enabled led triggers when changing the netdev name Marc Kleine-Budde
  0 siblings, 1 reply; 4+ messages in thread
From: Marc Kleine-Budde @ 2014-05-28  8:04 UTC (permalink / raw)
  To: netdev; +Cc: davem, linux-can, kernel

Hello David,

here's a pull request for v3.15, hope it's not too late.

Oliver Hartkopp fixed a bug in the CAN led trigger device renaming code.

regards,
Marc

---

The following changes since commit 8646224cdb945eca4293e2131e5be47930ce3e80:

  Merge branch 'for-davem' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless (2014-05-24 14:06:19 -0400)

are available in the git repository at:


  git://gitorious.org/linux-can/linux-can.git tags/linux-can-fixes-for-3.15-20140528

for you to fetch changes up to 45fb4f8d81578e0a17c45c4593a3305afbf7a48b:

  can: only rename enabled led triggers when changing the netdev name (2014-05-27 15:05:41 +0200)

----------------------------------------------------------------
linux-can-fixes-for-3.15-20140528

----------------------------------------------------------------
Oliver Hartkopp (1):
      can: only rename enabled led triggers when changing the netdev name

 drivers/net/can/led.c | 3 +++
 1 file changed, 3 insertions(+)



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-05-28  8:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-27 11:30 [PATCH] can: only rename enabled led triggers when changing the netdev name Oliver Hartkopp
2014-05-27 13:00 ` Kurt Van Dijck
2014-05-28  8:06 ` Marc Kleine-Budde
  -- strict thread matches above, loose matches on Subject: below --
2014-05-28  8:04 pull-request: can 2014-05-28 Marc Kleine-Budde
2014-05-28  8:04 ` [PATCH] can: only rename enabled led triggers when changing the netdev name Marc Kleine-Budde

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.