aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video
diff options
context:
space:
mode:
authorRichard Purdie <rpurdie@rpsys.net>2007-02-08 17:53:55 -0500
committerRichard Purdie <rpurdie@rpsys.net>2007-02-20 03:38:45 -0500
commit249040dc7fd391186f420fe23a9b59d357103cac (patch)
treefa62127c1a66e752ff5f32aa53c3d986022e0851 /drivers/video
parent28ee086d5b36aab2931f6740e409bb0fb6c65e5f (diff)
backlight: Convert semaphore -> mutex
Convert internal semaphore to a mutex Signed-off-by: Richard Purdie <rpurdie@rpsys.net>
Diffstat (limited to 'drivers/video')
-rw-r--r--drivers/video/backlight/backlight.c34
-rw-r--r--drivers/video/backlight/lcd.c30
2 files changed, 32 insertions, 32 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
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}