diff options
author | Ingo Molnar <mingo@elte.hu> | 2006-01-18 17:19:26 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2006-03-23 17:21:52 -0500 |
commit | 9a61bf6300533d3b64d7ff29adfec00e596de67d (patch) | |
tree | cadce1ae78b51a1dc4c4414699cb590e8c8625e1 /drivers/hwmon/lm75.c | |
parent | 3fb9a65529615944138d527b70174840c95c637a (diff) |
[PATCH] hwmon: Semaphore to mutex conversions
convert drivers/hwmon/*.c semaphore use to mutexes.
the conversion was generated via scripts, and the result was validated
automatically via a script as well.
all affected hwmon drivers were build-tested.
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/hwmon/lm75.c')
-rw-r--r-- | drivers/hwmon/lm75.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/drivers/hwmon/lm75.c b/drivers/hwmon/lm75.c index 74ca2c8c61c3..fc25b90ec24a 100644 --- a/drivers/hwmon/lm75.c +++ b/drivers/hwmon/lm75.c | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <linux/i2c.h> | 25 | #include <linux/i2c.h> |
26 | #include <linux/hwmon.h> | 26 | #include <linux/hwmon.h> |
27 | #include <linux/err.h> | 27 | #include <linux/err.h> |
28 | #include <linux/mutex.h> | ||
28 | #include "lm75.h" | 29 | #include "lm75.h" |
29 | 30 | ||
30 | 31 | ||
@@ -47,7 +48,7 @@ I2C_CLIENT_INSMOD_1(lm75); | |||
47 | struct lm75_data { | 48 | struct lm75_data { |
48 | struct i2c_client client; | 49 | struct i2c_client client; |
49 | struct class_device *class_dev; | 50 | struct class_device *class_dev; |
50 | struct semaphore update_lock; | 51 | struct mutex update_lock; |
51 | char valid; /* !=0 if following fields are valid */ | 52 | char valid; /* !=0 if following fields are valid */ |
52 | unsigned long last_updated; /* In jiffies */ | 53 | unsigned long last_updated; /* In jiffies */ |
53 | u16 temp_input; /* Register values */ | 54 | u16 temp_input; /* Register values */ |
@@ -91,10 +92,10 @@ static ssize_t set_##value(struct device *dev, struct device_attribute *attr, co | |||
91 | struct lm75_data *data = i2c_get_clientdata(client); \ | 92 | struct lm75_data *data = i2c_get_clientdata(client); \ |
92 | int temp = simple_strtoul(buf, NULL, 10); \ | 93 | int temp = simple_strtoul(buf, NULL, 10); \ |
93 | \ | 94 | \ |
94 | down(&data->update_lock); \ | 95 | mutex_lock(&data->update_lock); \ |
95 | data->value = LM75_TEMP_TO_REG(temp); \ | 96 | data->value = LM75_TEMP_TO_REG(temp); \ |
96 | lm75_write_value(client, reg, data->value); \ | 97 | lm75_write_value(client, reg, data->value); \ |
97 | up(&data->update_lock); \ | 98 | mutex_unlock(&data->update_lock); \ |
98 | return count; \ | 99 | return count; \ |
99 | } | 100 | } |
100 | set(temp_max, LM75_REG_TEMP_OS); | 101 | set(temp_max, LM75_REG_TEMP_OS); |
@@ -188,7 +189,7 @@ static int lm75_detect(struct i2c_adapter *adapter, int address, int kind) | |||
188 | /* Fill in the remaining client fields and put it into the global list */ | 189 | /* Fill in the remaining client fields and put it into the global list */ |
189 | strlcpy(new_client->name, name, I2C_NAME_SIZE); | 190 | strlcpy(new_client->name, name, I2C_NAME_SIZE); |
190 | data->valid = 0; | 191 | data->valid = 0; |
191 | init_MUTEX(&data->update_lock); | 192 | mutex_init(&data->update_lock); |
192 | 193 | ||
193 | /* Tell the I2C layer a new client has arrived */ | 194 | /* Tell the I2C layer a new client has arrived */ |
194 | if ((err = i2c_attach_client(new_client))) | 195 | if ((err = i2c_attach_client(new_client))) |
@@ -264,7 +265,7 @@ static struct lm75_data *lm75_update_device(struct device *dev) | |||
264 | struct i2c_client *client = to_i2c_client(dev); | 265 | struct i2c_client *client = to_i2c_client(dev); |
265 | struct lm75_data *data = i2c_get_clientdata(client); | 266 | struct lm75_data *data = i2c_get_clientdata(client); |
266 | 267 | ||
267 | down(&data->update_lock); | 268 | mutex_lock(&data->update_lock); |
268 | 269 | ||
269 | if (time_after(jiffies, data->last_updated + HZ + HZ / 2) | 270 | if (time_after(jiffies, data->last_updated + HZ + HZ / 2) |
270 | || !data->valid) { | 271 | || !data->valid) { |
@@ -277,7 +278,7 @@ static struct lm75_data *lm75_update_device(struct device *dev) | |||
277 | data->valid = 1; | 278 | data->valid = 1; |
278 | } | 279 | } |
279 | 280 | ||
280 | up(&data->update_lock); | 281 | mutex_unlock(&data->update_lock); |
281 | 282 | ||
282 | return data; | 283 | return data; |
283 | } | 284 | } |