diff options
Diffstat (limited to 'drivers/video/backlight/backlight.c')
-rw-r--r-- | drivers/video/backlight/backlight.c | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/drivers/video/backlight/backlight.c b/drivers/video/backlight/backlight.c index 347081daf7a4..4f987c40b72d 100644 --- a/drivers/video/backlight/backlight.c +++ b/drivers/video/backlight/backlight.c | |||
@@ -32,14 +32,14 @@ static int fb_notifier_callback(struct notifier_block *self, | |||
32 | return 0; | 32 | return 0; |
33 | 33 | ||
34 | bd = container_of(self, struct backlight_device, fb_notif); | 34 | bd = container_of(self, struct backlight_device, fb_notif); |
35 | down(&bd->sem); | 35 | mutex_lock(&bd->props_lock); |
36 | if (bd->props) | 36 | if (bd->props) |
37 | if (!bd->props->check_fb || | 37 | if (!bd->props->check_fb || |
38 | bd->props->check_fb(evdata->info)) { | 38 | bd->props->check_fb(evdata->info)) { |
39 | bd->props->fb_blank = *(int *)evdata->data; | 39 | bd->props->fb_blank = *(int *)evdata->data; |
40 | backlight_update_status(bd); | 40 | backlight_update_status(bd); |
41 | } | 41 | } |
42 | up(&bd->sem); | 42 | mutex_unlock(&bd->props_lock); |
43 | return 0; | 43 | return 0; |
44 | } | 44 | } |
45 | 45 | ||
@@ -71,10 +71,10 @@ static ssize_t backlight_show_power(struct class_device *cdev, char *buf) | |||
71 | int rc = -ENXIO; | 71 | int rc = -ENXIO; |
72 | struct backlight_device *bd = to_backlight_device(cdev); | 72 | struct backlight_device *bd = to_backlight_device(cdev); |
73 | 73 | ||
74 | down(&bd->sem); | 74 | mutex_lock(&bd->props_lock); |
75 | if (bd->props) | 75 | if (bd->props) |
76 | rc = sprintf(buf, "%d\n", bd->props->power); | 76 | rc = sprintf(buf, "%d\n", bd->props->power); |
77 | up(&bd->sem); | 77 | mutex_unlock(&bd->props_lock); |
78 | 78 | ||
79 | return rc; | 79 | return rc; |
80 | } | 80 | } |
@@ -92,14 +92,14 @@ static ssize_t backlight_store_power(struct class_device *cdev, const char *buf, | |||
92 | if (size != count) | 92 | if (size != count) |
93 | return -EINVAL; | 93 | return -EINVAL; |
94 | 94 | ||
95 | down(&bd->sem); | 95 | mutex_lock(&bd->props_lock); |
96 | if (bd->props) { | 96 | if (bd->props) { |
97 | pr_debug("backlight: set power to %d\n", power); | 97 | pr_debug("backlight: set power to %d\n", power); |
98 | bd->props->power = power; | 98 | bd->props->power = power; |
99 | backlight_update_status(bd); | 99 | backlight_update_status(bd); |
100 | rc = count; | 100 | rc = count; |
101 | } | 101 | } |
102 | up(&bd->sem); | 102 | mutex_unlock(&bd->props_lock); |
103 | 103 | ||
104 | return rc; | 104 | return rc; |
105 | } | 105 | } |
@@ -109,10 +109,10 @@ static ssize_t backlight_show_brightness(struct class_device *cdev, char *buf) | |||
109 | int rc = -ENXIO; | 109 | int rc = -ENXIO; |
110 | struct backlight_device *bd = to_backlight_device(cdev); | 110 | struct backlight_device *bd = to_backlight_device(cdev); |
111 | 111 | ||
112 | down(&bd->sem); | 112 | mutex_lock(&bd->props_lock); |
113 | if (bd->props) | 113 | if (bd->props) |
114 | rc = sprintf(buf, "%d\n", bd->props->brightness); | 114 | rc = sprintf(buf, "%d\n", bd->props->brightness); |
115 | up(&bd->sem); | 115 | mutex_unlock(&bd->props_lock); |
116 | 116 | ||
117 | return rc; | 117 | return rc; |
118 | } | 118 | } |
@@ -130,7 +130,7 @@ static ssize_t backlight_store_brightness(struct class_device *cdev, const char | |||
130 | if (size != count) | 130 | if (size != count) |
131 | return -EINVAL; | 131 | return -EINVAL; |
132 | 132 | ||
133 | down(&bd->sem); | 133 | mutex_lock(&bd->props_lock); |
134 | if (bd->props) { | 134 | if (bd->props) { |
135 | if (brightness > bd->props->max_brightness) | 135 | if (brightness > bd->props->max_brightness) |
136 | rc = -EINVAL; | 136 | rc = -EINVAL; |
@@ -142,7 +142,7 @@ static ssize_t backlight_store_brightness(struct class_device *cdev, const char | |||
142 | rc = count; | 142 | rc = count; |
143 | } | 143 | } |
144 | } | 144 | } |
145 | up(&bd->sem); | 145 | mutex_unlock(&bd->props_lock); |
146 | 146 | ||
147 | return rc; | 147 | return rc; |
148 | } | 148 | } |
@@ -152,10 +152,10 @@ static ssize_t backlight_show_max_brightness(struct class_device *cdev, char *bu | |||
152 | int rc = -ENXIO; | 152 | int rc = -ENXIO; |
153 | struct backlight_device *bd = to_backlight_device(cdev); | 153 | struct backlight_device *bd = to_backlight_device(cdev); |
154 | 154 | ||
155 | down(&bd->sem); | 155 | mutex_lock(&bd->props_lock); |
156 | if (bd->props) | 156 | if (bd->props) |
157 | rc = sprintf(buf, "%d\n", bd->props->max_brightness); | 157 | rc = sprintf(buf, "%d\n", bd->props->max_brightness); |
158 | up(&bd->sem); | 158 | mutex_unlock(&bd->props_lock); |
159 | 159 | ||
160 | return rc; | 160 | return rc; |
161 | } | 161 | } |
@@ -166,10 +166,10 @@ static ssize_t backlight_show_actual_brightness(struct class_device *cdev, | |||
166 | int rc = -ENXIO; | 166 | int rc = -ENXIO; |
167 | struct backlight_device *bd = to_backlight_device(cdev); | 167 | struct backlight_device *bd = to_backlight_device(cdev); |
168 | 168 | ||
169 | down(&bd->sem); | 169 | mutex_lock(&bd->props_lock); |
170 | if (bd->props && bd->props->get_brightness) | 170 | if (bd->props && bd->props->get_brightness) |
171 | rc = sprintf(buf, "%d\n", bd->props->get_brightness(bd)); | 171 | rc = sprintf(buf, "%d\n", bd->props->get_brightness(bd)); |
172 | up(&bd->sem); | 172 | mutex_unlock(&bd->props_lock); |
173 | 173 | ||
174 | return rc; | 174 | return rc; |
175 | } | 175 | } |
@@ -228,7 +228,7 @@ struct backlight_device *backlight_device_register(const char *name, | |||
228 | return ERR_PTR(-ENOMEM); | 228 | return ERR_PTR(-ENOMEM); |
229 | 229 | ||
230 | mutex_init(&new_bd->update_lock); | 230 | mutex_init(&new_bd->update_lock); |
231 | init_MUTEX(&new_bd->sem); | 231 | mutex_init(&new_bd->props_lock); |
232 | new_bd->props = bp; | 232 | new_bd->props = bp; |
233 | memset(&new_bd->class_dev, 0, sizeof(new_bd->class_dev)); | 233 | memset(&new_bd->class_dev, 0, sizeof(new_bd->class_dev)); |
234 | new_bd->class_dev.class = &backlight_class; | 234 | new_bd->class_dev.class = &backlight_class; |
@@ -285,9 +285,9 @@ void backlight_device_unregister(struct backlight_device *bd) | |||
285 | class_device_remove_file(&bd->class_dev, | 285 | class_device_remove_file(&bd->class_dev, |
286 | &bl_class_device_attributes[i]); | 286 | &bl_class_device_attributes[i]); |
287 | 287 | ||
288 | down(&bd->sem); | 288 | mutex_lock(&bd->props_lock); |
289 | bd->props = NULL; | 289 | bd->props = NULL; |
290 | up(&bd->sem); | 290 | mutex_unlock(&bd->props_lock); |
291 | 291 | ||
292 | backlight_unregister_fb(bd); | 292 | backlight_unregister_fb(bd); |
293 | 293 | ||