aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/leds/led-class.c
diff options
context:
space:
mode:
authorSven Wegener <sven.wegener@stealer.net>2008-10-13 05:41:39 -0400
committerRichard Purdie <rpurdie@linux.intel.com>2008-10-20 17:37:04 -0400
commitdd8e5a2039607e0f79c33549726a2415d977c938 (patch)
tree942cfaf23b21797dd8d8be4a22c4d2a8107a2545 /drivers/leds/led-class.c
parent6af4f55c31764c2d97ddf59ae2149cd1769e2e25 (diff)
leds: Remove uneeded strlen calls
There's no need for the additional call to strlen(), we can directly return the value returned by sprintf(). We now return a length value that doesn't include the final '\0', but user space shouldn't bother about it anyway. Signed-off-by: Sven Wegener <sven.wegener@stealer.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
Diffstat (limited to 'drivers/leds/led-class.c')
-rw-r--r--drivers/leds/led-class.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/drivers/leds/led-class.c b/drivers/leds/led-class.c
index ee74ee7b2acc..8a7d138ec503 100644
--- a/drivers/leds/led-class.c
+++ b/drivers/leds/led-class.c
@@ -34,14 +34,11 @@ static ssize_t led_brightness_show(struct device *dev,
34 struct device_attribute *attr, char *buf) 34 struct device_attribute *attr, char *buf)
35{ 35{
36 struct led_classdev *led_cdev = dev_get_drvdata(dev); 36 struct led_classdev *led_cdev = dev_get_drvdata(dev);
37 ssize_t ret = 0;
38 37
39 /* no lock needed for this */ 38 /* no lock needed for this */
40 led_update_brightness(led_cdev); 39 led_update_brightness(led_cdev);
41 sprintf(buf, "%u\n", led_cdev->brightness);
42 ret = strlen(buf) + 1;
43 40
44 return ret; 41 return sprintf(buf, "%u\n", led_cdev->brightness);
45} 42}
46 43
47static ssize_t led_brightness_store(struct device *dev, 44static ssize_t led_brightness_store(struct device *dev,