aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/adm1021.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2006-01-18 17:19:26 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2006-03-23 17:21:52 -0500
commit9a61bf6300533d3b64d7ff29adfec00e596de67d (patch)
treecadce1ae78b51a1dc4c4414699cb590e8c8625e1 /drivers/hwmon/adm1021.c
parent3fb9a65529615944138d527b70174840c95c637a (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/adm1021.c')
-rw-r--r--drivers/hwmon/adm1021.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/drivers/hwmon/adm1021.c b/drivers/hwmon/adm1021.c
index 665612729cb9..2b6e74dd4a82 100644
--- a/drivers/hwmon/adm1021.c
+++ b/drivers/hwmon/adm1021.c
@@ -26,6 +26,7 @@
26#include <linux/i2c.h> 26#include <linux/i2c.h>
27#include <linux/hwmon.h> 27#include <linux/hwmon.h>
28#include <linux/err.h> 28#include <linux/err.h>
29#include <linux/mutex.h>
29 30
30 31
31/* Addresses to scan */ 32/* Addresses to scan */
@@ -92,7 +93,7 @@ struct adm1021_data {
92 struct class_device *class_dev; 93 struct class_device *class_dev;
93 enum chips type; 94 enum chips type;
94 95
95 struct semaphore update_lock; 96 struct mutex update_lock;
96 char valid; /* !=0 if following fields are valid */ 97 char valid; /* !=0 if following fields are valid */
97 unsigned long last_updated; /* In jiffies */ 98 unsigned long last_updated; /* In jiffies */
98 99
@@ -162,10 +163,10 @@ static ssize_t set_##value(struct device *dev, struct device_attribute *attr, co
162 struct adm1021_data *data = i2c_get_clientdata(client); \ 163 struct adm1021_data *data = i2c_get_clientdata(client); \
163 int temp = simple_strtoul(buf, NULL, 10); \ 164 int temp = simple_strtoul(buf, NULL, 10); \
164 \ 165 \
165 down(&data->update_lock); \ 166 mutex_lock(&data->update_lock); \
166 data->value = TEMP_TO_REG(temp); \ 167 data->value = TEMP_TO_REG(temp); \
167 adm1021_write_value(client, reg, data->value); \ 168 adm1021_write_value(client, reg, data->value); \
168 up(&data->update_lock); \ 169 mutex_unlock(&data->update_lock); \
169 return count; \ 170 return count; \
170} 171}
171set(temp_max, ADM1021_REG_TOS_W); 172set(temp_max, ADM1021_REG_TOS_W);
@@ -275,7 +276,7 @@ static int adm1021_detect(struct i2c_adapter *adapter, int address, int kind)
275 strlcpy(new_client->name, type_name, I2C_NAME_SIZE); 276 strlcpy(new_client->name, type_name, I2C_NAME_SIZE);
276 data->type = kind; 277 data->type = kind;
277 data->valid = 0; 278 data->valid = 0;
278 init_MUTEX(&data->update_lock); 279 mutex_init(&data->update_lock);
279 280
280 /* Tell the I2C layer a new client has arrived */ 281 /* Tell the I2C layer a new client has arrived */
281 if ((err = i2c_attach_client(new_client))) 282 if ((err = i2c_attach_client(new_client)))
@@ -351,7 +352,7 @@ static struct adm1021_data *adm1021_update_device(struct device *dev)
351 struct i2c_client *client = to_i2c_client(dev); 352 struct i2c_client *client = to_i2c_client(dev);
352 struct adm1021_data *data = i2c_get_clientdata(client); 353 struct adm1021_data *data = i2c_get_clientdata(client);
353 354
354 down(&data->update_lock); 355 mutex_lock(&data->update_lock);
355 356
356 if (time_after(jiffies, data->last_updated + HZ + HZ / 2) 357 if (time_after(jiffies, data->last_updated + HZ + HZ / 2)
357 || !data->valid) { 358 || !data->valid) {
@@ -375,7 +376,7 @@ static struct adm1021_data *adm1021_update_device(struct device *dev)
375 data->valid = 1; 376 data->valid = 1;
376 } 377 }
377 378
378 up(&data->update_lock); 379 mutex_unlock(&data->update_lock);
379 380
380 return data; 381 return data;
381} 382}