summaryrefslogtreecommitdiffstats
path: root/drivers/leds/ledtrig-timer.c
diff options
context:
space:
mode:
authorJohn W. Linville <linville@tuxdriver.com>2006-05-17 14:51:24 -0400
committerJohn W. Linville <linville@tuxdriver.com>2006-05-17 14:51:24 -0400
commit5dd8816aeb1f068ade0349a22009ff7a66f25413 (patch)
treec56ff327b1dfa8868b4208aea9ac4158e3bfe308 /drivers/leds/ledtrig-timer.c
parentf03cc4fd927357bd4b3cea1a053b9f9d8f1731cc (diff)
parent0c056c50a6218e0e577817c16ba8851af593d742 (diff)
downloadop-kernel-dev-5dd8816aeb1f068ade0349a22009ff7a66f25413.zip
op-kernel-dev-5dd8816aeb1f068ade0349a22009ff7a66f25413.tar.gz
Merge branch 'from-linus' into upstream
Diffstat (limited to 'drivers/leds/ledtrig-timer.c')
-rw-r--r--drivers/leds/ledtrig-timer.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/drivers/leds/ledtrig-timer.c b/drivers/leds/ledtrig-timer.c
index f484b5d6..fbf141e 100644
--- a/drivers/leds/ledtrig-timer.c
+++ b/drivers/leds/ledtrig-timer.c
@@ -20,6 +20,7 @@
#include <linux/device.h>
#include <linux/sysdev.h>
#include <linux/timer.h>
+#include <linux/ctype.h>
#include <linux/leds.h>
#include "leds.h"
@@ -69,11 +70,15 @@ static ssize_t led_delay_on_store(struct class_device *dev, const char *buf,
int ret = -EINVAL;
char *after;
unsigned long state = simple_strtoul(buf, &after, 10);
+ size_t count = after - buf;
- if (after - buf > 0) {
+ if (*after && isspace(*after))
+ count++;
+
+ if (count == size) {
timer_data->delay_on = state;
mod_timer(&timer_data->timer, jiffies + 1);
- ret = after - buf;
+ ret = count;
}
return ret;
@@ -97,11 +102,15 @@ static ssize_t led_delay_off_store(struct class_device *dev, const char *buf,
int ret = -EINVAL;
char *after;
unsigned long state = simple_strtoul(buf, &after, 10);
+ size_t count = after - buf;
+
+ if (*after && isspace(*after))
+ count++;
- if (after - buf > 0) {
+ if (count == size) {
timer_data->delay_off = state;
mod_timer(&timer_data->timer, jiffies + 1);
- ret = after - buf;
+ ret = count;
}
return ret;
OpenPOWER on IntegriCloud