diff options
author | David Woodhouse <dwmw2@infradead.org> | 2006-05-24 04:22:21 -0400 |
---|---|---|
committer | David Woodhouse <dwmw2@infradead.org> | 2006-05-24 04:22:21 -0400 |
commit | 66643de455c27973ac31ad6de9f859d399916842 (patch) | |
tree | 7ebed7f051879007d4b11d6aaa9e65a1bcb0b08f /drivers/video/backlight/lcd.c | |
parent | 2c23d62abb820e19c54012520f08a198c2233a85 (diff) | |
parent | 387e2b0439026aa738a9edca15a57e5c0bcb4dfc (diff) |
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
Conflicts:
include/asm-powerpc/unistd.h
include/asm-sparc/unistd.h
include/asm-sparc64/unistd.h
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Diffstat (limited to 'drivers/video/backlight/lcd.c')
-rw-r--r-- | drivers/video/backlight/lcd.c | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/drivers/video/backlight/lcd.c b/drivers/video/backlight/lcd.c index 86908a60c630..bc8ab005a3fb 100644 --- a/drivers/video/backlight/lcd.c +++ b/drivers/video/backlight/lcd.c | |||
@@ -31,12 +31,15 @@ static ssize_t lcd_show_power(struct class_device *cdev, char *buf) | |||
31 | 31 | ||
32 | static ssize_t lcd_store_power(struct class_device *cdev, const char *buf, size_t count) | 32 | static ssize_t lcd_store_power(struct class_device *cdev, const char *buf, size_t count) |
33 | { | 33 | { |
34 | int rc, power; | 34 | int rc = -ENXIO; |
35 | char *endp; | 35 | char *endp; |
36 | struct lcd_device *ld = to_lcd_device(cdev); | 36 | struct lcd_device *ld = to_lcd_device(cdev); |
37 | int power = simple_strtoul(buf, &endp, 0); | ||
38 | size_t size = endp - buf; | ||
37 | 39 | ||
38 | power = simple_strtoul(buf, &endp, 0); | 40 | if (*endp && isspace(*endp)) |
39 | if (*endp && !isspace(*endp)) | 41 | size++; |
42 | if (size != count) | ||
40 | return -EINVAL; | 43 | return -EINVAL; |
41 | 44 | ||
42 | down(&ld->sem); | 45 | down(&ld->sem); |
@@ -44,8 +47,7 @@ static ssize_t lcd_store_power(struct class_device *cdev, const char *buf, size_ | |||
44 | pr_debug("lcd: set power to %d\n", power); | 47 | pr_debug("lcd: set power to %d\n", power); |
45 | ld->props->set_power(ld, power); | 48 | ld->props->set_power(ld, power); |
46 | rc = count; | 49 | rc = count; |
47 | } else | 50 | } |
48 | rc = -ENXIO; | ||
49 | up(&ld->sem); | 51 | up(&ld->sem); |
50 | 52 | ||
51 | return rc; | 53 | return rc; |
@@ -53,14 +55,12 @@ static ssize_t lcd_store_power(struct class_device *cdev, const char *buf, size_ | |||
53 | 55 | ||
54 | static ssize_t lcd_show_contrast(struct class_device *cdev, char *buf) | 56 | static ssize_t lcd_show_contrast(struct class_device *cdev, char *buf) |
55 | { | 57 | { |
56 | int rc; | 58 | int rc = -ENXIO; |
57 | struct lcd_device *ld = to_lcd_device(cdev); | 59 | struct lcd_device *ld = to_lcd_device(cdev); |
58 | 60 | ||
59 | down(&ld->sem); | 61 | down(&ld->sem); |
60 | if (likely(ld->props && ld->props->get_contrast)) | 62 | if (likely(ld->props && ld->props->get_contrast)) |
61 | rc = sprintf(buf, "%d\n", ld->props->get_contrast(ld)); | 63 | rc = sprintf(buf, "%d\n", ld->props->get_contrast(ld)); |
62 | else | ||
63 | rc = -ENXIO; | ||
64 | up(&ld->sem); | 64 | up(&ld->sem); |
65 | 65 | ||
66 | return rc; | 66 | return rc; |
@@ -68,12 +68,15 @@ static ssize_t lcd_show_contrast(struct class_device *cdev, char *buf) | |||
68 | 68 | ||
69 | static ssize_t lcd_store_contrast(struct class_device *cdev, const char *buf, size_t count) | 69 | static ssize_t lcd_store_contrast(struct class_device *cdev, const char *buf, size_t count) |
70 | { | 70 | { |
71 | int rc, contrast; | 71 | int rc = -ENXIO; |
72 | char *endp; | 72 | char *endp; |
73 | struct lcd_device *ld = to_lcd_device(cdev); | 73 | struct lcd_device *ld = to_lcd_device(cdev); |
74 | int contrast = simple_strtoul(buf, &endp, 0); | ||
75 | size_t size = endp - buf; | ||
74 | 76 | ||
75 | contrast = simple_strtoul(buf, &endp, 0); | 77 | if (*endp && isspace(*endp)) |
76 | if (*endp && !isspace(*endp)) | 78 | size++; |
79 | if (size != count) | ||
77 | return -EINVAL; | 80 | return -EINVAL; |
78 | 81 | ||
79 | down(&ld->sem); | 82 | down(&ld->sem); |
@@ -81,8 +84,7 @@ static ssize_t lcd_store_contrast(struct class_device *cdev, const char *buf, si | |||
81 | pr_debug("lcd: set contrast to %d\n", contrast); | 84 | pr_debug("lcd: set contrast to %d\n", contrast); |
82 | ld->props->set_contrast(ld, contrast); | 85 | ld->props->set_contrast(ld, contrast); |
83 | rc = count; | 86 | rc = count; |
84 | } else | 87 | } |
85 | rc = -ENXIO; | ||
86 | up(&ld->sem); | 88 | up(&ld->sem); |
87 | 89 | ||
88 | return rc; | 90 | return rc; |
@@ -90,14 +92,12 @@ static ssize_t lcd_store_contrast(struct class_device *cdev, const char *buf, si | |||
90 | 92 | ||
91 | static ssize_t lcd_show_max_contrast(struct class_device *cdev, char *buf) | 93 | static ssize_t lcd_show_max_contrast(struct class_device *cdev, char *buf) |
92 | { | 94 | { |
93 | int rc; | 95 | int rc = -ENXIO; |
94 | struct lcd_device *ld = to_lcd_device(cdev); | 96 | struct lcd_device *ld = to_lcd_device(cdev); |
95 | 97 | ||
96 | down(&ld->sem); | 98 | down(&ld->sem); |
97 | if (likely(ld->props)) | 99 | if (likely(ld->props)) |
98 | rc = sprintf(buf, "%d\n", ld->props->max_contrast); | 100 | rc = sprintf(buf, "%d\n", ld->props->max_contrast); |
99 | else | ||
100 | rc = -ENXIO; | ||
101 | up(&ld->sem); | 101 | up(&ld->sem); |
102 | 102 | ||
103 | return rc; | 103 | return rc; |