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/ledtrig-timer.c | |
parent | 5ba736311bf6fea25c97e868b7de6d3de8800aba (diff) | |
download | blackbird-op-linux-872b86be0a285b11b03614456b67fdaf78e86f3d.tar.gz blackbird-op-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/ledtrig-timer.c')
-rw-r--r-- | drivers/leds/ledtrig-timer.c | 48 |
1 files changed, 20 insertions, 28 deletions
diff --git a/drivers/leds/ledtrig-timer.c b/drivers/leds/ledtrig-timer.c index 328c64c0841c..b32d5eae8227 100644 --- a/drivers/leds/ledtrig-timer.c +++ b/drivers/leds/ledtrig-timer.c @@ -31,21 +31,17 @@ static ssize_t led_delay_on_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t size) { struct led_classdev *led_cdev = dev_get_drvdata(dev); - int ret = -EINVAL; - char *after; - unsigned long state = simple_strtoul(buf, &after, 10); - size_t count = after - buf; - - if (isspace(*after)) - count++; - - if (count == size) { - led_blink_set(led_cdev, &state, &led_cdev->blink_delay_off); - led_cdev->blink_delay_on = state; - ret = count; - } + unsigned long state; + ssize_t ret = -EINVAL; + + ret = kstrtoul(buf, 10, &state); + if (ret) + return ret; + + led_blink_set(led_cdev, &state, &led_cdev->blink_delay_off); + led_cdev->blink_delay_on = state; - return ret; + return size; } static ssize_t led_delay_off_show(struct device *dev, @@ -60,21 +56,17 @@ static ssize_t led_delay_off_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t size) { struct led_classdev *led_cdev = dev_get_drvdata(dev); - int ret = -EINVAL; - char *after; - unsigned long state = simple_strtoul(buf, &after, 10); - size_t count = after - buf; - - if (isspace(*after)) - count++; - - if (count == size) { - led_blink_set(led_cdev, &led_cdev->blink_delay_on, &state); - led_cdev->blink_delay_off = state; - ret = count; - } + unsigned long state; + ssize_t ret = -EINVAL; + + ret = kstrtoul(buf, 10, &state); + if (ret) + return ret; + + led_blink_set(led_cdev, &led_cdev->blink_delay_on, &state); + led_cdev->blink_delay_off = state; - return ret; + return size; } static DEVICE_ATTR(delay_on, 0644, led_delay_on_show, led_delay_on_store); |