aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/w83627ehf.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/w83627ehf.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/w83627ehf.c')
-rw-r--r--drivers/hwmon/w83627ehf.c33
1 files changed, 17 insertions, 16 deletions
diff --git a/drivers/hwmon/w83627ehf.c b/drivers/hwmon/w83627ehf.c
index 12d79f5e4900..1affaf15beda 100644
--- a/drivers/hwmon/w83627ehf.c
+++ b/drivers/hwmon/w83627ehf.c
@@ -43,6 +43,7 @@
43#include <linux/i2c-isa.h> 43#include <linux/i2c-isa.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#include <asm/io.h> 47#include <asm/io.h>
47#include "lm75.h" 48#include "lm75.h"
48 49
@@ -177,9 +178,9 @@ temp1_to_reg(int temp)
177struct w83627ehf_data { 178struct w83627ehf_data {
178 struct i2c_client client; 179 struct i2c_client client;
179 struct class_device *class_dev; 180 struct class_device *class_dev;
180 struct semaphore lock; 181 struct mutex lock;
181 182
182 struct semaphore update_lock; 183 struct mutex update_lock;
183 char valid; /* !=0 if following fields are valid */ 184 char valid; /* !=0 if following fields are valid */
184 unsigned long last_updated; /* In jiffies */ 185 unsigned long last_updated; /* In jiffies */
185 186
@@ -230,7 +231,7 @@ static u16 w83627ehf_read_value(struct i2c_client *client, u16 reg)
230 struct w83627ehf_data *data = i2c_get_clientdata(client); 231 struct w83627ehf_data *data = i2c_get_clientdata(client);
231 int res, word_sized = is_word_sized(reg); 232 int res, word_sized = is_word_sized(reg);
232 233
233 down(&data->lock); 234 mutex_lock(&data->lock);
234 235
235 w83627ehf_set_bank(client, reg); 236 w83627ehf_set_bank(client, reg);
236 outb_p(reg & 0xff, client->addr + ADDR_REG_OFFSET); 237 outb_p(reg & 0xff, client->addr + ADDR_REG_OFFSET);
@@ -242,7 +243,7 @@ static u16 w83627ehf_read_value(struct i2c_client *client, u16 reg)
242 } 243 }
243 w83627ehf_reset_bank(client, reg); 244 w83627ehf_reset_bank(client, reg);
244 245
245 up(&data->lock); 246 mutex_unlock(&data->lock);
246 247
247 return res; 248 return res;
248} 249}
@@ -252,7 +253,7 @@ static int w83627ehf_write_value(struct i2c_client *client, u16 reg, u16 value)
252 struct w83627ehf_data *data = i2c_get_clientdata(client); 253 struct w83627ehf_data *data = i2c_get_clientdata(client);
253 int word_sized = is_word_sized(reg); 254 int word_sized = is_word_sized(reg);
254 255
255 down(&data->lock); 256 mutex_lock(&data->lock);
256 257
257 w83627ehf_set_bank(client, reg); 258 w83627ehf_set_bank(client, reg);
258 outb_p(reg & 0xff, client->addr + ADDR_REG_OFFSET); 259 outb_p(reg & 0xff, client->addr + ADDR_REG_OFFSET);
@@ -264,7 +265,7 @@ static int w83627ehf_write_value(struct i2c_client *client, u16 reg, u16 value)
264 outb_p(value & 0xff, client->addr + DATA_REG_OFFSET); 265 outb_p(value & 0xff, client->addr + DATA_REG_OFFSET);
265 w83627ehf_reset_bank(client, reg); 266 w83627ehf_reset_bank(client, reg);
266 267
267 up(&data->lock); 268 mutex_unlock(&data->lock);
268 return 0; 269 return 0;
269} 270}
270 271
@@ -322,7 +323,7 @@ static struct w83627ehf_data *w83627ehf_update_device(struct device *dev)
322 struct w83627ehf_data *data = i2c_get_clientdata(client); 323 struct w83627ehf_data *data = i2c_get_clientdata(client);
323 int i; 324 int i;
324 325
325 down(&data->update_lock); 326 mutex_lock(&data->update_lock);
326 327
327 if (time_after(jiffies, data->last_updated + HZ) 328 if (time_after(jiffies, data->last_updated + HZ)
328 || !data->valid) { 329 || !data->valid) {
@@ -397,7 +398,7 @@ static struct w83627ehf_data *w83627ehf_update_device(struct device *dev)
397 data->valid = 1; 398 data->valid = 1;
398 } 399 }
399 400
400 up(&data->update_lock); 401 mutex_unlock(&data->update_lock);
401 return data; 402 return data;
402} 403}
403 404
@@ -434,7 +435,7 @@ store_fan_min(struct device *dev, const char *buf, size_t count, int nr)
434 unsigned int reg; 435 unsigned int reg;
435 u8 new_div; 436 u8 new_div;
436 437
437 down(&data->update_lock); 438 mutex_lock(&data->update_lock);
438 if (!val) { 439 if (!val) {
439 /* No min limit, alarm disabled */ 440 /* No min limit, alarm disabled */
440 data->fan_min[nr] = 255; 441 data->fan_min[nr] = 255;
@@ -482,7 +483,7 @@ store_fan_min(struct device *dev, const char *buf, size_t count, int nr)
482 } 483 }
483 w83627ehf_write_value(client, W83627EHF_REG_FAN_MIN[nr], 484 w83627ehf_write_value(client, W83627EHF_REG_FAN_MIN[nr],
484 data->fan_min[nr]); 485 data->fan_min[nr]);
485 up(&data->update_lock); 486 mutex_unlock(&data->update_lock);
486 487
487 return count; 488 return count;
488} 489}
@@ -561,11 +562,11 @@ store_temp1_##reg(struct device *dev, struct device_attribute *attr, \
561 struct w83627ehf_data *data = i2c_get_clientdata(client); \ 562 struct w83627ehf_data *data = i2c_get_clientdata(client); \
562 u32 val = simple_strtoul(buf, NULL, 10); \ 563 u32 val = simple_strtoul(buf, NULL, 10); \
563 \ 564 \
564 down(&data->update_lock); \ 565 mutex_lock(&data->update_lock); \
565 data->temp1_##reg = temp1_to_reg(val); \ 566 data->temp1_##reg = temp1_to_reg(val); \
566 w83627ehf_write_value(client, W83627EHF_REG_TEMP1_##REG, \ 567 w83627ehf_write_value(client, W83627EHF_REG_TEMP1_##REG, \
567 data->temp1_##reg); \ 568 data->temp1_##reg); \
568 up(&data->update_lock); \ 569 mutex_unlock(&data->update_lock); \
569 return count; \ 570 return count; \
570} 571}
571store_temp1_reg(OVER, max); 572store_temp1_reg(OVER, max);
@@ -597,11 +598,11 @@ store_##reg (struct device *dev, const char *buf, size_t count, int nr) \
597 struct w83627ehf_data *data = i2c_get_clientdata(client); \ 598 struct w83627ehf_data *data = i2c_get_clientdata(client); \
598 u32 val = simple_strtoul(buf, NULL, 10); \ 599 u32 val = simple_strtoul(buf, NULL, 10); \
599 \ 600 \
600 down(&data->update_lock); \ 601 mutex_lock(&data->update_lock); \
601 data->reg[nr] = LM75_TEMP_TO_REG(val); \ 602 data->reg[nr] = LM75_TEMP_TO_REG(val); \
602 w83627ehf_write_value(client, W83627EHF_REG_TEMP_##REG[nr], \ 603 w83627ehf_write_value(client, W83627EHF_REG_TEMP_##REG[nr], \
603 data->reg[nr]); \ 604 data->reg[nr]); \
604 up(&data->update_lock); \ 605 mutex_unlock(&data->update_lock); \
605 return count; \ 606 return count; \
606} 607}
607store_temp_reg(OVER, temp_max); 608store_temp_reg(OVER, temp_max);
@@ -689,14 +690,14 @@ static int w83627ehf_detect(struct i2c_adapter *adapter)
689 client = &data->client; 690 client = &data->client;
690 i2c_set_clientdata(client, data); 691 i2c_set_clientdata(client, data);
691 client->addr = address; 692 client->addr = address;
692 init_MUTEX(&data->lock); 693 mutex_init(&data->lock);
693 client->adapter = adapter; 694 client->adapter = adapter;
694 client->driver = &w83627ehf_driver; 695 client->driver = &w83627ehf_driver;
695 client->flags = 0; 696 client->flags = 0;
696 697
697 strlcpy(client->name, "w83627ehf", I2C_NAME_SIZE); 698 strlcpy(client->name, "w83627ehf", I2C_NAME_SIZE);
698 data->valid = 0; 699 data->valid = 0;
699 init_MUTEX(&data->update_lock); 700 mutex_init(&data->update_lock);
700 701
701 /* Tell the i2c layer a new client has arrived */ 702 /* Tell the i2c layer a new client has arrived */
702 if ((err = i2c_attach_client(client))) 703 if ((err = i2c_attach_client(client)))