kernel: update kernel 3.18 to version 3.18.23
[openwrt/staging/chunkeey.git] / target / linux / generic / patches-3.18 / 831-ledtrig_netdev.patch
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
6
7 +config LEDS_TRIGGER_NETDEV
8 + tristate "LED Netdev Trigger"
9 + depends on NET && LEDS_TRIGGERS
10 + help
11 + This allows LEDs to be controlled by network device activity.
12 + If unsure, say Y.
13 +
14 endif # LEDS_TRIGGERS
15 --- a/drivers/leds/Makefile
16 +++ b/drivers/leds/Makefile
17 @@ -63,3 +63,4 @@ obj-$(CONFIG_LEDS_DAC124S085) += leds-d
18 # LED Triggers
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
24 @@ -22,7 +22,6 @@
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
33 unsigned long evt,
34 void *dv)
35 {
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);
39
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)
43 {
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;
49
50 write_lock(&trigger_data->lock);
51
52 @@ -305,7 +305,7 @@ static void netdev_trig_timer(unsigned l
53 goto no_restart;
54 }
55
56 - dev_stats = dev_get_stats(trigger_data->net_dev);
57 + dev_stats = dev_get_stats(trigger_data->net_dev, &temp);
58 new_activity =
59 ((trigger_data->mode & MODE_TX) ? dev_stats->tx_packets : 0) +
60 ((trigger_data->mode & MODE_RX) ? dev_stats->rx_packets : 0);