diff options
Diffstat (limited to 'drivers/video/backlight/lcd.c')
-rw-r--r-- | drivers/video/backlight/lcd.c | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/drivers/video/backlight/lcd.c b/drivers/video/backlight/lcd.c index 1e1e61a4b5da..430ba018a896 100644 --- a/drivers/video/backlight/lcd.c +++ b/drivers/video/backlight/lcd.c | |||
@@ -31,11 +31,11 @@ static int fb_notifier_callback(struct notifier_block *self, | |||
31 | return 0; | 31 | return 0; |
32 | 32 | ||
33 | ld = container_of(self, struct lcd_device, fb_notif); | 33 | ld = container_of(self, struct lcd_device, fb_notif); |
34 | down(&ld->sem); | 34 | mutex_lock(&ld->props_lock); |
35 | if (ld->props) | 35 | if (ld->props) |
36 | if (!ld->props->check_fb || ld->props->check_fb(evdata->info)) | 36 | if (!ld->props->check_fb || ld->props->check_fb(evdata->info)) |
37 | ld->props->set_power(ld, *(int *)evdata->data); | 37 | ld->props->set_power(ld, *(int *)evdata->data); |
38 | up(&ld->sem); | 38 | mutex_unlock(&ld->props_lock); |
39 | return 0; | 39 | return 0; |
40 | } | 40 | } |
41 | 41 | ||
@@ -66,12 +66,12 @@ static ssize_t lcd_show_power(struct class_device *cdev, char *buf) | |||
66 | int rc; | 66 | int rc; |
67 | struct lcd_device *ld = to_lcd_device(cdev); | 67 | struct lcd_device *ld = to_lcd_device(cdev); |
68 | 68 | ||
69 | down(&ld->sem); | 69 | mutex_lock(&ld->props_lock); |
70 | if (ld->props && ld->props->get_power) | 70 | if (ld->props && ld->props->get_power) |
71 | rc = sprintf(buf, "%d\n", ld->props->get_power(ld)); | 71 | rc = sprintf(buf, "%d\n", ld->props->get_power(ld)); |
72 | else | 72 | else |
73 | rc = -ENXIO; | 73 | rc = -ENXIO; |
74 | up(&ld->sem); | 74 | mutex_unlock(&ld->props_lock); |
75 | 75 | ||
76 | return rc; | 76 | return rc; |
77 | } | 77 | } |
@@ -89,13 +89,13 @@ static ssize_t lcd_store_power(struct class_device *cdev, const char *buf, size_ | |||
89 | if (size != count) | 89 | if (size != count) |
90 | return -EINVAL; | 90 | return -EINVAL; |
91 | 91 | ||
92 | down(&ld->sem); | 92 | mutex_lock(&ld->props_lock); |
93 | if (ld->props && ld->props->set_power) { | 93 | if (ld->props && ld->props->set_power) { |
94 | pr_debug("lcd: set power to %d\n", power); | 94 | pr_debug("lcd: set power to %d\n", power); |
95 | ld->props->set_power(ld, power); | 95 | ld->props->set_power(ld, power); |
96 | rc = count; | 96 | rc = count; |
97 | } | 97 | } |
98 | up(&ld->sem); | 98 | mutex_unlock(&ld->props_lock); |
99 | 99 | ||
100 | return rc; | 100 | return rc; |
101 | } | 101 | } |
@@ -105,10 +105,10 @@ static ssize_t lcd_show_contrast(struct class_device *cdev, char *buf) | |||
105 | int rc = -ENXIO; | 105 | int rc = -ENXIO; |
106 | struct lcd_device *ld = to_lcd_device(cdev); | 106 | struct lcd_device *ld = to_lcd_device(cdev); |
107 | 107 | ||
108 | down(&ld->sem); | 108 | mutex_lock(&ld->props_lock); |
109 | if (ld->props && ld->props->get_contrast) | 109 | if (ld->props && ld->props->get_contrast) |
110 | rc = sprintf(buf, "%d\n", ld->props->get_contrast(ld)); | 110 | rc = sprintf(buf, "%d\n", ld->props->get_contrast(ld)); |
111 | up(&ld->sem); | 111 | mutex_unlock(&ld->props_lock); |
112 | 112 | ||
113 | return rc; | 113 | return rc; |
114 | } | 114 | } |
@@ -126,13 +126,13 @@ static ssize_t lcd_store_contrast(struct class_device *cdev, const char *buf, si | |||
126 | if (size != count) | 126 | if (size != count) |
127 | return -EINVAL; | 127 | return -EINVAL; |
128 | 128 | ||
129 | down(&ld->sem); | 129 | mutex_lock(&ld->props_lock); |
130 | if (ld->props && ld->props->set_contrast) { | 130 | if (ld->props && ld->props->set_contrast) { |
131 | pr_debug("lcd: set contrast to %d\n", contrast); | 131 | pr_debug("lcd: set contrast to %d\n", contrast); |
132 | ld->props->set_contrast(ld, contrast); | 132 | ld->props->set_contrast(ld, contrast); |
133 | rc = count; | 133 | rc = count; |
134 | } | 134 | } |
135 | up(&ld->sem); | 135 | mutex_unlock(&ld->props_lock); |
136 | 136 | ||
137 | return rc; | 137 | return rc; |
138 | } | 138 | } |
@@ -142,10 +142,10 @@ static ssize_t lcd_show_max_contrast(struct class_device *cdev, char *buf) | |||
142 | int rc = -ENXIO; | 142 | int rc = -ENXIO; |
143 | struct lcd_device *ld = to_lcd_device(cdev); | 143 | struct lcd_device *ld = to_lcd_device(cdev); |
144 | 144 | ||
145 | down(&ld->sem); | 145 | mutex_lock(&ld->props_lock); |
146 | if (ld->props) | 146 | if (ld->props) |
147 | rc = sprintf(buf, "%d\n", ld->props->max_contrast); | 147 | rc = sprintf(buf, "%d\n", ld->props->max_contrast); |
148 | up(&ld->sem); | 148 | mutex_unlock(&ld->props_lock); |
149 | 149 | ||
150 | return rc; | 150 | return rc; |
151 | } | 151 | } |
@@ -197,7 +197,7 @@ struct lcd_device *lcd_device_register(const char *name, void *devdata, | |||
197 | if (!new_ld) | 197 | if (!new_ld) |
198 | return ERR_PTR(-ENOMEM); | 198 | return ERR_PTR(-ENOMEM); |
199 | 199 | ||
200 | init_MUTEX(&new_ld->sem); | 200 | mutex_init(&new_ld->props_lock); |
201 | mutex_init(&new_ld->update_lock); | 201 | mutex_init(&new_ld->update_lock); |
202 | new_ld->props = lp; | 202 | new_ld->props = lp; |
203 | memset(&new_ld->class_dev, 0, sizeof(new_ld->class_dev)); | 203 | memset(&new_ld->class_dev, 0, sizeof(new_ld->class_dev)); |
@@ -253,9 +253,9 @@ void lcd_device_unregister(struct lcd_device *ld) | |||
253 | class_device_remove_file(&ld->class_dev, | 253 | class_device_remove_file(&ld->class_dev, |
254 | &lcd_class_device_attributes[i]); | 254 | &lcd_class_device_attributes[i]); |
255 | 255 | ||
256 | down(&ld->sem); | 256 | mutex_lock(&ld->props_lock); |
257 | ld->props = NULL; | 257 | ld->props = NULL; |
258 | up(&ld->sem); | 258 | mutex_unlock(&ld->props_lock); |
259 | lcd_unregister_fb(ld); | 259 | lcd_unregister_fb(ld); |
260 | class_device_unregister(&ld->class_dev); | 260 | class_device_unregister(&ld->class_dev); |
261 | } | 261 | } |