831-ledtrig_netdev.patch 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. --- a/drivers/leds/Kconfig
  2. +++ b/drivers/leds/Kconfig
  3. @@ -565,4 +565,11 @@ config LEDS_TRIGGER_MORSE
  4. tristate "LED Morse Trigger"
  5. depends on LEDS_TRIGGERS
  6. +config LEDS_TRIGGER_NETDEV
  7. + tristate "LED Netdev Trigger"
  8. + depends on NET && LEDS_TRIGGERS
  9. + help
  10. + This allows LEDs to be controlled by network device activity.
  11. + If unsure, say Y.
  12. +
  13. endif # NEW_LEDS
  14. --- a/drivers/leds/Makefile
  15. +++ b/drivers/leds/Makefile
  16. @@ -66,3 +66,4 @@ obj-$(CONFIG_LEDS_TRIGGER_CPU) += ledtr
  17. obj-$(CONFIG_LEDS_TRIGGER_DEFAULT_ON) += ledtrig-default-on.o
  18. obj-$(CONFIG_LEDS_TRIGGER_TRANSIENT) += ledtrig-transient.o
  19. obj-$(CONFIG_LEDS_TRIGGER_MORSE) += ledtrig-morse.o
  20. +obj-$(CONFIG_LEDS_TRIGGER_NETDEV) += ledtrig-netdev.o
  21. --- a/drivers/leds/ledtrig-netdev.c
  22. +++ b/drivers/leds/ledtrig-netdev.c
  23. @@ -22,7 +22,6 @@
  24. #include <linux/list.h>
  25. #include <linux/spinlock.h>
  26. #include <linux/device.h>
  27. -#include <linux/sysdev.h>
  28. #include <linux/netdevice.h>
  29. #include <linux/timer.h>
  30. #include <linux/ctype.h>
  31. @@ -294,8 +293,9 @@ done:
  32. static void netdev_trig_timer(unsigned long arg)
  33. {
  34. struct led_netdev_data *trigger_data = (struct led_netdev_data *)arg;
  35. - const struct net_device_stats *dev_stats;
  36. + struct rtnl_link_stats64 *dev_stats;
  37. unsigned new_activity;
  38. + struct rtnl_link_stats64 temp;
  39. write_lock(&trigger_data->lock);
  40. @@ -305,7 +305,7 @@ static void netdev_trig_timer(unsigned l
  41. goto no_restart;
  42. }
  43. - dev_stats = dev_get_stats(trigger_data->net_dev);
  44. + dev_stats = dev_get_stats(trigger_data->net_dev, &temp);
  45. new_activity =
  46. ((trigger_data->mode & MODE_TX) ? dev_stats->tx_packets : 0) +
  47. ((trigger_data->mode & MODE_RX) ? dev_stats->rx_packets : 0);