[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>
This commit is contained in:
Ingo Molnar 2006-01-14 16:18:45 +01:00 committed by Paul Mackerras
parent 0f36b018b2
commit 837e9594fc

View File

@ -33,6 +33,7 @@
#include <linux/reboot.h>
#include <linux/device.h>
#include <linux/platform_device.h>
#include <linux/mutex.h>
#include "windfarm.h"
@ -48,7 +49,7 @@
static LIST_HEAD(wf_controls);
static LIST_HEAD(wf_sensors);
static DECLARE_MUTEX(wf_lock);
static DEFINE_MUTEX(wf_lock);
static struct notifier_block *wf_client_list;
static int wf_client_count;
static unsigned int wf_overtemp;
@ -160,12 +161,12 @@ int wf_register_control(struct wf_control *new_ct)
{
struct wf_control *ct;
down(&wf_lock);
mutex_lock(&wf_lock);
list_for_each_entry(ct, &wf_controls, link) {
if (!strcmp(ct->name, new_ct->name)) {
printk(KERN_WARNING "windfarm: trying to register"
" duplicate control %s\n", ct->name);
up(&wf_lock);
mutex_unlock(&wf_lock);
return -EEXIST;
}
}
@ -175,7 +176,7 @@ int wf_register_control(struct wf_control *new_ct)
DBG("wf: Registered control %s\n", new_ct->name);
wf_notify(WF_EVENT_NEW_CONTROL, new_ct);
up(&wf_lock);
mutex_unlock(&wf_lock);
return 0;
}
@ -183,9 +184,9 @@ EXPORT_SYMBOL_GPL(wf_register_control);
void wf_unregister_control(struct wf_control *ct)
{
down(&wf_lock);
mutex_lock(&wf_lock);
list_del(&ct->link);
up(&wf_lock);
mutex_unlock(&wf_lock);
DBG("wf: Unregistered control %s\n", ct->name);
@ -197,16 +198,16 @@ struct wf_control * wf_find_control(const char *name)
{
struct wf_control *ct;
down(&wf_lock);
mutex_lock(&wf_lock);
list_for_each_entry(ct, &wf_controls, link) {
if (!strcmp(ct->name, name)) {
if (wf_get_control(ct))
ct = NULL;
up(&wf_lock);
mutex_unlock(&wf_lock);
return ct;
}
}
up(&wf_lock);
mutex_unlock(&wf_lock);
return NULL;
}
EXPORT_SYMBOL_GPL(wf_find_control);
@ -250,12 +251,12 @@ int wf_register_sensor(struct wf_sensor *new_sr)
{
struct wf_sensor *sr;
down(&wf_lock);
mutex_lock(&wf_lock);
list_for_each_entry(sr, &wf_sensors, link) {
if (!strcmp(sr->name, new_sr->name)) {
printk(KERN_WARNING "windfarm: trying to register"
" duplicate sensor %s\n", sr->name);
up(&wf_lock);
mutex_unlock(&wf_lock);
return -EEXIST;
}
}
@ -265,7 +266,7 @@ int wf_register_sensor(struct wf_sensor *new_sr)
DBG("wf: Registered sensor %s\n", new_sr->name);
wf_notify(WF_EVENT_NEW_SENSOR, new_sr);
up(&wf_lock);
mutex_unlock(&wf_lock);
return 0;
}
@ -273,9 +274,9 @@ EXPORT_SYMBOL_GPL(wf_register_sensor);
void wf_unregister_sensor(struct wf_sensor *sr)
{
down(&wf_lock);
mutex_lock(&wf_lock);
list_del(&sr->link);
up(&wf_lock);
mutex_unlock(&wf_lock);
DBG("wf: Unregistered sensor %s\n", sr->name);
@ -287,16 +288,16 @@ struct wf_sensor * wf_find_sensor(const char *name)
{
struct wf_sensor *sr;
down(&wf_lock);
mutex_lock(&wf_lock);
list_for_each_entry(sr, &wf_sensors, link) {
if (!strcmp(sr->name, name)) {
if (wf_get_sensor(sr))
sr = NULL;
up(&wf_lock);
mutex_unlock(&wf_lock);
return sr;
}
}
up(&wf_lock);
mutex_unlock(&wf_lock);
return NULL;
}
EXPORT_SYMBOL_GPL(wf_find_sensor);
@ -329,7 +330,7 @@ int wf_register_client(struct notifier_block *nb)
struct wf_control *ct;
struct wf_sensor *sr;
down(&wf_lock);
mutex_lock(&wf_lock);
rc = notifier_chain_register(&wf_client_list, nb);
if (rc != 0)
goto bail;
@ -341,19 +342,19 @@ int wf_register_client(struct notifier_block *nb)
if (wf_client_count == 1)
wf_start_thread();
bail:
up(&wf_lock);
mutex_unlock(&wf_lock);
return rc;
}
EXPORT_SYMBOL_GPL(wf_register_client);
int wf_unregister_client(struct notifier_block *nb)
{
down(&wf_lock);
mutex_lock(&wf_lock);
notifier_chain_unregister(&wf_client_list, nb);
wf_client_count++;
if (wf_client_count == 0)
wf_stop_thread();
up(&wf_lock);
mutex_unlock(&wf_lock);
return 0;
}
@ -361,23 +362,23 @@ EXPORT_SYMBOL_GPL(wf_unregister_client);
void wf_set_overtemp(void)
{
down(&wf_lock);
mutex_lock(&wf_lock);
wf_overtemp++;
if (wf_overtemp == 1) {
printk(KERN_WARNING "windfarm: Overtemp condition detected !\n");
wf_overtemp_counter = 0;
wf_notify(WF_EVENT_OVERTEMP, NULL);
}
up(&wf_lock);
mutex_unlock(&wf_lock);
}
EXPORT_SYMBOL_GPL(wf_set_overtemp);
void wf_clear_overtemp(void)
{
down(&wf_lock);
mutex_lock(&wf_lock);
WARN_ON(wf_overtemp == 0);
if (wf_overtemp == 0) {
up(&wf_lock);
mutex_unlock(&wf_lock);
return;
}
wf_overtemp--;
@ -385,7 +386,7 @@ void wf_clear_overtemp(void)
printk(KERN_WARNING "windfarm: Overtemp condition cleared !\n");
wf_notify(WF_EVENT_NORMALTEMP, NULL);
}
up(&wf_lock);
mutex_unlock(&wf_lock);
}
EXPORT_SYMBOL_GPL(wf_clear_overtemp);