kernel: ledtrig-netdev: use netdev_notifier_info

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@staticky.com>

SVN-Revision: 41552
lede-17.01
Luka Perkov 2014-07-08 23:27:44 +00:00
parent 90b53991a0
commit 82abc5c1d9
3 changed files with 31 additions and 4 deletions

View File

@ -29,7 +29,16 @@
#include <linux/netdevice.h>
#include <linux/timer.h>
#include <linux/ctype.h>
@@ -307,8 +306,9 @@ done:
@@ -254,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)
@@ -294,8 +293,9 @@ done:
static void netdev_trig_timer(unsigned long arg)
{
struct led_netdev_data *trigger_data = (struct led_netdev_data *)arg;
@ -40,7 +49,7 @@
write_lock(&trigger_data->lock);
@@ -318,7 +318,7 @@ static void netdev_trig_timer(unsigned l
@@ -305,7 +305,7 @@ static void netdev_trig_timer(unsigned l
goto no_restart;
}

View File

@ -29,7 +29,16 @@
#include <linux/netdevice.h>
#include <linux/timer.h>
#include <linux/ctype.h>
@@ -307,8 +306,9 @@ done:
@@ -254,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)
@@ -294,8 +293,9 @@ done:
static void netdev_trig_timer(unsigned long arg)
{
struct led_netdev_data *trigger_data = (struct led_netdev_data *)arg;
@ -40,7 +49,7 @@
write_lock(&trigger_data->lock);
@@ -318,7 +318,7 @@ static void netdev_trig_timer(unsigned l
@@ -305,7 +305,7 @@ static void netdev_trig_timer(unsigned l
goto no_restart;
}

View File

@ -29,6 +29,15 @@
#include <linux/netdevice.h>
#include <linux/timer.h>
#include <linux/ctype.h>
@@ -254,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)
@@ -294,8 +293,9 @@ done:
static void netdev_trig_timer(unsigned long arg)
{