aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJingoo Han <jg1.han@samsung.com>2012-01-10 18:09:19 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2012-01-10 19:30:48 -0500
commit66655760bf38861299e3c8196f5303f886b0eef9 (patch)
treefb027ccb8c61fa987aec251887c91541d310be9d
parent1cfc6fee34a4343d79357c46722eb840fbc04f46 (diff)
backlight: use kstrtoul()
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>
-rw-r--r--drivers/video/backlight/backlight.c6
-rw-r--r--drivers/video/backlight/lcd.c26
2 files changed, 13 insertions, 19 deletions
diff --git a/drivers/video/backlight/backlight.c b/drivers/video/backlight/backlight.c
index 7363c1b169e8..bf5b1ece7160 100644
--- a/drivers/video/backlight/backlight.c
+++ b/drivers/video/backlight/backlight.c
@@ -102,7 +102,7 @@ static void backlight_generate_event(struct backlight_device *bd,
102} 102}
103 103
104static ssize_t backlight_show_power(struct device *dev, 104static ssize_t backlight_show_power(struct device *dev,
105 struct device_attribute *attr,char *buf) 105 struct device_attribute *attr, char *buf)
106{ 106{
107 struct backlight_device *bd = to_backlight_device(dev); 107 struct backlight_device *bd = to_backlight_device(dev);
108 108
@@ -116,7 +116,7 @@ static ssize_t backlight_store_power(struct device *dev,
116 struct backlight_device *bd = to_backlight_device(dev); 116 struct backlight_device *bd = to_backlight_device(dev);
117 unsigned long power; 117 unsigned long power;
118 118
119 rc = strict_strtoul(buf, 0, &power); 119 rc = kstrtoul(buf, 0, &power);
120 if (rc) 120 if (rc)
121 return rc; 121 return rc;
122 122
@@ -150,7 +150,7 @@ static ssize_t backlight_store_brightness(struct device *dev,
150 struct backlight_device *bd = to_backlight_device(dev); 150 struct backlight_device *bd = to_backlight_device(dev);
151 unsigned long brightness; 151 unsigned long brightness;
152 152
153 rc = strict_strtoul(buf, 0, &brightness); 153 rc = kstrtoul(buf, 0, &brightness);
154 if (rc) 154 if (rc)
155 return rc; 155 return rc;
156 156
diff --git a/drivers/video/backlight/lcd.c b/drivers/video/backlight/lcd.c
index 71a11cadffc4..79c1b0d609a8 100644
--- a/drivers/video/backlight/lcd.c
+++ b/drivers/video/backlight/lcd.c
@@ -97,19 +97,16 @@ static ssize_t lcd_store_power(struct device *dev,
97 struct device_attribute *attr, const char *buf, size_t count) 97 struct device_attribute *attr, const char *buf, size_t count)
98{ 98{
99 int rc = -ENXIO; 99 int rc = -ENXIO;
100 char *endp;
101 struct lcd_device *ld = to_lcd_device(dev); 100 struct lcd_device *ld = to_lcd_device(dev);
102 int power = simple_strtoul(buf, &endp, 0); 101 unsigned long power;
103 size_t size = endp - buf;
104 102
105 if (isspace(*endp)) 103 rc = kstrtoul(buf, 0, &power);
106 size++; 104 if (rc)
107 if (size != count) 105 return rc;
108 return -EINVAL;
109 106
110 mutex_lock(&ld->ops_lock); 107 mutex_lock(&ld->ops_lock);
111 if (ld->ops && ld->ops->set_power) { 108 if (ld->ops && ld->ops->set_power) {
112 pr_debug("lcd: set power to %d\n", power); 109 pr_debug("lcd: set power to %lu\n", power);
113 ld->ops->set_power(ld, power); 110 ld->ops->set_power(ld, power);
114 rc = count; 111 rc = count;
115 } 112 }
@@ -136,19 +133,16 @@ static ssize_t lcd_store_contrast(struct device *dev,
136 struct device_attribute *attr, const char *buf, size_t count) 133 struct device_attribute *attr, const char *buf, size_t count)
137{ 134{
138 int rc = -ENXIO; 135 int rc = -ENXIO;
139 char *endp;
140 struct lcd_device *ld = to_lcd_device(dev); 136 struct lcd_device *ld = to_lcd_device(dev);
141 int contrast = simple_strtoul(buf, &endp, 0); 137 unsigned long contrast;
142 size_t size = endp - buf;
143 138
144 if (isspace(*endp)) 139 rc = kstrtoul(buf, 0, &contrast);
145 size++; 140 if (rc)
146 if (size != count) 141 return rc;
147 return -EINVAL;
148 142
149 mutex_lock(&ld->ops_lock); 143 mutex_lock(&ld->ops_lock);
150 if (ld->ops && ld->ops->set_contrast) { 144 if (ld->ops && ld->ops->set_contrast) {
151 pr_debug("lcd: set contrast to %d\n", contrast); 145 pr_debug("lcd: set contrast to %lu\n", contrast);
152 ld->ops->set_contrast(ld, contrast); 146 ld->ops->set_contrast(ld, contrast);
153 rc = count; 147 rc = count;
154 } 148 }