aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/fscher.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/fscher.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/fscher.c')
-rw-r--r--drivers/hwmon/fscher.c41
1 files changed, 21 insertions, 20 deletions
diff --git a/drivers/hwmon/fscher.c b/drivers/hwmon/fscher.c
index 25409181d1eb..6bc76b407636 100644
--- a/drivers/hwmon/fscher.c
+++ b/drivers/hwmon/fscher.c
@@ -33,6 +33,7 @@
33#include <linux/i2c.h> 33#include <linux/i2c.h>
34#include <linux/hwmon.h> 34#include <linux/hwmon.h>
35#include <linux/err.h> 35#include <linux/err.h>
36#include <linux/mutex.h>
36 37
37/* 38/*
38 * Addresses to scan 39 * Addresses to scan
@@ -133,7 +134,7 @@ static struct i2c_driver fscher_driver = {
133struct fscher_data { 134struct fscher_data {
134 struct i2c_client client; 135 struct i2c_client client;
135 struct class_device *class_dev; 136 struct class_device *class_dev;
136 struct semaphore update_lock; 137 struct mutex update_lock;
137 char valid; /* zero until following fields are valid */ 138 char valid; /* zero until following fields are valid */
138 unsigned long last_updated; /* in jiffies */ 139 unsigned long last_updated; /* in jiffies */
139 140
@@ -332,7 +333,7 @@ static int fscher_detect(struct i2c_adapter *adapter, int address, int kind)
332 * global list */ 333 * global list */
333 strlcpy(new_client->name, "fscher", I2C_NAME_SIZE); 334 strlcpy(new_client->name, "fscher", I2C_NAME_SIZE);
334 data->valid = 0; 335 data->valid = 0;
335 init_MUTEX(&data->update_lock); 336 mutex_init(&data->update_lock);
336 337
337 /* Tell the I2C layer a new client has arrived */ 338 /* Tell the I2C layer a new client has arrived */
338 if ((err = i2c_attach_client(new_client))) 339 if ((err = i2c_attach_client(new_client)))
@@ -417,7 +418,7 @@ static struct fscher_data *fscher_update_device(struct device *dev)
417 struct i2c_client *client = to_i2c_client(dev); 418 struct i2c_client *client = to_i2c_client(dev);
418 struct fscher_data *data = i2c_get_clientdata(client); 419 struct fscher_data *data = i2c_get_clientdata(client);
419 420
420 down(&data->update_lock); 421 mutex_lock(&data->update_lock);
421 422
422 if (time_after(jiffies, data->last_updated + 2 * HZ) || !data->valid) { 423 if (time_after(jiffies, data->last_updated + 2 * HZ) || !data->valid) {
423 424
@@ -457,7 +458,7 @@ static struct fscher_data *fscher_update_device(struct device *dev)
457 data->valid = 1; 458 data->valid = 1;
458 } 459 }
459 460
460 up(&data->update_lock); 461 mutex_unlock(&data->update_lock);
461 462
462 return data; 463 return data;
463} 464}
@@ -472,10 +473,10 @@ static ssize_t set_fan_status(struct i2c_client *client, struct fscher_data *dat
472 /* bits 0..1, 3..7 reserved => mask with 0x04 */ 473 /* bits 0..1, 3..7 reserved => mask with 0x04 */
473 unsigned long v = simple_strtoul(buf, NULL, 10) & 0x04; 474 unsigned long v = simple_strtoul(buf, NULL, 10) & 0x04;
474 475
475 down(&data->update_lock); 476 mutex_lock(&data->update_lock);
476 data->fan_status[FAN_INDEX_FROM_NUM(nr)] &= ~v; 477 data->fan_status[FAN_INDEX_FROM_NUM(nr)] &= ~v;
477 fscher_write_value(client, reg, v); 478 fscher_write_value(client, reg, v);
478 up(&data->update_lock); 479 mutex_unlock(&data->update_lock);
479 return count; 480 return count;
480} 481}
481 482
@@ -490,10 +491,10 @@ static ssize_t set_pwm(struct i2c_client *client, struct fscher_data *data,
490{ 491{
491 unsigned long v = simple_strtoul(buf, NULL, 10); 492 unsigned long v = simple_strtoul(buf, NULL, 10);
492 493
493 down(&data->update_lock); 494 mutex_lock(&data->update_lock);
494 data->fan_min[FAN_INDEX_FROM_NUM(nr)] = v > 0xff ? 0xff : v; 495 data->fan_min[FAN_INDEX_FROM_NUM(nr)] = v > 0xff ? 0xff : v;
495 fscher_write_value(client, reg, data->fan_min[FAN_INDEX_FROM_NUM(nr)]); 496 fscher_write_value(client, reg, data->fan_min[FAN_INDEX_FROM_NUM(nr)]);
496 up(&data->update_lock); 497 mutex_unlock(&data->update_lock);
497 return count; 498 return count;
498} 499}
499 500
@@ -518,14 +519,14 @@ static ssize_t set_fan_div(struct i2c_client *client, struct fscher_data *data,
518 return -EINVAL; 519 return -EINVAL;
519 } 520 }
520 521
521 down(&data->update_lock); 522 mutex_lock(&data->update_lock);
522 523
523 /* bits 2..7 reserved => mask with 0x03 */ 524 /* bits 2..7 reserved => mask with 0x03 */
524 data->fan_ripple[FAN_INDEX_FROM_NUM(nr)] &= ~0x03; 525 data->fan_ripple[FAN_INDEX_FROM_NUM(nr)] &= ~0x03;
525 data->fan_ripple[FAN_INDEX_FROM_NUM(nr)] |= v; 526 data->fan_ripple[FAN_INDEX_FROM_NUM(nr)] |= v;
526 527
527 fscher_write_value(client, reg, data->fan_ripple[FAN_INDEX_FROM_NUM(nr)]); 528 fscher_write_value(client, reg, data->fan_ripple[FAN_INDEX_FROM_NUM(nr)]);
528 up(&data->update_lock); 529 mutex_unlock(&data->update_lock);
529 return count; 530 return count;
530} 531}
531 532
@@ -552,10 +553,10 @@ static ssize_t set_temp_status(struct i2c_client *client, struct fscher_data *da
552 /* bits 2..7 reserved, 0 read only => mask with 0x02 */ 553 /* bits 2..7 reserved, 0 read only => mask with 0x02 */
553 unsigned long v = simple_strtoul(buf, NULL, 10) & 0x02; 554 unsigned long v = simple_strtoul(buf, NULL, 10) & 0x02;
554 555
555 down(&data->update_lock); 556 mutex_lock(&data->update_lock);
556 data->temp_status[TEMP_INDEX_FROM_NUM(nr)] &= ~v; 557 data->temp_status[TEMP_INDEX_FROM_NUM(nr)] &= ~v;
557 fscher_write_value(client, reg, v); 558 fscher_write_value(client, reg, v);
558 up(&data->update_lock); 559 mutex_unlock(&data->update_lock);
559 return count; 560 return count;
560} 561}
561 562
@@ -609,10 +610,10 @@ static ssize_t set_control(struct i2c_client *client, struct fscher_data *data,
609 /* bits 1..7 reserved => mask with 0x01 */ 610 /* bits 1..7 reserved => mask with 0x01 */
610 unsigned long v = simple_strtoul(buf, NULL, 10) & 0x01; 611 unsigned long v = simple_strtoul(buf, NULL, 10) & 0x01;
611 612
612 down(&data->update_lock); 613 mutex_lock(&data->update_lock);
613 data->global_control &= ~v; 614 data->global_control &= ~v;
614 fscher_write_value(client, reg, v); 615 fscher_write_value(client, reg, v);
615 up(&data->update_lock); 616 mutex_unlock(&data->update_lock);
616 return count; 617 return count;
617} 618}
618 619
@@ -631,11 +632,11 @@ static ssize_t set_watchdog_control(struct i2c_client *client, struct
631 /* bits 0..3 reserved => mask with 0xf0 */ 632 /* bits 0..3 reserved => mask with 0xf0 */
632 unsigned long v = simple_strtoul(buf, NULL, 10) & 0xf0; 633 unsigned long v = simple_strtoul(buf, NULL, 10) & 0xf0;
633 634
634 down(&data->update_lock); 635 mutex_lock(&data->update_lock);
635 data->watchdog[2] &= ~0xf0; 636 data->watchdog[2] &= ~0xf0;
636 data->watchdog[2] |= v; 637 data->watchdog[2] |= v;
637 fscher_write_value(client, reg, data->watchdog[2]); 638 fscher_write_value(client, reg, data->watchdog[2]);
638 up(&data->update_lock); 639 mutex_unlock(&data->update_lock);
639 return count; 640 return count;
640} 641}
641 642
@@ -651,10 +652,10 @@ static ssize_t set_watchdog_status(struct i2c_client *client, struct fscher_data
651 /* bits 0, 2..7 reserved => mask with 0x02 */ 652 /* bits 0, 2..7 reserved => mask with 0x02 */
652 unsigned long v = simple_strtoul(buf, NULL, 10) & 0x02; 653 unsigned long v = simple_strtoul(buf, NULL, 10) & 0x02;
653 654
654 down(&data->update_lock); 655 mutex_lock(&data->update_lock);
655 data->watchdog[1] &= ~v; 656 data->watchdog[1] &= ~v;
656 fscher_write_value(client, reg, v); 657 fscher_write_value(client, reg, v);
657 up(&data->update_lock); 658 mutex_unlock(&data->update_lock);
658 return count; 659 return count;
659} 660}
660 661
@@ -669,10 +670,10 @@ static ssize_t set_watchdog_preset(struct i2c_client *client, struct fscher_data
669{ 670{
670 unsigned long v = simple_strtoul(buf, NULL, 10) & 0xff; 671 unsigned long v = simple_strtoul(buf, NULL, 10) & 0xff;
671 672
672 down(&data->update_lock); 673 mutex_lock(&data->update_lock);
673 data->watchdog[0] = v; 674 data->watchdog[0] = v;
674 fscher_write_value(client, reg, data->watchdog[0]); 675 fscher_write_value(client, reg, data->watchdog[0]);
675 up(&data->update_lock); 676 mutex_unlock(&data->update_lock);
676 return count; 677 return count;
677} 678}
678 679