]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
backlight: use kstrtoul()
authorJingoo Han <jg1.han@samsung.com>
Tue, 10 Jan 2012 23:09:19 +0000 (15:09 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 11 Jan 2012 00:30:48 +0000 (16:30 -0800)
The usage of simple_strtoul() or strict_strtoul() is not preferred.  Thus,
kstrtoul should be used.

This patch also fixes checkpatch error as follows:
ERROR: space required after that ',' (ctx:VxV)

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Cc: Richard Purdie <rpurdie@rpsys.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/video/backlight/backlight.c
drivers/video/backlight/lcd.c

index 7363c1b169e8f5719e5ba9bc1dee3542de468169..bf5b1ece71605d701516f599af7ef1ce18751a11 100644 (file)
@@ -102,7 +102,7 @@ static void backlight_generate_event(struct backlight_device *bd,
 }
 
 static ssize_t backlight_show_power(struct device *dev,
-               struct device_attribute *attr,char *buf)
+               struct device_attribute *attr, char *buf)
 {
        struct backlight_device *bd = to_backlight_device(dev);
 
@@ -116,7 +116,7 @@ static ssize_t backlight_store_power(struct device *dev,
        struct backlight_device *bd = to_backlight_device(dev);
        unsigned long power;
 
-       rc = strict_strtoul(buf, 0, &power);
+       rc = kstrtoul(buf, 0, &power);
        if (rc)
                return rc;
 
@@ -150,7 +150,7 @@ static ssize_t backlight_store_brightness(struct device *dev,
        struct backlight_device *bd = to_backlight_device(dev);
        unsigned long brightness;
 
-       rc = strict_strtoul(buf, 0, &brightness);
+       rc = kstrtoul(buf, 0, &brightness);
        if (rc)
                return rc;
 
index 71a11cadffc48134b3ab164cb798f7278be6f802..79c1b0d609a809e189f43515ee20f648a7d2e8fa 100644 (file)
@@ -97,19 +97,16 @@ static ssize_t lcd_store_power(struct device *dev,
                struct device_attribute *attr, const char *buf, size_t count)
 {
        int rc = -ENXIO;
-       char *endp;
        struct lcd_device *ld = to_lcd_device(dev);
-       int power = simple_strtoul(buf, &endp, 0);
-       size_t size = endp - buf;
+       unsigned long power;
 
-       if (isspace(*endp))
-               size++;
-       if (size != count)
-               return -EINVAL;
+       rc = kstrtoul(buf, 0, &power);
+       if (rc)
+               return rc;
 
        mutex_lock(&ld->ops_lock);
        if (ld->ops && ld->ops->set_power) {
-               pr_debug("lcd: set power to %d\n", power);
+               pr_debug("lcd: set power to %lu\n", power);
                ld->ops->set_power(ld, power);
                rc = count;
        }
@@ -136,19 +133,16 @@ static ssize_t lcd_store_contrast(struct device *dev,
                struct device_attribute *attr, const char *buf, size_t count)
 {
        int rc = -ENXIO;
-       char *endp;
        struct lcd_device *ld = to_lcd_device(dev);
-       int contrast = simple_strtoul(buf, &endp, 0);
-       size_t size = endp - buf;
+       unsigned long contrast;
 
-       if (isspace(*endp))
-               size++;
-       if (size != count)
-               return -EINVAL;
+       rc = kstrtoul(buf, 0, &contrast);
+       if (rc)
+               return rc;
 
        mutex_lock(&ld->ops_lock);
        if (ld->ops && ld->ops->set_contrast) {
-               pr_debug("lcd: set contrast to %d\n", contrast);
+               pr_debug("lcd: set contrast to %lu\n", contrast);
                ld->ops->set_contrast(ld, contrast);
                rc = count;
        }