[OpenWrt-Devel] [PATCH] kernel: ledtrig-netdev: use netdev_notifier_info

Claudio Leite leitec at staticky.com
Mon Jul 7 20:24:32 EDT 2014


Since kernel 3.11, the third parameter passed to notifier_call()
is of type struct netdev_notifier_info. This patch fixes an oops
when setting a netdev LED trigger.

Signed-off-by: Claudio Leite <leitec at staticky.com>
---
 .../patches-3.12/833-ledtrig_netdev-use-notifier-info.patch | 13 +++++++++++++
 .../patches-3.13/833-ledtrig_netdev-use-notifier-info.patch | 13 +++++++++++++
 .../patches-3.14/833-ledtrig_netdev-use-notifier-info.patch | 13 +++++++++++++
 3 files changed, 39 insertions(+)
 create mode 100644 target/linux/generic/patches-3.12/833-ledtrig_netdev-use-notifier-info.patch
 create mode 100644 target/linux/generic/patches-3.13/833-ledtrig_netdev-use-notifier-info.patch
 create mode 100644 target/linux/generic/patches-3.14/833-ledtrig_netdev-use-notifier-info.patch

diff --git a/target/linux/generic/patches-3.12/833-ledtrig_netdev-use-notifier-info.patch b/target/linux/generic/patches-3.12/833-ledtrig_netdev-use-notifier-info.patch
new file mode 100644
index 0000000..bdaca82
--- /dev/null
+++ b/target/linux/generic/patches-3.12/833-ledtrig_netdev-use-notifier-info.patch
@@ -0,0 +1,13 @@
+Index: linux-3.14.10/drivers/leds/ledtrig-netdev.c
+===================================================================
+--- linux-3.14.10.orig/drivers/leds/ledtrig-netdev.c
++++ linux-3.14.10/drivers/leds/ledtrig-netdev.c
+@@ -253,7 +253,7 @@ static int netdev_trig_notify(struct not
+ 			      unsigned long evt,
+ 			      void *dv)
+ {
+-	struct net_device *dev = dv;
++	struct net_device *dev = netdev_notifier_info_to_dev((struct netdev_notifier_info *)dv);
+ 	struct led_netdev_data *trigger_data = container_of(nb, struct led_netdev_data, notifier);
+ 
+ 	if (evt != NETDEV_UP && evt != NETDEV_DOWN && evt != NETDEV_CHANGE && evt != NETDEV_REGISTER && evt != NETDEV_UNREGISTER)
diff --git a/target/linux/generic/patches-3.13/833-ledtrig_netdev-use-notifier-info.patch b/target/linux/generic/patches-3.13/833-ledtrig_netdev-use-notifier-info.patch
new file mode 100644
index 0000000..bdaca82
--- /dev/null
+++ b/target/linux/generic/patches-3.13/833-ledtrig_netdev-use-notifier-info.patch
@@ -0,0 +1,13 @@
+Index: linux-3.14.10/drivers/leds/ledtrig-netdev.c
+===================================================================
+--- linux-3.14.10.orig/drivers/leds/ledtrig-netdev.c
++++ linux-3.14.10/drivers/leds/ledtrig-netdev.c
+@@ -253,7 +253,7 @@ static int netdev_trig_notify(struct not
+ 			      unsigned long evt,
+ 			      void *dv)
+ {
+-	struct net_device *dev = dv;
++	struct net_device *dev = netdev_notifier_info_to_dev((struct netdev_notifier_info *)dv);
+ 	struct led_netdev_data *trigger_data = container_of(nb, struct led_netdev_data, notifier);
+ 
+ 	if (evt != NETDEV_UP && evt != NETDEV_DOWN && evt != NETDEV_CHANGE && evt != NETDEV_REGISTER && evt != NETDEV_UNREGISTER)
diff --git a/target/linux/generic/patches-3.14/833-ledtrig_netdev-use-notifier-info.patch b/target/linux/generic/patches-3.14/833-ledtrig_netdev-use-notifier-info.patch
new file mode 100644
index 0000000..bdaca82
--- /dev/null
+++ b/target/linux/generic/patches-3.14/833-ledtrig_netdev-use-notifier-info.patch
@@ -0,0 +1,13 @@
+Index: linux-3.14.10/drivers/leds/ledtrig-netdev.c
+===================================================================
+--- linux-3.14.10.orig/drivers/leds/ledtrig-netdev.c
++++ linux-3.14.10/drivers/leds/ledtrig-netdev.c
+@@ -253,7 +253,7 @@ static int netdev_trig_notify(struct not
+ 			      unsigned long evt,
+ 			      void *dv)
+ {
+-	struct net_device *dev = dv;
++	struct net_device *dev = netdev_notifier_info_to_dev((struct netdev_notifier_info *)dv);
+ 	struct led_netdev_data *trigger_data = container_of(nb, struct led_netdev_data, notifier);
+ 
+ 	if (evt != NETDEV_UP && evt != NETDEV_DOWN && evt != NETDEV_CHANGE && evt != NETDEV_REGISTER && evt != NETDEV_UNREGISTER)
-- 
2.0.1
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list