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/gl518sm.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/gl518sm.c')
-rw-r--r-- | drivers/hwmon/gl518sm.c | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/drivers/hwmon/gl518sm.c b/drivers/hwmon/gl518sm.c index 9e685e3a3bc9..6606aabdb49d 100644 --- a/drivers/hwmon/gl518sm.c +++ b/drivers/hwmon/gl518sm.c | |||
@@ -43,6 +43,7 @@ | |||
43 | #include <linux/i2c.h> | 43 | #include <linux/i2c.h> |
44 | #include <linux/hwmon.h> | 44 | #include <linux/hwmon.h> |
45 | #include <linux/err.h> | 45 | #include <linux/err.h> |
46 | #include <linux/mutex.h> | ||
46 | 47 | ||
47 | /* Addresses to scan */ | 48 | /* Addresses to scan */ |
48 | static unsigned short normal_i2c[] = { 0x2c, 0x2d, I2C_CLIENT_END }; | 49 | static unsigned short normal_i2c[] = { 0x2c, 0x2d, I2C_CLIENT_END }; |
@@ -120,7 +121,7 @@ struct gl518_data { | |||
120 | struct class_device *class_dev; | 121 | struct class_device *class_dev; |
121 | enum chips type; | 122 | enum chips type; |
122 | 123 | ||
123 | struct semaphore update_lock; | 124 | struct mutex update_lock; |
124 | char valid; /* !=0 if following fields are valid */ | 125 | char valid; /* !=0 if following fields are valid */ |
125 | unsigned long last_updated; /* In jiffies */ | 126 | unsigned long last_updated; /* In jiffies */ |
126 | 127 | ||
@@ -212,10 +213,10 @@ static ssize_t set_##suffix(struct device *dev, struct device_attribute *attr, c | |||
212 | struct gl518_data *data = i2c_get_clientdata(client); \ | 213 | struct gl518_data *data = i2c_get_clientdata(client); \ |
213 | long val = simple_strtol(buf, NULL, 10); \ | 214 | long val = simple_strtol(buf, NULL, 10); \ |
214 | \ | 215 | \ |
215 | down(&data->update_lock); \ | 216 | mutex_lock(&data->update_lock); \ |
216 | data->value = type##_TO_REG(val); \ | 217 | data->value = type##_TO_REG(val); \ |
217 | gl518_write_value(client, reg, data->value); \ | 218 | gl518_write_value(client, reg, data->value); \ |
218 | up(&data->update_lock); \ | 219 | mutex_unlock(&data->update_lock); \ |
219 | return count; \ | 220 | return count; \ |
220 | } | 221 | } |
221 | 222 | ||
@@ -228,12 +229,12 @@ static ssize_t set_##suffix(struct device *dev, struct device_attribute *attr, c | |||
228 | int regvalue; \ | 229 | int regvalue; \ |
229 | unsigned long val = simple_strtoul(buf, NULL, 10); \ | 230 | unsigned long val = simple_strtoul(buf, NULL, 10); \ |
230 | \ | 231 | \ |
231 | down(&data->update_lock); \ | 232 | mutex_lock(&data->update_lock); \ |
232 | regvalue = gl518_read_value(client, reg); \ | 233 | regvalue = gl518_read_value(client, reg); \ |
233 | data->value = type##_TO_REG(val); \ | 234 | data->value = type##_TO_REG(val); \ |
234 | regvalue = (regvalue & ~mask) | (data->value << shift); \ | 235 | regvalue = (regvalue & ~mask) | (data->value << shift); \ |
235 | gl518_write_value(client, reg, regvalue); \ | 236 | gl518_write_value(client, reg, regvalue); \ |
236 | up(&data->update_lock); \ | 237 | mutex_unlock(&data->update_lock); \ |
237 | return count; \ | 238 | return count; \ |
238 | } | 239 | } |
239 | 240 | ||
@@ -265,7 +266,7 @@ static ssize_t set_fan_min1(struct device *dev, struct device_attribute *attr, c | |||
265 | int regvalue; | 266 | int regvalue; |
266 | unsigned long val = simple_strtoul(buf, NULL, 10); | 267 | unsigned long val = simple_strtoul(buf, NULL, 10); |
267 | 268 | ||
268 | down(&data->update_lock); | 269 | mutex_lock(&data->update_lock); |
269 | regvalue = gl518_read_value(client, GL518_REG_FAN_LIMIT); | 270 | regvalue = gl518_read_value(client, GL518_REG_FAN_LIMIT); |
270 | data->fan_min[0] = FAN_TO_REG(val, | 271 | data->fan_min[0] = FAN_TO_REG(val, |
271 | DIV_FROM_REG(data->fan_div[0])); | 272 | DIV_FROM_REG(data->fan_div[0])); |
@@ -280,7 +281,7 @@ static ssize_t set_fan_min1(struct device *dev, struct device_attribute *attr, c | |||
280 | data->beep_mask &= data->alarm_mask; | 281 | data->beep_mask &= data->alarm_mask; |
281 | gl518_write_value(client, GL518_REG_ALARM, data->beep_mask); | 282 | gl518_write_value(client, GL518_REG_ALARM, data->beep_mask); |
282 | 283 | ||
283 | up(&data->update_lock); | 284 | mutex_unlock(&data->update_lock); |
284 | return count; | 285 | return count; |
285 | } | 286 | } |
286 | 287 | ||
@@ -291,7 +292,7 @@ static ssize_t set_fan_min2(struct device *dev, struct device_attribute *attr, c | |||
291 | int regvalue; | 292 | int regvalue; |
292 | unsigned long val = simple_strtoul(buf, NULL, 10); | 293 | unsigned long val = simple_strtoul(buf, NULL, 10); |
293 | 294 | ||
294 | down(&data->update_lock); | 295 | mutex_lock(&data->update_lock); |
295 | regvalue = gl518_read_value(client, GL518_REG_FAN_LIMIT); | 296 | regvalue = gl518_read_value(client, GL518_REG_FAN_LIMIT); |
296 | data->fan_min[1] = FAN_TO_REG(val, | 297 | data->fan_min[1] = FAN_TO_REG(val, |
297 | DIV_FROM_REG(data->fan_div[1])); | 298 | DIV_FROM_REG(data->fan_div[1])); |
@@ -306,7 +307,7 @@ static ssize_t set_fan_min2(struct device *dev, struct device_attribute *attr, c | |||
306 | data->beep_mask &= data->alarm_mask; | 307 | data->beep_mask &= data->alarm_mask; |
307 | gl518_write_value(client, GL518_REG_ALARM, data->beep_mask); | 308 | gl518_write_value(client, GL518_REG_ALARM, data->beep_mask); |
308 | 309 | ||
309 | up(&data->update_lock); | 310 | mutex_unlock(&data->update_lock); |
310 | return count; | 311 | return count; |
311 | } | 312 | } |
312 | 313 | ||
@@ -407,7 +408,7 @@ static int gl518_detect(struct i2c_adapter *adapter, int address, int kind) | |||
407 | strlcpy(new_client->name, "gl518sm", I2C_NAME_SIZE); | 408 | strlcpy(new_client->name, "gl518sm", I2C_NAME_SIZE); |
408 | data->type = kind; | 409 | data->type = kind; |
409 | data->valid = 0; | 410 | data->valid = 0; |
410 | init_MUTEX(&data->update_lock); | 411 | mutex_init(&data->update_lock); |
411 | 412 | ||
412 | /* Tell the I2C layer a new client has arrived */ | 413 | /* Tell the I2C layer a new client has arrived */ |
413 | if ((err = i2c_attach_client(new_client))) | 414 | if ((err = i2c_attach_client(new_client))) |
@@ -525,7 +526,7 @@ static struct gl518_data *gl518_update_device(struct device *dev) | |||
525 | struct gl518_data *data = i2c_get_clientdata(client); | 526 | struct gl518_data *data = i2c_get_clientdata(client); |
526 | int val; | 527 | int val; |
527 | 528 | ||
528 | down(&data->update_lock); | 529 | mutex_lock(&data->update_lock); |
529 | 530 | ||
530 | if (time_after(jiffies, data->last_updated + HZ + HZ / 2) | 531 | if (time_after(jiffies, data->last_updated + HZ + HZ / 2) |
531 | || !data->valid) { | 532 | || !data->valid) { |
@@ -586,7 +587,7 @@ static struct gl518_data *gl518_update_device(struct device *dev) | |||
586 | data->valid = 1; | 587 | data->valid = 1; |
587 | } | 588 | } |
588 | 589 | ||
589 | up(&data->update_lock); | 590 | mutex_unlock(&data->update_lock); |
590 | 591 | ||
591 | return data; | 592 | return data; |
592 | } | 593 | } |