makes ledtrignetdev work on .26 and fix whitespaces
SVN-Revision: 12090
This commit is contained in:
parent
21bbdc24c3
commit
a641792a78
3 changed files with 96 additions and 56 deletions
|
@ -726,6 +726,7 @@ CONFIG_LEDS_TRIGGER_HEARTBEAT=y
|
||||||
# CONFIG_LEDS_TRIGGER_IDE_DISK is not set
|
# CONFIG_LEDS_TRIGGER_IDE_DISK is not set
|
||||||
# CONFIG_LEDS_TRIGGER_MORSE is not set
|
# CONFIG_LEDS_TRIGGER_MORSE is not set
|
||||||
CONFIG_LEDS_TRIGGER_TIMER=y
|
CONFIG_LEDS_TRIGGER_TIMER=y
|
||||||
|
CONFIG_LEDS_TRIGGER_NETDEV=y
|
||||||
# CONFIG_LEGACY_PTYS is not set
|
# CONFIG_LEGACY_PTYS is not set
|
||||||
CONFIG_LIBCRC32C=m
|
CONFIG_LIBCRC32C=m
|
||||||
# CONFIG_LIBERTAS is not set
|
# CONFIG_LIBERTAS is not set
|
||||||
|
|
|
@ -27,6 +27,12 @@
|
||||||
#include <linux/timer.h>
|
#include <linux/timer.h>
|
||||||
#include <linux/ctype.h>
|
#include <linux/ctype.h>
|
||||||
#include <linux/leds.h>
|
#include <linux/leds.h>
|
||||||
|
#include <linux/version.h>
|
||||||
|
|
||||||
|
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26)
|
||||||
|
#include <net/net_namespace.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "leds.h"
|
#include "leds.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -109,6 +115,10 @@ static ssize_t led_device_name_show(struct device *dev,
|
||||||
return strlen(buf) + 1;
|
return strlen(buf) + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,21)
|
||||||
|
extern struct net init_net;
|
||||||
|
#endif
|
||||||
|
|
||||||
static ssize_t led_device_name_store(struct device *dev,
|
static ssize_t led_device_name_store(struct device *dev,
|
||||||
struct device_attribute *attr, const char *buf, size_t size)
|
struct device_attribute *attr, const char *buf, size_t size)
|
||||||
{
|
{
|
||||||
|
@ -126,7 +136,11 @@ static ssize_t led_device_name_store(struct device *dev,
|
||||||
|
|
||||||
if (trigger_data->device_name[0] != 0) {
|
if (trigger_data->device_name[0] != 0) {
|
||||||
/* check for existing device to update from */
|
/* check for existing device to update from */
|
||||||
|
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26)
|
||||||
|
trigger_data->net_dev = dev_get_by_name(&init_net, trigger_data->device_name);
|
||||||
|
#else
|
||||||
trigger_data->net_dev = dev_get_by_name(trigger_data->device_name);
|
trigger_data->net_dev = dev_get_by_name(trigger_data->device_name);
|
||||||
|
#endif
|
||||||
if (trigger_data->net_dev != NULL)
|
if (trigger_data->net_dev != NULL)
|
||||||
trigger_data->link_up = (dev_get_flags(trigger_data->net_dev) & IFF_LOWER_UP) != 0;
|
trigger_data->link_up = (dev_get_flags(trigger_data->net_dev) & IFF_LOWER_UP) != 0;
|
||||||
set_baseline_state(trigger_data); /* updates LEDs, may start timers */
|
set_baseline_state(trigger_data); /* updates LEDs, may start timers */
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
Index: linux-2.6.26/drivers/leds/Kconfig
|
||||||
|
===================================================================
|
||||||
|
--- linux-2.6.26.orig/drivers/leds/Kconfig 2008-08-04 15:03:44.000000000 +0200
|
||||||
|
+++ linux-2.6.26/drivers/leds/Kconfig 2008-08-04 15:04:18.000000000 +0200
|
||||||
|
@@ -200,4 +200,11 @@
|
||||||
|
tristate "LED Morse Trigger"
|
||||||
|
depends on LEDS_TRIGGERS
|
||||||
|
|
||||||
|
+config LEDS_TRIGGER_NETDEV
|
||||||
|
+ tristate "LED Netdev Trigger"
|
||||||
|
+ depends on LEDS_TRIGGERS
|
||||||
|
+ help
|
||||||
|
+ This allows LEDs to be controlled by network device activity.
|
||||||
|
+ If unsure, say Y.
|
||||||
|
+
|
||||||
|
endif # NEW_LEDS
|
||||||
|
Index: linux-2.6.26/drivers/leds/Makefile
|
||||||
|
===================================================================
|
||||||
|
--- linux-2.6.26.orig/drivers/leds/Makefile 2008-08-04 15:03:40.000000000 +0200
|
||||||
|
+++ linux-2.6.26/drivers/leds/Makefile 2008-08-04 15:04:29.000000000 +0200
|
||||||
|
@@ -29,3 +29,4 @@
|
||||||
|
obj-$(CONFIG_LEDS_TRIGGER_HEARTBEAT) += ledtrig-heartbeat.o
|
||||||
|
obj-$(CONFIG_LEDS_TRIGGER_DEFAULT_ON) += ledtrig-default-on.o
|
||||||
|
obj-$(CONFIG_LEDS_TRIGGER_MORSE) += ledtrig-morse.o
|
||||||
|
+obj-$(CONFIG_LEDS_TRIGGER_NETDEV) += ledtrig-netdev.o
|
Loading…
Reference in a new issue