Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 26714
b: refs/heads/master
c: 3dc7b82
h: refs/heads/master
v: v3
  • Loading branch information
Richard Purdie authored and Linus Torvalds committed May 15, 2006
1 parent f17697c commit 9ebbcc3
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 7 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 263de9b582b0f9b6ad5a0651b7df884fe80d6c3c
refs/heads/master: 3dc7b82ea7649356bf027fba50c16ca50cec31e2
9 changes: 7 additions & 2 deletions trunk/drivers/leds/led-class.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include <linux/sysdev.h>
#include <linux/timer.h>
#include <linux/err.h>
#include <linux/ctype.h>
#include <linux/leds.h>
#include "leds.h"

Expand All @@ -43,9 +44,13 @@ static ssize_t led_brightness_store(struct class_device *dev,
ssize_t ret = -EINVAL;
char *after;
unsigned long state = simple_strtoul(buf, &after, 10);
size_t count = after - buf;

if (after - buf > 0) {
ret = after - buf;
if (*after && isspace(*after))
count++;

if (count == size) {
ret = count;
led_set_brightness(led_cdev, state);
}

Expand Down
17 changes: 13 additions & 4 deletions trunk/drivers/leds/ledtrig-timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand Down

0 comments on commit 9ebbcc3

Please sign in to comment.