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/via686a.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/via686a.c')
-rw-r--r-- | drivers/hwmon/via686a.c | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/drivers/hwmon/via686a.c b/drivers/hwmon/via686a.c index cb01848729b5..166298f1f190 100644 --- a/drivers/hwmon/via686a.c +++ b/drivers/hwmon/via686a.c | |||
@@ -39,6 +39,7 @@ | |||
39 | #include <linux/hwmon.h> | 39 | #include <linux/hwmon.h> |
40 | #include <linux/err.h> | 40 | #include <linux/err.h> |
41 | #include <linux/init.h> | 41 | #include <linux/init.h> |
42 | #include <linux/mutex.h> | ||
42 | #include <asm/io.h> | 43 | #include <asm/io.h> |
43 | 44 | ||
44 | 45 | ||
@@ -296,7 +297,7 @@ static inline long TEMP_FROM_REG10(u16 val) | |||
296 | struct via686a_data { | 297 | struct via686a_data { |
297 | struct i2c_client client; | 298 | struct i2c_client client; |
298 | struct class_device *class_dev; | 299 | struct class_device *class_dev; |
299 | struct semaphore update_lock; | 300 | struct mutex update_lock; |
300 | char valid; /* !=0 if following fields are valid */ | 301 | char valid; /* !=0 if following fields are valid */ |
301 | unsigned long last_updated; /* In jiffies */ | 302 | unsigned long last_updated; /* In jiffies */ |
302 | 303 | ||
@@ -355,11 +356,11 @@ static ssize_t set_in_min(struct device *dev, const char *buf, | |||
355 | struct via686a_data *data = i2c_get_clientdata(client); | 356 | struct via686a_data *data = i2c_get_clientdata(client); |
356 | unsigned long val = simple_strtoul(buf, NULL, 10); | 357 | unsigned long val = simple_strtoul(buf, NULL, 10); |
357 | 358 | ||
358 | down(&data->update_lock); | 359 | mutex_lock(&data->update_lock); |
359 | data->in_min[nr] = IN_TO_REG(val, nr); | 360 | data->in_min[nr] = IN_TO_REG(val, nr); |
360 | via686a_write_value(client, VIA686A_REG_IN_MIN(nr), | 361 | via686a_write_value(client, VIA686A_REG_IN_MIN(nr), |
361 | data->in_min[nr]); | 362 | data->in_min[nr]); |
362 | up(&data->update_lock); | 363 | mutex_unlock(&data->update_lock); |
363 | return count; | 364 | return count; |
364 | } | 365 | } |
365 | static ssize_t set_in_max(struct device *dev, const char *buf, | 366 | static ssize_t set_in_max(struct device *dev, const char *buf, |
@@ -368,11 +369,11 @@ static ssize_t set_in_max(struct device *dev, const char *buf, | |||
368 | struct via686a_data *data = i2c_get_clientdata(client); | 369 | struct via686a_data *data = i2c_get_clientdata(client); |
369 | unsigned long val = simple_strtoul(buf, NULL, 10); | 370 | unsigned long val = simple_strtoul(buf, NULL, 10); |
370 | 371 | ||
371 | down(&data->update_lock); | 372 | mutex_lock(&data->update_lock); |
372 | data->in_max[nr] = IN_TO_REG(val, nr); | 373 | data->in_max[nr] = IN_TO_REG(val, nr); |
373 | via686a_write_value(client, VIA686A_REG_IN_MAX(nr), | 374 | via686a_write_value(client, VIA686A_REG_IN_MAX(nr), |
374 | data->in_max[nr]); | 375 | data->in_max[nr]); |
375 | up(&data->update_lock); | 376 | mutex_unlock(&data->update_lock); |
376 | return count; | 377 | return count; |
377 | } | 378 | } |
378 | #define show_in_offset(offset) \ | 379 | #define show_in_offset(offset) \ |
@@ -432,11 +433,11 @@ static ssize_t set_temp_over(struct device *dev, const char *buf, | |||
432 | struct via686a_data *data = i2c_get_clientdata(client); | 433 | struct via686a_data *data = i2c_get_clientdata(client); |
433 | int val = simple_strtol(buf, NULL, 10); | 434 | int val = simple_strtol(buf, NULL, 10); |
434 | 435 | ||
435 | down(&data->update_lock); | 436 | mutex_lock(&data->update_lock); |
436 | data->temp_over[nr] = TEMP_TO_REG(val); | 437 | data->temp_over[nr] = TEMP_TO_REG(val); |
437 | via686a_write_value(client, VIA686A_REG_TEMP_OVER[nr], | 438 | via686a_write_value(client, VIA686A_REG_TEMP_OVER[nr], |
438 | data->temp_over[nr]); | 439 | data->temp_over[nr]); |
439 | up(&data->update_lock); | 440 | mutex_unlock(&data->update_lock); |
440 | return count; | 441 | return count; |
441 | } | 442 | } |
442 | static ssize_t set_temp_hyst(struct device *dev, const char *buf, | 443 | static ssize_t set_temp_hyst(struct device *dev, const char *buf, |
@@ -445,11 +446,11 @@ static ssize_t set_temp_hyst(struct device *dev, const char *buf, | |||
445 | struct via686a_data *data = i2c_get_clientdata(client); | 446 | struct via686a_data *data = i2c_get_clientdata(client); |
446 | int val = simple_strtol(buf, NULL, 10); | 447 | int val = simple_strtol(buf, NULL, 10); |
447 | 448 | ||
448 | down(&data->update_lock); | 449 | mutex_lock(&data->update_lock); |
449 | data->temp_hyst[nr] = TEMP_TO_REG(val); | 450 | data->temp_hyst[nr] = TEMP_TO_REG(val); |
450 | via686a_write_value(client, VIA686A_REG_TEMP_HYST[nr], | 451 | via686a_write_value(client, VIA686A_REG_TEMP_HYST[nr], |
451 | data->temp_hyst[nr]); | 452 | data->temp_hyst[nr]); |
452 | up(&data->update_lock); | 453 | mutex_unlock(&data->update_lock); |
453 | return count; | 454 | return count; |
454 | } | 455 | } |
455 | #define show_temp_offset(offset) \ | 456 | #define show_temp_offset(offset) \ |
@@ -508,10 +509,10 @@ static ssize_t set_fan_min(struct device *dev, const char *buf, | |||
508 | struct via686a_data *data = i2c_get_clientdata(client); | 509 | struct via686a_data *data = i2c_get_clientdata(client); |
509 | int val = simple_strtol(buf, NULL, 10); | 510 | int val = simple_strtol(buf, NULL, 10); |
510 | 511 | ||
511 | down(&data->update_lock); | 512 | mutex_lock(&data->update_lock); |
512 | data->fan_min[nr] = FAN_TO_REG(val, DIV_FROM_REG(data->fan_div[nr])); | 513 | data->fan_min[nr] = FAN_TO_REG(val, DIV_FROM_REG(data->fan_div[nr])); |
513 | via686a_write_value(client, VIA686A_REG_FAN_MIN(nr+1), data->fan_min[nr]); | 514 | via686a_write_value(client, VIA686A_REG_FAN_MIN(nr+1), data->fan_min[nr]); |
514 | up(&data->update_lock); | 515 | mutex_unlock(&data->update_lock); |
515 | return count; | 516 | return count; |
516 | } | 517 | } |
517 | static ssize_t set_fan_div(struct device *dev, const char *buf, | 518 | static ssize_t set_fan_div(struct device *dev, const char *buf, |
@@ -521,12 +522,12 @@ static ssize_t set_fan_div(struct device *dev, const char *buf, | |||
521 | int val = simple_strtol(buf, NULL, 10); | 522 | int val = simple_strtol(buf, NULL, 10); |
522 | int old; | 523 | int old; |
523 | 524 | ||
524 | down(&data->update_lock); | 525 | mutex_lock(&data->update_lock); |
525 | old = via686a_read_value(client, VIA686A_REG_FANDIV); | 526 | old = via686a_read_value(client, VIA686A_REG_FANDIV); |
526 | data->fan_div[nr] = DIV_TO_REG(val); | 527 | data->fan_div[nr] = DIV_TO_REG(val); |
527 | old = (old & 0x0f) | (data->fan_div[1] << 6) | (data->fan_div[0] << 4); | 528 | old = (old & 0x0f) | (data->fan_div[1] << 6) | (data->fan_div[0] << 4); |
528 | via686a_write_value(client, VIA686A_REG_FANDIV, old); | 529 | via686a_write_value(client, VIA686A_REG_FANDIV, old); |
529 | up(&data->update_lock); | 530 | mutex_unlock(&data->update_lock); |
530 | return count; | 531 | return count; |
531 | } | 532 | } |
532 | 533 | ||
@@ -639,7 +640,7 @@ static int via686a_detect(struct i2c_adapter *adapter) | |||
639 | strlcpy(new_client->name, client_name, I2C_NAME_SIZE); | 640 | strlcpy(new_client->name, client_name, I2C_NAME_SIZE); |
640 | 641 | ||
641 | data->valid = 0; | 642 | data->valid = 0; |
642 | init_MUTEX(&data->update_lock); | 643 | mutex_init(&data->update_lock); |
643 | /* Tell the I2C layer a new client has arrived */ | 644 | /* Tell the I2C layer a new client has arrived */ |
644 | if ((err = i2c_attach_client(new_client))) | 645 | if ((err = i2c_attach_client(new_client))) |
645 | goto exit_free; | 646 | goto exit_free; |
@@ -733,7 +734,7 @@ static struct via686a_data *via686a_update_device(struct device *dev) | |||
733 | struct via686a_data *data = i2c_get_clientdata(client); | 734 | struct via686a_data *data = i2c_get_clientdata(client); |
734 | int i; | 735 | int i; |
735 | 736 | ||
736 | down(&data->update_lock); | 737 | mutex_lock(&data->update_lock); |
737 | 738 | ||
738 | if (time_after(jiffies, data->last_updated + HZ + HZ / 2) | 739 | if (time_after(jiffies, data->last_updated + HZ + HZ / 2) |
739 | || !data->valid) { | 740 | || !data->valid) { |
@@ -788,7 +789,7 @@ static struct via686a_data *via686a_update_device(struct device *dev) | |||
788 | data->valid = 1; | 789 | data->valid = 1; |
789 | } | 790 | } |
790 | 791 | ||
791 | up(&data->update_lock); | 792 | mutex_unlock(&data->update_lock); |
792 | 793 | ||
793 | return data; | 794 | return data; |
794 | } | 795 | } |