aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/lm83.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/lm83.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/lm83.c')
-rw-r--r--drivers/hwmon/lm83.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/drivers/hwmon/lm83.c b/drivers/hwmon/lm83.c
index 26dfa9e216c2..aac4ec2bf694 100644
--- a/drivers/hwmon/lm83.c
+++ b/drivers/hwmon/lm83.c
@@ -35,6 +35,7 @@
35#include <linux/hwmon-sysfs.h> 35#include <linux/hwmon-sysfs.h>
36#include <linux/hwmon.h> 36#include <linux/hwmon.h>
37#include <linux/err.h> 37#include <linux/err.h>
38#include <linux/mutex.h>
38 39
39/* 40/*
40 * Addresses to scan 41 * Addresses to scan
@@ -139,7 +140,7 @@ static struct i2c_driver lm83_driver = {
139struct lm83_data { 140struct lm83_data {
140 struct i2c_client client; 141 struct i2c_client client;
141 struct class_device *class_dev; 142 struct class_device *class_dev;
142 struct semaphore update_lock; 143 struct mutex update_lock;
143 char valid; /* zero until following fields are valid */ 144 char valid; /* zero until following fields are valid */
144 unsigned long last_updated; /* in jiffies */ 145 unsigned long last_updated; /* in jiffies */
145 146
@@ -171,11 +172,11 @@ static ssize_t set_temp(struct device *dev, struct device_attribute *devattr,
171 long val = simple_strtol(buf, NULL, 10); 172 long val = simple_strtol(buf, NULL, 10);
172 int nr = attr->index; 173 int nr = attr->index;
173 174
174 down(&data->update_lock); 175 mutex_lock(&data->update_lock);
175 data->temp[nr] = TEMP_TO_REG(val); 176 data->temp[nr] = TEMP_TO_REG(val);
176 i2c_smbus_write_byte_data(client, LM83_REG_W_HIGH[nr - 4], 177 i2c_smbus_write_byte_data(client, LM83_REG_W_HIGH[nr - 4],
177 data->temp[nr]); 178 data->temp[nr]);
178 up(&data->update_lock); 179 mutex_unlock(&data->update_lock);
179 return count; 180 return count;
180} 181}
181 182
@@ -300,7 +301,7 @@ static int lm83_detect(struct i2c_adapter *adapter, int address, int kind)
300 /* We can fill in the remaining client fields */ 301 /* We can fill in the remaining client fields */
301 strlcpy(new_client->name, name, I2C_NAME_SIZE); 302 strlcpy(new_client->name, name, I2C_NAME_SIZE);
302 data->valid = 0; 303 data->valid = 0;
303 init_MUTEX(&data->update_lock); 304 mutex_init(&data->update_lock);
304 305
305 /* Tell the I2C layer a new client has arrived */ 306 /* Tell the I2C layer a new client has arrived */
306 if ((err = i2c_attach_client(new_client))) 307 if ((err = i2c_attach_client(new_client)))
@@ -373,7 +374,7 @@ static struct lm83_data *lm83_update_device(struct device *dev)
373 struct i2c_client *client = to_i2c_client(dev); 374 struct i2c_client *client = to_i2c_client(dev);
374 struct lm83_data *data = i2c_get_clientdata(client); 375 struct lm83_data *data = i2c_get_clientdata(client);
375 376
376 down(&data->update_lock); 377 mutex_lock(&data->update_lock);
377 378
378 if (time_after(jiffies, data->last_updated + HZ * 2) || !data->valid) { 379 if (time_after(jiffies, data->last_updated + HZ * 2) || !data->valid) {
379 int nr; 380 int nr;
@@ -393,7 +394,7 @@ static struct lm83_data *lm83_update_device(struct device *dev)
393 data->valid = 1; 394 data->valid = 1;
394 } 395 }
395 396
396 up(&data->update_lock); 397 mutex_unlock(&data->update_lock);
397 398
398 return data; 399 return data;
399} 400}