Root/target/linux/generic/patches-3.7/831-ledtrig_netdev.patch

1--- a/drivers/leds/Kconfig
2+++ b/drivers/leds/Kconfig
3@@ -563,4 +563,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 # NEW_LEDS
15--- a/drivers/leds/Makefile
16+++ b/drivers/leds/Makefile
17@@ -66,3 +66,4 @@ obj-$(CONFIG_LEDS_TRIGGER_CPU) += ledtr
18 obj-$(CONFIG_LEDS_TRIGGER_DEFAULT_ON) += ledtrig-default-on.o
19 obj-$(CONFIG_LEDS_TRIGGER_TRANSIENT) += ledtrig-transient.o
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@@ -307,8 +306,9 @@ done:
33 static void netdev_trig_timer(unsigned long arg)
34 {
35     struct led_netdev_data *trigger_data = (struct led_netdev_data *)arg;
36- const struct net_device_stats *dev_stats;
37+ struct rtnl_link_stats64 *dev_stats;
38     unsigned new_activity;
39+ struct rtnl_link_stats64 temp;
40 
41     write_lock(&trigger_data->lock);
42 
43@@ -318,7 +318,7 @@ static void netdev_trig_timer(unsigned l
44         goto no_restart;
45     }
46 
47- dev_stats = dev_get_stats(trigger_data->net_dev);
48+ dev_stats = dev_get_stats(trigger_data->net_dev, &temp);
49     new_activity =
50         ((trigger_data->mode & MODE_TX) ? dev_stats->tx_packets : 0) +
51         ((trigger_data->mode & MODE_RX) ? dev_stats->rx_packets : 0);
52

Archive Download this file



interactive