diff options
author | Shuah Khan <shuahkhan@gmail.com> | 2012-05-29 15:07:26 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-05-29 16:22:31 -0700 |
commit | 872b86be0a285b11b03614456b67fdaf78e86f3d (patch) | |
tree | 1bd709cf5e71997b290e3eaf9a4aa8dd16dc49a9 /drivers/leds/led-class.c | |
parent | 5ba736311bf6fea25c97e868b7de6d3de8800aba (diff) | |
download | linux-872b86be0a285b11b03614456b67fdaf78e86f3d.tar.gz linux-872b86be0a285b11b03614456b67fdaf78e86f3d.tar.bz2 linux-872b86be0a285b11b03614456b67fdaf78e86f3d.zip |
leds: simple_strtoul() cleanup
led-class.c and ledtrig-timer.c still use simple_strtoul(). Change them
to use kstrtoul() instead of obsolete simple_strtoul().
Also fix the existing int ret declaration to be ssize_t to match the
return type for _store functions in ledtrig-timer.c.
Signed-off-by: Shuah Khan <shuahkhan@gmail.com>
Cc: Joe Perches <joe@perches.com>
Cc: Richard Purdie <rpurdie@rpsys.net>
Cc: Bryan Wu <bryan.wu@canonical.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/leds/led-class.c')
-rw-r--r-- | drivers/leds/led-class.c | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/drivers/leds/led-class.c b/drivers/leds/led-class.c index 5bff8439dc68..8ee92c81aec2 100644 --- a/drivers/leds/led-class.c +++ b/drivers/leds/led-class.c @@ -44,23 +44,18 @@ static ssize_t led_brightness_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t size) { struct led_classdev *led_cdev = dev_get_drvdata(dev); + unsigned long state; ssize_t ret = -EINVAL; - char *after; - unsigned long state = simple_strtoul(buf, &after, 10); - size_t count = after - buf; - if (isspace(*after)) - count++; + ret = kstrtoul(buf, 10, &state); + if (ret) + return ret; - if (count == size) { - ret = count; + if (state == LED_OFF) + led_trigger_remove(led_cdev); + led_set_brightness(led_cdev, state); - if (state == LED_OFF) - led_trigger_remove(led_cdev); - led_set_brightness(led_cdev, state); - } - - return ret; + return size; } static ssize_t led_max_brightness_show(struct device *dev, |