mirror of
git://projects.qi-hardware.com/openwrt-xburst.git
synced 2024-12-18 21:22:27 +02:00
more ledtrig-netdev clean ups
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@12096 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
parent
63bb6b655e
commit
a563c1d49b
@ -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 */
|
||||||
|
Loading…
Reference in New Issue
Block a user