aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/gl520sm.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/gl520sm.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/gl520sm.c')
-rw-r--r--drivers/hwmon/gl520sm.c45
1 files changed, 23 insertions, 22 deletions
diff --git a/drivers/hwmon/gl520sm.c b/drivers/hwmon/gl520sm.c
index baee60e44b52..47b4d49f75c6 100644
--- a/drivers/hwmon/gl520sm.c
+++ b/drivers/hwmon/gl520sm.c
@@ -29,6 +29,7 @@
29#include <linux/hwmon.h> 29#include <linux/hwmon.h>
30#include <linux/hwmon-vid.h> 30#include <linux/hwmon-vid.h>
31#include <linux/err.h> 31#include <linux/err.h>
32#include <linux/mutex.h>
32 33
33/* Type of the extra sensor */ 34/* Type of the extra sensor */
34static unsigned short extra_sensor_type; 35static unsigned short extra_sensor_type;
@@ -121,7 +122,7 @@ static struct i2c_driver gl520_driver = {
121struct gl520_data { 122struct gl520_data {
122 struct i2c_client client; 123 struct i2c_client client;
123 struct class_device *class_dev; 124 struct class_device *class_dev;
124 struct semaphore update_lock; 125 struct mutex update_lock;
125 char valid; /* zero until the following fields are valid */ 126 char valid; /* zero until the following fields are valid */
126 unsigned long last_updated; /* in jiffies */ 127 unsigned long last_updated; /* in jiffies */
127 128
@@ -303,7 +304,7 @@ static ssize_t set_in_min(struct i2c_client *client, struct gl520_data *data, co
303 long v = simple_strtol(buf, NULL, 10); 304 long v = simple_strtol(buf, NULL, 10);
304 u8 r; 305 u8 r;
305 306
306 down(&data->update_lock); 307 mutex_lock(&data->update_lock);
307 308
308 if (n == 0) 309 if (n == 0)
309 r = VDD_TO_REG(v); 310 r = VDD_TO_REG(v);
@@ -317,7 +318,7 @@ static ssize_t set_in_min(struct i2c_client *client, struct gl520_data *data, co
317 else 318 else
318 gl520_write_value(client, reg, r); 319 gl520_write_value(client, reg, r);
319 320
320 up(&data->update_lock); 321 mutex_unlock(&data->update_lock);
321 return count; 322 return count;
322} 323}
323 324
@@ -331,7 +332,7 @@ static ssize_t set_in_max(struct i2c_client *client, struct gl520_data *data, co
331 else 332 else
332 r = IN_TO_REG(v); 333 r = IN_TO_REG(v);
333 334
334 down(&data->update_lock); 335 mutex_lock(&data->update_lock);
335 336
336 data->in_max[n] = r; 337 data->in_max[n] = r;
337 338
@@ -340,7 +341,7 @@ static ssize_t set_in_max(struct i2c_client *client, struct gl520_data *data, co
340 else 341 else
341 gl520_write_value(client, reg, r); 342 gl520_write_value(client, reg, r);
342 343
343 up(&data->update_lock); 344 mutex_unlock(&data->update_lock);
344 return count; 345 return count;
345} 346}
346 347
@@ -373,7 +374,7 @@ static ssize_t set_fan_min(struct i2c_client *client, struct gl520_data *data, c
373 unsigned long v = simple_strtoul(buf, NULL, 10); 374 unsigned long v = simple_strtoul(buf, NULL, 10);
374 u8 r; 375 u8 r;
375 376
376 down(&data->update_lock); 377 mutex_lock(&data->update_lock);
377 r = FAN_TO_REG(v, data->fan_div[n - 1]); 378 r = FAN_TO_REG(v, data->fan_div[n - 1]);
378 data->fan_min[n - 1] = r; 379 data->fan_min[n - 1] = r;
379 380
@@ -390,7 +391,7 @@ static ssize_t set_fan_min(struct i2c_client *client, struct gl520_data *data, c
390 data->beep_mask &= data->alarm_mask; 391 data->beep_mask &= data->alarm_mask;
391 gl520_write_value(client, GL520_REG_BEEP_MASK, data->beep_mask); 392 gl520_write_value(client, GL520_REG_BEEP_MASK, data->beep_mask);
392 393
393 up(&data->update_lock); 394 mutex_unlock(&data->update_lock);
394 return count; 395 return count;
395} 396}
396 397
@@ -409,7 +410,7 @@ static ssize_t set_fan_div(struct i2c_client *client, struct gl520_data *data, c
409 return -EINVAL; 410 return -EINVAL;
410 } 411 }
411 412
412 down(&data->update_lock); 413 mutex_lock(&data->update_lock);
413 data->fan_div[n - 1] = r; 414 data->fan_div[n - 1] = r;
414 415
415 if (n == 1) 416 if (n == 1)
@@ -417,7 +418,7 @@ static ssize_t set_fan_div(struct i2c_client *client, struct gl520_data *data, c
417 else 418 else
418 gl520_write_value(client, reg, (gl520_read_value(client, reg) & ~0x30) | (r << 4)); 419 gl520_write_value(client, reg, (gl520_read_value(client, reg) & ~0x30) | (r << 4));
419 420
420 up(&data->update_lock); 421 mutex_unlock(&data->update_lock);
421 return count; 422 return count;
422} 423}
423 424
@@ -425,10 +426,10 @@ static ssize_t set_fan_off(struct i2c_client *client, struct gl520_data *data, c
425{ 426{
426 u8 r = simple_strtoul(buf, NULL, 10)?1:0; 427 u8 r = simple_strtoul(buf, NULL, 10)?1:0;
427 428
428 down(&data->update_lock); 429 mutex_lock(&data->update_lock);
429 data->fan_off = r; 430 data->fan_off = r;
430 gl520_write_value(client, reg, (gl520_read_value(client, reg) & ~0x0c) | (r << 2)); 431 gl520_write_value(client, reg, (gl520_read_value(client, reg) & ~0x0c) | (r << 2));
431 up(&data->update_lock); 432 mutex_unlock(&data->update_lock);
432 return count; 433 return count;
433} 434}
434 435
@@ -454,10 +455,10 @@ static ssize_t set_temp_max(struct i2c_client *client, struct gl520_data *data,
454{ 455{
455 long v = simple_strtol(buf, NULL, 10); 456 long v = simple_strtol(buf, NULL, 10);
456 457
457 down(&data->update_lock); 458 mutex_lock(&data->update_lock);
458 data->temp_max[n - 1] = TEMP_TO_REG(v);; 459 data->temp_max[n - 1] = TEMP_TO_REG(v);;
459 gl520_write_value(client, reg, data->temp_max[n - 1]); 460 gl520_write_value(client, reg, data->temp_max[n - 1]);
460 up(&data->update_lock); 461 mutex_unlock(&data->update_lock);
461 return count; 462 return count;
462} 463}
463 464
@@ -465,10 +466,10 @@ static ssize_t set_temp_max_hyst(struct i2c_client *client, struct gl520_data *d
465{ 466{
466 long v = simple_strtol(buf, NULL, 10); 467 long v = simple_strtol(buf, NULL, 10);
467 468
468 down(&data->update_lock); 469 mutex_lock(&data->update_lock);
469 data->temp_max_hyst[n - 1] = TEMP_TO_REG(v); 470 data->temp_max_hyst[n - 1] = TEMP_TO_REG(v);
470 gl520_write_value(client, reg, data->temp_max_hyst[n - 1]); 471 gl520_write_value(client, reg, data->temp_max_hyst[n - 1]);
471 up(&data->update_lock); 472 mutex_unlock(&data->update_lock);
472 return count; 473 return count;
473} 474}
474 475
@@ -491,10 +492,10 @@ static ssize_t set_beep_enable(struct i2c_client *client, struct gl520_data *dat
491{ 492{
492 u8 r = simple_strtoul(buf, NULL, 10)?0:1; 493 u8 r = simple_strtoul(buf, NULL, 10)?0:1;
493 494
494 down(&data->update_lock); 495 mutex_lock(&data->update_lock);
495 data->beep_enable = !r; 496 data->beep_enable = !r;
496 gl520_write_value(client, reg, (gl520_read_value(client, reg) & ~0x04) | (r << 2)); 497 gl520_write_value(client, reg, (gl520_read_value(client, reg) & ~0x04) | (r << 2));
497 up(&data->update_lock); 498 mutex_unlock(&data->update_lock);
498 return count; 499 return count;
499} 500}
500 501
@@ -502,11 +503,11 @@ static ssize_t set_beep_mask(struct i2c_client *client, struct gl520_data *data,
502{ 503{
503 u8 r = simple_strtoul(buf, NULL, 10); 504 u8 r = simple_strtoul(buf, NULL, 10);
504 505
505 down(&data->update_lock); 506 mutex_lock(&data->update_lock);
506 r &= data->alarm_mask; 507 r &= data->alarm_mask;
507 data->beep_mask = r; 508 data->beep_mask = r;
508 gl520_write_value(client, reg, r); 509 gl520_write_value(client, reg, r);
509 up(&data->update_lock); 510 mutex_unlock(&data->update_lock);
510 return count; 511 return count;
511} 512}
512 513
@@ -561,7 +562,7 @@ static int gl520_detect(struct i2c_adapter *adapter, int address, int kind)
561 /* Fill in the remaining client fields */ 562 /* Fill in the remaining client fields */
562 strlcpy(new_client->name, "gl520sm", I2C_NAME_SIZE); 563 strlcpy(new_client->name, "gl520sm", I2C_NAME_SIZE);
563 data->valid = 0; 564 data->valid = 0;
564 init_MUTEX(&data->update_lock); 565 mutex_init(&data->update_lock);
565 566
566 /* Tell the I2C layer a new client has arrived */ 567 /* Tell the I2C layer a new client has arrived */
567 if ((err = i2c_attach_client(new_client))) 568 if ((err = i2c_attach_client(new_client)))
@@ -685,7 +686,7 @@ static struct gl520_data *gl520_update_device(struct device *dev)
685 struct gl520_data *data = i2c_get_clientdata(client); 686 struct gl520_data *data = i2c_get_clientdata(client);
686 int val; 687 int val;
687 688
688 down(&data->update_lock); 689 mutex_lock(&data->update_lock);
689 690
690 if (time_after(jiffies, data->last_updated + 2 * HZ) || !data->valid) { 691 if (time_after(jiffies, data->last_updated + 2 * HZ) || !data->valid) {
691 692
@@ -750,7 +751,7 @@ static struct gl520_data *gl520_update_device(struct device *dev)
750 data->valid = 1; 751 data->valid = 1;
751 } 752 }
752 753
753 up(&data->update_lock); 754 mutex_unlock(&data->update_lock);
754 755
755 return data; 756 return data;
756} 757}