diff options
author | Imre Kaloz <kaloz@openwrt.org> | 2014-06-21 10:00:07 +0000 |
---|---|---|
committer | Imre Kaloz <kaloz@openwrt.org> | 2014-06-21 10:00:07 +0000 |
commit | 8c3e3b42e925f8c843c228bb5d3123cb19741eb6 (patch) | |
tree | bfb34721e4c2cef78bed71d9b8d586f6710f942a /target/linux/generic | |
parent | 5cea7c1e9a0c938a159112c2409de9cf2a5e25e4 (diff) | |
download | master-187ad058-8c3e3b42e925f8c843c228bb5d3123cb19741eb6.tar.gz master-187ad058-8c3e3b42e925f8c843c228bb5d3123cb19741eb6.tar.bz2 master-187ad058-8c3e3b42e925f8c843c228bb5d3123cb19741eb6.zip |
[ledtrig-netdev]: coding style cleanups, drop old kernel support
Signed-off-by: Imre Kaloz <kaloz@openwrt.org>
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@41293 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux/generic')
-rw-r--r-- | target/linux/generic/files/drivers/leds/ledtrig-netdev.c | 29 |
1 files changed, 8 insertions, 21 deletions
diff --git a/target/linux/generic/files/drivers/leds/ledtrig-netdev.c b/target/linux/generic/files/drivers/leds/ledtrig-netdev.c index 6c56acb27d..4a20d7c050 100644 --- a/target/linux/generic/files/drivers/leds/ledtrig-netdev.c +++ b/target/linux/generic/files/drivers/leds/ledtrig-netdev.c @@ -27,11 +27,6 @@ #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" @@ -103,7 +98,7 @@ static void set_baseline_state(struct led_netdev_data *trigger_data) } static ssize_t led_device_name_show(struct device *dev, - struct device_attribute *attr, char *buf) + struct device_attribute *attr, char *buf) { struct led_classdev *led_cdev = dev_get_drvdata(dev); struct led_netdev_data *trigger_data = led_cdev->trigger_data; @@ -115,12 +110,8 @@ 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) + struct device_attribute *attr, const char *buf, size_t size) { struct led_classdev *led_cdev = dev_get_drvdata(dev); struct led_netdev_data *trigger_data = led_cdev->trigger_data; @@ -136,11 +127,7 @@ 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 */ @@ -153,7 +140,7 @@ static ssize_t led_device_name_store(struct device *dev, static DEVICE_ATTR(device_name, 0644, led_device_name_show, led_device_name_store); static ssize_t led_mode_show(struct device *dev, - struct device_attribute *attr, char *buf) + struct device_attribute *attr, char *buf) { struct led_classdev *led_cdev = dev_get_drvdata(dev); struct led_netdev_data *trigger_data = led_cdev->trigger_data; @@ -178,7 +165,7 @@ static ssize_t led_mode_show(struct device *dev, } static ssize_t led_mode_store(struct device *dev, - struct device_attribute *attr, const char *buf, size_t size) + struct device_attribute *attr, const char *buf, size_t size) { struct led_classdev *led_cdev = dev_get_drvdata(dev); struct led_netdev_data *trigger_data = led_cdev->trigger_data; @@ -224,7 +211,7 @@ static ssize_t led_mode_store(struct device *dev, static DEVICE_ATTR(mode, 0644, led_mode_show, led_mode_store); static ssize_t led_interval_show(struct device *dev, - struct device_attribute *attr, char *buf) + struct device_attribute *attr, char *buf) { struct led_classdev *led_cdev = dev_get_drvdata(dev); struct led_netdev_data *trigger_data = led_cdev->trigger_data; @@ -237,7 +224,7 @@ static ssize_t led_interval_show(struct device *dev, } static ssize_t led_interval_store(struct device *dev, - struct device_attribute *attr, const char *buf, size_t size) + struct device_attribute *attr, const char *buf, size_t size) { struct led_classdev *led_cdev = dev_get_drvdata(dev); struct led_netdev_data *trigger_data = led_cdev->trigger_data; @@ -246,14 +233,14 @@ static ssize_t led_interval_store(struct device *dev, unsigned long value = simple_strtoul(buf, &after, 10); size_t count = after - buf; - if (*after && isspace(*after)) + if (isspace(*after)) count++; /* impose some basic bounds on the timer interval */ if (count == size && value >= 5 && value <= 10000) { write_lock(&trigger_data->lock); trigger_data->interval = msecs_to_jiffies(value); - set_baseline_state(trigger_data); // resets timer + set_baseline_state(trigger_data); /* resets timer */ write_unlock(&trigger_data->lock); ret = count; } |