aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2006-01-14 10:18:45 -0500
committerPaul Mackerras <paulus@samba.org>2006-01-20 00:01:15 -0500
commit837e9594fc3cb9a06bddd7ecf66151334a2e13d2 (patch)
tree25361ce95b3fd1c0cf79e1b656c12feea7b6f744 /drivers
parent0f36b018b2e314d45af86449f1a97facb1fbe300 (diff)
[PATCH] sem2mutex: drivers/macintosh/windfarm_core.c
semaphore to mutex conversion. the conversion was generated via scripts, and the result was validated automatically via a script as well. build and boot tested. Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/macintosh/windfarm_core.c53
1 files changed, 27 insertions, 26 deletions
diff --git a/drivers/macintosh/windfarm_core.c b/drivers/macintosh/windfarm_core.c
index 6c2a471ea6c0..32d466441ac2 100644
--- a/drivers/macintosh/windfarm_core.c
+++ b/drivers/macintosh/windfarm_core.c
@@ -33,6 +33,7 @@
33#include <linux/reboot.h> 33#include <linux/reboot.h>
34#include <linux/device.h> 34#include <linux/device.h>
35#include <linux/platform_device.h> 35#include <linux/platform_device.h>
36#include <linux/mutex.h>
36 37
37#include "windfarm.h" 38#include "windfarm.h"
38 39
@@ -48,7 +49,7 @@
48 49
49static LIST_HEAD(wf_controls); 50static LIST_HEAD(wf_controls);
50static LIST_HEAD(wf_sensors); 51static LIST_HEAD(wf_sensors);
51static DECLARE_MUTEX(wf_lock); 52static DEFINE_MUTEX(wf_lock);
52static struct notifier_block *wf_client_list; 53static struct notifier_block *wf_client_list;
53static int wf_client_count; 54static int wf_client_count;
54static unsigned int wf_overtemp; 55static unsigned int wf_overtemp;
@@ -160,12 +161,12 @@ int wf_register_control(struct wf_control *new_ct)
160{ 161{
161 struct wf_control *ct; 162 struct wf_control *ct;
162 163
163 down(&wf_lock); 164 mutex_lock(&wf_lock);
164 list_for_each_entry(ct, &wf_controls, link) { 165 list_for_each_entry(ct, &wf_controls, link) {
165 if (!strcmp(ct->name, new_ct->name)) { 166 if (!strcmp(ct->name, new_ct->name)) {
166 printk(KERN_WARNING "windfarm: trying to register" 167 printk(KERN_WARNING "windfarm: trying to register"
167 " duplicate control %s\n", ct->name); 168 " duplicate control %s\n", ct->name);
168 up(&wf_lock); 169 mutex_unlock(&wf_lock);
169 return -EEXIST; 170 return -EEXIST;
170 } 171 }
171 } 172 }
@@ -175,7 +176,7 @@ int wf_register_control(struct wf_control *new_ct)
175 DBG("wf: Registered control %s\n", new_ct->name); 176 DBG("wf: Registered control %s\n", new_ct->name);
176 177
177 wf_notify(WF_EVENT_NEW_CONTROL, new_ct); 178 wf_notify(WF_EVENT_NEW_CONTROL, new_ct);
178 up(&wf_lock); 179 mutex_unlock(&wf_lock);
179 180
180 return 0; 181 return 0;
181} 182}
@@ -183,9 +184,9 @@ EXPORT_SYMBOL_GPL(wf_register_control);
183 184
184void wf_unregister_control(struct wf_control *ct) 185void wf_unregister_control(struct wf_control *ct)
185{ 186{
186 down(&wf_lock); 187 mutex_lock(&wf_lock);
187 list_del(&ct->link); 188 list_del(&ct->link);
188 up(&wf_lock); 189 mutex_unlock(&wf_lock);
189 190
190 DBG("wf: Unregistered control %s\n", ct->name); 191 DBG("wf: Unregistered control %s\n", ct->name);
191 192
@@ -197,16 +198,16 @@ struct wf_control * wf_find_control(const char *name)
197{ 198{
198 struct wf_control *ct; 199 struct wf_control *ct;
199 200
200 down(&wf_lock); 201 mutex_lock(&wf_lock);
201 list_for_each_entry(ct, &wf_controls, link) { 202 list_for_each_entry(ct, &wf_controls, link) {
202 if (!strcmp(ct->name, name)) { 203 if (!strcmp(ct->name, name)) {
203 if (wf_get_control(ct)) 204 if (wf_get_control(ct))
204 ct = NULL; 205 ct = NULL;
205 up(&wf_lock); 206 mutex_unlock(&wf_lock);
206 return ct; 207 return ct;
207 } 208 }
208 } 209 }
209 up(&wf_lock); 210 mutex_unlock(&wf_lock);
210 return NULL; 211 return NULL;
211} 212}
212EXPORT_SYMBOL_GPL(wf_find_control); 213EXPORT_SYMBOL_GPL(wf_find_control);
@@ -250,12 +251,12 @@ int wf_register_sensor(struct wf_sensor *new_sr)
250{ 251{
251 struct wf_sensor *sr; 252 struct wf_sensor *sr;
252 253
253 down(&wf_lock); 254 mutex_lock(&wf_lock);
254 list_for_each_entry(sr, &wf_sensors, link) { 255 list_for_each_entry(sr, &wf_sensors, link) {
255 if (!strcmp(sr->name, new_sr->name)) { 256 if (!strcmp(sr->name, new_sr->name)) {
256 printk(KERN_WARNING "windfarm: trying to register" 257 printk(KERN_WARNING "windfarm: trying to register"
257 " duplicate sensor %s\n", sr->name); 258 " duplicate sensor %s\n", sr->name);
258 up(&wf_lock); 259 mutex_unlock(&wf_lock);
259 return -EEXIST; 260 return -EEXIST;
260 } 261 }
261 } 262 }
@@ -265,7 +266,7 @@ int wf_register_sensor(struct wf_sensor *new_sr)
265 DBG("wf: Registered sensor %s\n", new_sr->name); 266 DBG("wf: Registered sensor %s\n", new_sr->name);
266 267
267 wf_notify(WF_EVENT_NEW_SENSOR, new_sr); 268 wf_notify(WF_EVENT_NEW_SENSOR, new_sr);
268 up(&wf_lock); 269 mutex_unlock(&wf_lock);
269 270
270 return 0; 271 return 0;
271} 272}
@@ -273,9 +274,9 @@ EXPORT_SYMBOL_GPL(wf_register_sensor);
273 274
274void wf_unregister_sensor(struct wf_sensor *sr) 275void wf_unregister_sensor(struct wf_sensor *sr)
275{ 276{
276 down(&wf_lock); 277 mutex_lock(&wf_lock);
277 list_del(&sr->link); 278 list_del(&sr->link);
278 up(&wf_lock); 279 mutex_unlock(&wf_lock);
279 280
280 DBG("wf: Unregistered sensor %s\n", sr->name); 281 DBG("wf: Unregistered sensor %s\n", sr->name);
281 282
@@ -287,16 +288,16 @@ struct wf_sensor * wf_find_sensor(const char *name)
287{ 288{
288 struct wf_sensor *sr; 289 struct wf_sensor *sr;
289 290
290 down(&wf_lock); 291 mutex_lock(&wf_lock);
291 list_for_each_entry(sr, &wf_sensors, link) { 292 list_for_each_entry(sr, &wf_sensors, link) {
292 if (!strcmp(sr->name, name)) { 293 if (!strcmp(sr->name, name)) {
293 if (wf_get_sensor(sr)) 294 if (wf_get_sensor(sr))
294 sr = NULL; 295 sr = NULL;
295 up(&wf_lock); 296 mutex_unlock(&wf_lock);
296 return sr; 297 return sr;
297 } 298 }
298 } 299 }
299 up(&wf_lock); 300 mutex_unlock(&wf_lock);
300 return NULL; 301 return NULL;
301} 302}
302EXPORT_SYMBOL_GPL(wf_find_sensor); 303EXPORT_SYMBOL_GPL(wf_find_sensor);
@@ -329,7 +330,7 @@ int wf_register_client(struct notifier_block *nb)
329 struct wf_control *ct; 330 struct wf_control *ct;
330 struct wf_sensor *sr; 331 struct wf_sensor *sr;
331 332
332 down(&wf_lock); 333 mutex_lock(&wf_lock);
333 rc = notifier_chain_register(&wf_client_list, nb); 334 rc = notifier_chain_register(&wf_client_list, nb);
334 if (rc != 0) 335 if (rc != 0)
335 goto bail; 336 goto bail;
@@ -341,19 +342,19 @@ int wf_register_client(struct notifier_block *nb)
341 if (wf_client_count == 1) 342 if (wf_client_count == 1)
342 wf_start_thread(); 343 wf_start_thread();
343 bail: 344 bail:
344 up(&wf_lock); 345 mutex_unlock(&wf_lock);
345 return rc; 346 return rc;
346} 347}
347EXPORT_SYMBOL_GPL(wf_register_client); 348EXPORT_SYMBOL_GPL(wf_register_client);
348 349
349int wf_unregister_client(struct notifier_block *nb) 350int wf_unregister_client(struct notifier_block *nb)
350{ 351{
351 down(&wf_lock); 352 mutex_lock(&wf_lock);
352 notifier_chain_unregister(&wf_client_list, nb); 353 notifier_chain_unregister(&wf_client_list, nb);
353 wf_client_count++; 354 wf_client_count++;
354 if (wf_client_count == 0) 355 if (wf_client_count == 0)
355 wf_stop_thread(); 356 wf_stop_thread();
356 up(&wf_lock); 357 mutex_unlock(&wf_lock);
357 358
358 return 0; 359 return 0;
359} 360}
@@ -361,23 +362,23 @@ EXPORT_SYMBOL_GPL(wf_unregister_client);
361 362
362void wf_set_overtemp(void) 363void wf_set_overtemp(void)
363{ 364{
364 down(&wf_lock); 365 mutex_lock(&wf_lock);
365 wf_overtemp++; 366 wf_overtemp++;
366 if (wf_overtemp == 1) { 367 if (wf_overtemp == 1) {
367 printk(KERN_WARNING "windfarm: Overtemp condition detected !\n"); 368 printk(KERN_WARNING "windfarm: Overtemp condition detected !\n");
368 wf_overtemp_counter = 0; 369 wf_overtemp_counter = 0;
369 wf_notify(WF_EVENT_OVERTEMP, NULL); 370 wf_notify(WF_EVENT_OVERTEMP, NULL);
370 } 371 }
371 up(&wf_lock); 372 mutex_unlock(&wf_lock);
372} 373}
373EXPORT_SYMBOL_GPL(wf_set_overtemp); 374EXPORT_SYMBOL_GPL(wf_set_overtemp);
374 375
375void wf_clear_overtemp(void) 376void wf_clear_overtemp(void)
376{ 377{
377 down(&wf_lock); 378 mutex_lock(&wf_lock);
378 WARN_ON(wf_overtemp == 0); 379 WARN_ON(wf_overtemp == 0);
379 if (wf_overtemp == 0) { 380 if (wf_overtemp == 0) {
380 up(&wf_lock); 381 mutex_unlock(&wf_lock);
381 return; 382 return;
382 } 383 }
383 wf_overtemp--; 384 wf_overtemp--;
@@ -385,7 +386,7 @@ void wf_clear_overtemp(void)
385 printk(KERN_WARNING "windfarm: Overtemp condition cleared !\n"); 386 printk(KERN_WARNING "windfarm: Overtemp condition cleared !\n");
386 wf_notify(WF_EVENT_NORMALTEMP, NULL); 387 wf_notify(WF_EVENT_NORMALTEMP, NULL);
387 } 388 }
388 up(&wf_lock); 389 mutex_unlock(&wf_lock);
389} 390}
390EXPORT_SYMBOL_GPL(wf_clear_overtemp); 391EXPORT_SYMBOL_GPL(wf_clear_overtemp);
391 392