1 --- a/drivers/leds/trigger/Kconfig
2 +++ b/drivers/leds/trigger/Kconfig
3 @@ -112,4 +112,11 @@ config LEDS_TRIGGER_MORSE
4 tristate "LED Morse Trigger"
5 depends on LEDS_TRIGGERS
7 +config LEDS_TRIGGER_NETDEV
8 + tristate "LED Netdev Trigger"
9 + depends on NET && LEDS_TRIGGERS
11 + This allows LEDs to be controlled by network device activity.
15 --- a/drivers/leds/Makefile
16 +++ b/drivers/leds/Makefile
17 @@ -66,3 +66,4 @@ obj-$(CONFIG_LEDS_DAC124S085) += leds-d
19 obj-$(CONFIG_LEDS_TRIGGERS) += trigger/
20 obj-$(CONFIG_LEDS_TRIGGER_MORSE) += ledtrig-morse.o
21 +obj-$(CONFIG_LEDS_TRIGGER_NETDEV) += ledtrig-netdev.o
22 --- a/drivers/leds/ledtrig-netdev.c
23 +++ b/drivers/leds/ledtrig-netdev.c
25 #include <linux/list.h>
26 #include <linux/spinlock.h>
27 #include <linux/device.h>
28 -#include <linux/sysdev.h>
29 #include <linux/netdevice.h>
30 #include <linux/timer.h>
31 #include <linux/ctype.h>
32 @@ -254,7 +253,7 @@ static int netdev_trig_notify(struct not
36 - struct net_device *dev = dv;
37 + struct net_device *dev = netdev_notifier_info_to_dev((struct netdev_notifier_info *) dv);
38 struct led_netdev_data *trigger_data = container_of(nb, struct led_netdev_data, notifier);
40 if (evt != NETDEV_UP && evt != NETDEV_DOWN && evt != NETDEV_CHANGE && evt != NETDEV_REGISTER && evt != NETDEV_UNREGISTER)
41 @@ -294,8 +293,9 @@ done:
42 static void netdev_trig_timer(unsigned long arg)
44 struct led_netdev_data *trigger_data = (struct led_netdev_data *)arg;
45 - const struct net_device_stats *dev_stats;
46 + struct rtnl_link_stats64 *dev_stats;
47 unsigned new_activity;
48 + struct rtnl_link_stats64 temp;
50 write_lock(&trigger_data->lock);
52 @@ -305,7 +305,7 @@ static void netdev_trig_timer(unsigned l
56 - dev_stats = dev_get_stats(trigger_data->net_dev);
57 + dev_stats = dev_get_stats(trigger_data->net_dev, &temp);
59 ((trigger_data->mode & MODE_TX) ? dev_stats->tx_packets : 0) +
60 ((trigger_data->mode & MODE_RX) ? dev_stats->rx_packets : 0);