more ledtrig-netdev clean ups
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@12096 3c298f89-4303-0410-b956-a3cf2f4a3e73master
parent
ffed9795a4
commit
794a0fda09
|
@ -27,6 +27,12 @@
|
|||
#include <linux/timer.h>
|
||||
#include <linux/ctype.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"
|
||||
|
||||
/*
|
||||
|
@ -109,6 +115,10 @@ static ssize_t led_device_name_show(struct device *dev,
|
|||
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,
|
||||
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) {
|
||||
/* 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);
|
||||
#endif
|
||||
if (trigger_data->net_dev != NULL)
|
||||
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 */
|
||||
|
|
Loading…
Reference in New Issue