diff options
author | Guenter Roeck <linux@roeck-us.net> | 2012-01-15 12:19:16 -0500 |
---|---|---|
committer | Guenter Roeck <guenter.roeck@ericsson.com> | 2012-03-18 21:26:47 -0400 |
commit | c531eb3f229bcc3b4ee7fb471e580caff86dafad (patch) | |
tree | 56b81d6b3be80a094effc487507fe9837bc72a42 /drivers/hwmon/w83781d.c | |
parent | 2b22de5117d6dec44b62c305cb456e5b9a913c95 (diff) |
hwmon: (w83781d) Fix checkpatch issues
Fixed:
ERROR: code indent should use tabs where possible
ERROR: do not use assignment in if condition
ERROR: "foo* bar" should be "foo *bar"
ERROR: space prohibited after that open parenthesis '('
ERROR: space required after that ',' (ctx:VxV)
ERROR: spaces required around that '==' (ctx:VxV)
WARNING: line over 80 characters
WARNING: simple_strtol is obsolete, use kstrtol instead
WARNING: simple_strtoul is obsolete, use kstrtoul instead
WARNING: space prohibited between function name and open parenthesis '('
Not fixed (false positive):
ERROR: Macros with multiple statements should be enclosed in a do - while loop
ERROR: Macros with complex values should be enclosed in parenthesis
Not all fixed (code complexity):
ERROR: do not use assignment in if condition
Acked-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'drivers/hwmon/w83781d.c')
-rw-r--r-- | drivers/hwmon/w83781d.c | 146 |
1 files changed, 92 insertions, 54 deletions
diff --git a/drivers/hwmon/w83781d.c b/drivers/hwmon/w83781d.c index 17a8fa2d9ae9..e8a19005b7d2 100644 --- a/drivers/hwmon/w83781d.c +++ b/drivers/hwmon/w83781d.c | |||
@@ -1,9 +1,9 @@ | |||
1 | /* | 1 | /* |
2 | w83781d.c - Part of lm_sensors, Linux kernel modules for hardware | 2 | w83781d.c - Part of lm_sensors, Linux kernel modules for hardware |
3 | monitoring | 3 | monitoring |
4 | Copyright (c) 1998 - 2001 Frodo Looijaard <frodol@dds.nl>, | 4 | Copyright (c) 1998 - 2001 Frodo Looijaard <frodol@dds.nl>, |
5 | Philip Edelbrock <phil@netroedge.com>, | 5 | Philip Edelbrock <phil@netroedge.com>, |
6 | and Mark Studebaker <mdsxyz123@yahoo.com> | 6 | and Mark Studebaker <mdsxyz123@yahoo.com> |
7 | Copyright (c) 2007 - 2008 Jean Delvare <khali@linux-fr.org> | 7 | Copyright (c) 2007 - 2008 Jean Delvare <khali@linux-fr.org> |
8 | 8 | ||
9 | This program is free software; you can redistribute it and/or modify | 9 | This program is free software; you can redistribute it and/or modify |
@@ -182,9 +182,9 @@ FAN_FROM_REG(u8 val, int div) | |||
182 | #define TEMP_TO_REG(val) SENSORS_LIMIT((val) / 1000, -127, 128) | 182 | #define TEMP_TO_REG(val) SENSORS_LIMIT((val) / 1000, -127, 128) |
183 | #define TEMP_FROM_REG(val) ((val) * 1000) | 183 | #define TEMP_FROM_REG(val) ((val) * 1000) |
184 | 184 | ||
185 | #define BEEP_MASK_FROM_REG(val,type) ((type) == as99127f ? \ | 185 | #define BEEP_MASK_FROM_REG(val, type) ((type) == as99127f ? \ |
186 | (~(val)) & 0x7fff : (val) & 0xff7fff) | 186 | (~(val)) & 0x7fff : (val) & 0xff7fff) |
187 | #define BEEP_MASK_TO_REG(val,type) ((type) == as99127f ? \ | 187 | #define BEEP_MASK_TO_REG(val, type) ((type) == as99127f ? \ |
188 | (~(val)) & 0x7fff : (val) & 0xff7fff) | 188 | (~(val)) & 0x7fff : (val) & 0xff7fff) |
189 | 189 | ||
190 | #define DIV_FROM_REG(val) (1 << (val)) | 190 | #define DIV_FROM_REG(val) (1 << (val)) |
@@ -254,7 +254,7 @@ static void w83781d_init_device(struct device *dev); | |||
254 | 254 | ||
255 | /* following are the sysfs callback functions */ | 255 | /* following are the sysfs callback functions */ |
256 | #define show_in_reg(reg) \ | 256 | #define show_in_reg(reg) \ |
257 | static ssize_t show_##reg (struct device *dev, struct device_attribute *da, \ | 257 | static ssize_t show_##reg(struct device *dev, struct device_attribute *da, \ |
258 | char *buf) \ | 258 | char *buf) \ |
259 | { \ | 259 | { \ |
260 | struct sensor_device_attribute *attr = to_sensor_dev_attr(da); \ | 260 | struct sensor_device_attribute *attr = to_sensor_dev_attr(da); \ |
@@ -267,20 +267,21 @@ show_in_reg(in_min); | |||
267 | show_in_reg(in_max); | 267 | show_in_reg(in_max); |
268 | 268 | ||
269 | #define store_in_reg(REG, reg) \ | 269 | #define store_in_reg(REG, reg) \ |
270 | static ssize_t store_in_##reg (struct device *dev, struct device_attribute \ | 270 | static ssize_t store_in_##reg(struct device *dev, struct device_attribute \ |
271 | *da, const char *buf, size_t count) \ | 271 | *da, const char *buf, size_t count) \ |
272 | { \ | 272 | { \ |
273 | struct sensor_device_attribute *attr = to_sensor_dev_attr(da); \ | 273 | struct sensor_device_attribute *attr = to_sensor_dev_attr(da); \ |
274 | struct w83781d_data *data = dev_get_drvdata(dev); \ | 274 | struct w83781d_data *data = dev_get_drvdata(dev); \ |
275 | int nr = attr->index; \ | 275 | int nr = attr->index; \ |
276 | u32 val; \ | 276 | unsigned long val; \ |
277 | \ | 277 | int err = kstrtoul(buf, 10, &val); \ |
278 | val = simple_strtoul(buf, NULL, 10); \ | 278 | if (err) \ |
279 | \ | 279 | return err; \ |
280 | mutex_lock(&data->update_lock); \ | 280 | mutex_lock(&data->update_lock); \ |
281 | data->in_##reg[nr] = IN_TO_REG(val); \ | 281 | data->in_##reg[nr] = IN_TO_REG(val); \ |
282 | w83781d_write_value(data, W83781D_REG_IN_##REG(nr), data->in_##reg[nr]); \ | 282 | w83781d_write_value(data, W83781D_REG_IN_##REG(nr), \ |
283 | \ | 283 | data->in_##reg[nr]); \ |
284 | \ | ||
284 | mutex_unlock(&data->update_lock); \ | 285 | mutex_unlock(&data->update_lock); \ |
285 | return count; \ | 286 | return count; \ |
286 | } | 287 | } |
@@ -306,12 +307,12 @@ sysfs_in_offsets(7); | |||
306 | sysfs_in_offsets(8); | 307 | sysfs_in_offsets(8); |
307 | 308 | ||
308 | #define show_fan_reg(reg) \ | 309 | #define show_fan_reg(reg) \ |
309 | static ssize_t show_##reg (struct device *dev, struct device_attribute *da, \ | 310 | static ssize_t show_##reg(struct device *dev, struct device_attribute *da, \ |
310 | char *buf) \ | 311 | char *buf) \ |
311 | { \ | 312 | { \ |
312 | struct sensor_device_attribute *attr = to_sensor_dev_attr(da); \ | 313 | struct sensor_device_attribute *attr = to_sensor_dev_attr(da); \ |
313 | struct w83781d_data *data = w83781d_update_device(dev); \ | 314 | struct w83781d_data *data = w83781d_update_device(dev); \ |
314 | return sprintf(buf,"%ld\n", \ | 315 | return sprintf(buf, "%ld\n", \ |
315 | FAN_FROM_REG(data->reg[attr->index], \ | 316 | FAN_FROM_REG(data->reg[attr->index], \ |
316 | DIV_FROM_REG(data->fan_div[attr->index]))); \ | 317 | DIV_FROM_REG(data->fan_div[attr->index]))); \ |
317 | } | 318 | } |
@@ -325,9 +326,12 @@ store_fan_min(struct device *dev, struct device_attribute *da, | |||
325 | struct sensor_device_attribute *attr = to_sensor_dev_attr(da); | 326 | struct sensor_device_attribute *attr = to_sensor_dev_attr(da); |
326 | struct w83781d_data *data = dev_get_drvdata(dev); | 327 | struct w83781d_data *data = dev_get_drvdata(dev); |
327 | int nr = attr->index; | 328 | int nr = attr->index; |
328 | u32 val; | 329 | unsigned long val; |
330 | int err; | ||
329 | 331 | ||
330 | val = simple_strtoul(buf, NULL, 10); | 332 | err = kstrtoul(buf, 10, &val); |
333 | if (err) | ||
334 | return err; | ||
331 | 335 | ||
332 | mutex_lock(&data->update_lock); | 336 | mutex_lock(&data->update_lock); |
333 | data->fan_min[nr] = | 337 | data->fan_min[nr] = |
@@ -350,17 +354,17 @@ static SENSOR_DEVICE_ATTR(fan3_min, S_IRUGO | S_IWUSR, | |||
350 | show_fan_min, store_fan_min, 2); | 354 | show_fan_min, store_fan_min, 2); |
351 | 355 | ||
352 | #define show_temp_reg(reg) \ | 356 | #define show_temp_reg(reg) \ |
353 | static ssize_t show_##reg (struct device *dev, struct device_attribute *da, \ | 357 | static ssize_t show_##reg(struct device *dev, struct device_attribute *da, \ |
354 | char *buf) \ | 358 | char *buf) \ |
355 | { \ | 359 | { \ |
356 | struct sensor_device_attribute *attr = to_sensor_dev_attr(da); \ | 360 | struct sensor_device_attribute *attr = to_sensor_dev_attr(da); \ |
357 | struct w83781d_data *data = w83781d_update_device(dev); \ | 361 | struct w83781d_data *data = w83781d_update_device(dev); \ |
358 | int nr = attr->index; \ | 362 | int nr = attr->index; \ |
359 | if (nr >= 2) { /* TEMP2 and TEMP3 */ \ | 363 | if (nr >= 2) { /* TEMP2 and TEMP3 */ \ |
360 | return sprintf(buf,"%d\n", \ | 364 | return sprintf(buf, "%d\n", \ |
361 | LM75_TEMP_FROM_REG(data->reg##_add[nr-2])); \ | 365 | LM75_TEMP_FROM_REG(data->reg##_add[nr-2])); \ |
362 | } else { /* TEMP1 */ \ | 366 | } else { /* TEMP1 */ \ |
363 | return sprintf(buf,"%ld\n", (long)TEMP_FROM_REG(data->reg)); \ | 367 | return sprintf(buf, "%ld\n", (long)TEMP_FROM_REG(data->reg)); \ |
364 | } \ | 368 | } \ |
365 | } | 369 | } |
366 | show_temp_reg(temp); | 370 | show_temp_reg(temp); |
@@ -368,16 +372,16 @@ show_temp_reg(temp_max); | |||
368 | show_temp_reg(temp_max_hyst); | 372 | show_temp_reg(temp_max_hyst); |
369 | 373 | ||
370 | #define store_temp_reg(REG, reg) \ | 374 | #define store_temp_reg(REG, reg) \ |
371 | static ssize_t store_temp_##reg (struct device *dev, \ | 375 | static ssize_t store_temp_##reg(struct device *dev, \ |
372 | struct device_attribute *da, const char *buf, size_t count) \ | 376 | struct device_attribute *da, const char *buf, size_t count) \ |
373 | { \ | 377 | { \ |
374 | struct sensor_device_attribute *attr = to_sensor_dev_attr(da); \ | 378 | struct sensor_device_attribute *attr = to_sensor_dev_attr(da); \ |
375 | struct w83781d_data *data = dev_get_drvdata(dev); \ | 379 | struct w83781d_data *data = dev_get_drvdata(dev); \ |
376 | int nr = attr->index; \ | 380 | int nr = attr->index; \ |
377 | long val; \ | 381 | long val; \ |
378 | \ | 382 | int err = kstrtol(buf, 10, &val); \ |
379 | val = simple_strtol(buf, NULL, 10); \ | 383 | if (err) \ |
380 | \ | 384 | return err; \ |
381 | mutex_lock(&data->update_lock); \ | 385 | mutex_lock(&data->update_lock); \ |
382 | \ | 386 | \ |
383 | if (nr >= 2) { /* TEMP2 and TEMP3 */ \ | 387 | if (nr >= 2) { /* TEMP2 and TEMP3 */ \ |
@@ -425,13 +429,17 @@ show_vrm_reg(struct device *dev, struct device_attribute *attr, char *buf) | |||
425 | } | 429 | } |
426 | 430 | ||
427 | static ssize_t | 431 | static ssize_t |
428 | store_vrm_reg(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) | 432 | store_vrm_reg(struct device *dev, struct device_attribute *attr, |
433 | const char *buf, size_t count) | ||
429 | { | 434 | { |
430 | struct w83781d_data *data = dev_get_drvdata(dev); | 435 | struct w83781d_data *data = dev_get_drvdata(dev); |
431 | u32 val; | 436 | unsigned long val; |
437 | int err; | ||
432 | 438 | ||
433 | val = simple_strtoul(buf, NULL, 10); | 439 | err = kstrtoul(buf, 10, &val); |
434 | data->vrm = val; | 440 | if (err) |
441 | return err; | ||
442 | data->vrm = SENSORS_LIMIT(val, 0, 255); | ||
435 | 443 | ||
436 | return count; | 444 | return count; |
437 | } | 445 | } |
@@ -480,7 +488,8 @@ static SENSOR_DEVICE_ATTR(temp1_alarm, S_IRUGO, show_alarm, NULL, 4); | |||
480 | static SENSOR_DEVICE_ATTR(temp2_alarm, S_IRUGO, show_alarm, NULL, 5); | 488 | static SENSOR_DEVICE_ATTR(temp2_alarm, S_IRUGO, show_alarm, NULL, 5); |
481 | static SENSOR_DEVICE_ATTR(temp3_alarm, S_IRUGO, show_temp3_alarm, NULL, 0); | 489 | static SENSOR_DEVICE_ATTR(temp3_alarm, S_IRUGO, show_temp3_alarm, NULL, 0); |
482 | 490 | ||
483 | static ssize_t show_beep_mask (struct device *dev, struct device_attribute *attr, char *buf) | 491 | static ssize_t show_beep_mask(struct device *dev, |
492 | struct device_attribute *attr, char *buf) | ||
484 | { | 493 | { |
485 | struct w83781d_data *data = w83781d_update_device(dev); | 494 | struct w83781d_data *data = w83781d_update_device(dev); |
486 | return sprintf(buf, "%ld\n", | 495 | return sprintf(buf, "%ld\n", |
@@ -492,9 +501,12 @@ store_beep_mask(struct device *dev, struct device_attribute *attr, | |||
492 | const char *buf, size_t count) | 501 | const char *buf, size_t count) |
493 | { | 502 | { |
494 | struct w83781d_data *data = dev_get_drvdata(dev); | 503 | struct w83781d_data *data = dev_get_drvdata(dev); |
495 | u32 val; | 504 | unsigned long val; |
505 | int err; | ||
496 | 506 | ||
497 | val = simple_strtoul(buf, NULL, 10); | 507 | err = kstrtoul(buf, 10, &val); |
508 | if (err) | ||
509 | return err; | ||
498 | 510 | ||
499 | mutex_lock(&data->update_lock); | 511 | mutex_lock(&data->update_lock); |
500 | data->beep_mask &= 0x8000; /* preserve beep enable */ | 512 | data->beep_mask &= 0x8000; /* preserve beep enable */ |
@@ -529,10 +541,14 @@ store_beep(struct device *dev, struct device_attribute *attr, | |||
529 | { | 541 | { |
530 | struct w83781d_data *data = dev_get_drvdata(dev); | 542 | struct w83781d_data *data = dev_get_drvdata(dev); |
531 | int bitnr = to_sensor_dev_attr(attr)->index; | 543 | int bitnr = to_sensor_dev_attr(attr)->index; |
532 | unsigned long bit; | ||
533 | u8 reg; | 544 | u8 reg; |
545 | unsigned long bit; | ||
546 | int err; | ||
547 | |||
548 | err = kstrtoul(buf, 10, &bit); | ||
549 | if (err) | ||
550 | return err; | ||
534 | 551 | ||
535 | bit = simple_strtoul(buf, NULL, 10); | ||
536 | if (bit & ~1) | 552 | if (bit & ~1) |
537 | return -EINVAL; | 553 | return -EINVAL; |
538 | 554 | ||
@@ -633,7 +649,12 @@ store_fan_div(struct device *dev, struct device_attribute *da, | |||
633 | unsigned long min; | 649 | unsigned long min; |
634 | int nr = attr->index; | 650 | int nr = attr->index; |
635 | u8 reg; | 651 | u8 reg; |
636 | unsigned long val = simple_strtoul(buf, NULL, 10); | 652 | unsigned long val; |
653 | int err; | ||
654 | |||
655 | err = kstrtoul(buf, 10, &val); | ||
656 | if (err) | ||
657 | return err; | ||
637 | 658 | ||
638 | mutex_lock(&data->update_lock); | 659 | mutex_lock(&data->update_lock); |
639 | 660 | ||
@@ -643,10 +664,12 @@ store_fan_div(struct device *dev, struct device_attribute *da, | |||
643 | 664 | ||
644 | data->fan_div[nr] = DIV_TO_REG(val, data->type); | 665 | data->fan_div[nr] = DIV_TO_REG(val, data->type); |
645 | 666 | ||
646 | reg = (w83781d_read_value(data, nr==2 ? W83781D_REG_PIN : W83781D_REG_VID_FANDIV) | 667 | reg = (w83781d_read_value(data, nr == 2 ? |
647 | & (nr==0 ? 0xcf : 0x3f)) | 668 | W83781D_REG_PIN : W83781D_REG_VID_FANDIV) |
648 | | ((data->fan_div[nr] & 0x03) << (nr==0 ? 4 : 6)); | 669 | & (nr == 0 ? 0xcf : 0x3f)) |
649 | w83781d_write_value(data, nr==2 ? W83781D_REG_PIN : W83781D_REG_VID_FANDIV, reg); | 670 | | ((data->fan_div[nr] & 0x03) << (nr == 0 ? 4 : 6)); |
671 | w83781d_write_value(data, nr == 2 ? | ||
672 | W83781D_REG_PIN : W83781D_REG_VID_FANDIV, reg); | ||
650 | 673 | ||
651 | /* w83781d and as99127f don't have extended divisor bits */ | 674 | /* w83781d and as99127f don't have extended divisor bits */ |
652 | if (data->type != w83781d && data->type != as99127f) { | 675 | if (data->type != w83781d && data->type != as99127f) { |
@@ -693,9 +716,12 @@ store_pwm(struct device *dev, struct device_attribute *da, const char *buf, | |||
693 | struct sensor_device_attribute *attr = to_sensor_dev_attr(da); | 716 | struct sensor_device_attribute *attr = to_sensor_dev_attr(da); |
694 | struct w83781d_data *data = dev_get_drvdata(dev); | 717 | struct w83781d_data *data = dev_get_drvdata(dev); |
695 | int nr = attr->index; | 718 | int nr = attr->index; |
696 | u32 val; | 719 | unsigned long val; |
720 | int err; | ||
697 | 721 | ||
698 | val = simple_strtoul(buf, NULL, 10); | 722 | err = kstrtoul(buf, 10, &val); |
723 | if (err) | ||
724 | return err; | ||
699 | 725 | ||
700 | mutex_lock(&data->update_lock); | 726 | mutex_lock(&data->update_lock); |
701 | data->pwm[nr] = SENSORS_LIMIT(val, 0, 255); | 727 | data->pwm[nr] = SENSORS_LIMIT(val, 0, 255); |
@@ -709,9 +735,13 @@ store_pwm2_enable(struct device *dev, struct device_attribute *da, | |||
709 | const char *buf, size_t count) | 735 | const char *buf, size_t count) |
710 | { | 736 | { |
711 | struct w83781d_data *data = dev_get_drvdata(dev); | 737 | struct w83781d_data *data = dev_get_drvdata(dev); |
712 | u32 val, reg; | 738 | unsigned long val; |
739 | u32 reg; | ||
740 | int err; | ||
713 | 741 | ||
714 | val = simple_strtoul(buf, NULL, 10); | 742 | err = kstrtoul(buf, 10, &val); |
743 | if (err) | ||
744 | return err; | ||
715 | 745 | ||
716 | mutex_lock(&data->update_lock); | 746 | mutex_lock(&data->update_lock); |
717 | 747 | ||
@@ -761,9 +791,13 @@ store_sensor(struct device *dev, struct device_attribute *da, | |||
761 | struct sensor_device_attribute *attr = to_sensor_dev_attr(da); | 791 | struct sensor_device_attribute *attr = to_sensor_dev_attr(da); |
762 | struct w83781d_data *data = dev_get_drvdata(dev); | 792 | struct w83781d_data *data = dev_get_drvdata(dev); |
763 | int nr = attr->index; | 793 | int nr = attr->index; |
764 | u32 val, tmp; | 794 | unsigned long val; |
795 | u32 tmp; | ||
796 | int err; | ||
765 | 797 | ||
766 | val = simple_strtoul(buf, NULL, 10); | 798 | err = kstrtoul(buf, 10, &val); |
799 | if (err) | ||
800 | return err; | ||
767 | 801 | ||
768 | mutex_lock(&data->update_lock); | 802 | mutex_lock(&data->update_lock); |
769 | 803 | ||
@@ -911,7 +945,7 @@ ERROR_SC_1: | |||
911 | &sensor_dev_attr_temp##X##_alarm.dev_attr.attr, \ | 945 | &sensor_dev_attr_temp##X##_alarm.dev_attr.attr, \ |
912 | &sensor_dev_attr_temp##X##_beep.dev_attr.attr | 946 | &sensor_dev_attr_temp##X##_beep.dev_attr.attr |
913 | 947 | ||
914 | static struct attribute* w83781d_attributes[] = { | 948 | static struct attribute *w83781d_attributes[] = { |
915 | IN_UNIT_ATTRS(0), | 949 | IN_UNIT_ATTRS(0), |
916 | IN_UNIT_ATTRS(2), | 950 | IN_UNIT_ATTRS(2), |
917 | IN_UNIT_ATTRS(3), | 951 | IN_UNIT_ATTRS(3), |
@@ -959,7 +993,8 @@ w83781d_create_files(struct device *dev, int kind, int is_isa) | |||
959 | { | 993 | { |
960 | int err; | 994 | int err; |
961 | 995 | ||
962 | if ((err = sysfs_create_group(&dev->kobj, &w83781d_group))) | 996 | err = sysfs_create_group(&dev->kobj, &w83781d_group); |
997 | if (err) | ||
963 | return err; | 998 | return err; |
964 | 999 | ||
965 | if (kind != w83783s) { | 1000 | if (kind != w83783s) { |
@@ -1043,8 +1078,9 @@ w83781d_create_files(struct device *dev, int kind, int is_isa) | |||
1043 | &sensor_dev_attr_temp2_type.dev_attr))) | 1078 | &sensor_dev_attr_temp2_type.dev_attr))) |
1044 | return err; | 1079 | return err; |
1045 | if (kind != w83783s) { | 1080 | if (kind != w83783s) { |
1046 | if ((err = device_create_file(dev, | 1081 | err = device_create_file(dev, |
1047 | &sensor_dev_attr_temp3_type.dev_attr))) | 1082 | &sensor_dev_attr_temp3_type.dev_attr); |
1083 | if (err) | ||
1048 | return err; | 1084 | return err; |
1049 | } | 1085 | } |
1050 | } | 1086 | } |
@@ -1083,7 +1119,7 @@ w83781d_detect(struct i2c_client *client, struct i2c_board_info *info) | |||
1083 | /* Check for Winbond or Asus ID if in bank 0 */ | 1119 | /* Check for Winbond or Asus ID if in bank 0 */ |
1084 | if (!(val1 & 0x07) && | 1120 | if (!(val1 & 0x07) && |
1085 | ((!(val1 & 0x80) && val2 != 0xa3 && val2 != 0xc3) || | 1121 | ((!(val1 & 0x80) && val2 != 0xa3 && val2 != 0xc3) || |
1086 | ( (val1 & 0x80) && val2 != 0x5c && val2 != 0x12))) { | 1122 | ((val1 & 0x80) && val2 != 0x5c && val2 != 0x12))) { |
1087 | dev_dbg(&adapter->dev, | 1123 | dev_dbg(&adapter->dev, |
1088 | "Detection of w83781d chip failed at step 4\n"); | 1124 | "Detection of w83781d chip failed at step 4\n"); |
1089 | goto err_nodev; | 1125 | goto err_nodev; |
@@ -1091,7 +1127,7 @@ w83781d_detect(struct i2c_client *client, struct i2c_board_info *info) | |||
1091 | /* If Winbond SMBus, check address at 0x48. | 1127 | /* If Winbond SMBus, check address at 0x48. |
1092 | Asus doesn't support, except for as99127f rev.2 */ | 1128 | Asus doesn't support, except for as99127f rev.2 */ |
1093 | if ((!(val1 & 0x80) && val2 == 0xa3) || | 1129 | if ((!(val1 & 0x80) && val2 == 0xa3) || |
1094 | ( (val1 & 0x80) && val2 == 0x5c)) { | 1130 | ((val1 & 0x80) && val2 == 0x5c)) { |
1095 | if (i2c_smbus_read_byte_data(client, W83781D_REG_I2C_ADDR) | 1131 | if (i2c_smbus_read_byte_data(client, W83781D_REG_I2C_ADDR) |
1096 | != address) { | 1132 | != address) { |
1097 | dev_dbg(&adapter->dev, | 1133 | dev_dbg(&adapter->dev, |
@@ -1331,9 +1367,11 @@ w83781d_init_device(struct device *dev) | |||
1331 | This saves FAN 1/2/3 input/output values set by BIOS. */ | 1367 | This saves FAN 1/2/3 input/output values set by BIOS. */ |
1332 | w83781d_write_value(data, W83781D_REG_BEEP_CONFIG, i | 0x80); | 1368 | w83781d_write_value(data, W83781D_REG_BEEP_CONFIG, i | 0x80); |
1333 | w83781d_write_value(data, W83781D_REG_PWMCLK12, p); | 1369 | w83781d_write_value(data, W83781D_REG_PWMCLK12, p); |
1334 | /* Disable master beep-enable (reset turns it on). | 1370 | /* |
1335 | Individual beep_mask should be reset to off but for some reason | 1371 | * Disable master beep-enable (reset turns it on). |
1336 | disabling this bit helps some people not get beeped */ | 1372 | * Individual beep_mask should be reset to off but for some |
1373 | * reason disabling this bit helps some people not get beeped | ||
1374 | */ | ||
1337 | w83781d_write_value(data, W83781D_REG_BEEP_INTS2, 0); | 1375 | w83781d_write_value(data, W83781D_REG_BEEP_INTS2, 0); |
1338 | } | 1376 | } |
1339 | 1377 | ||
@@ -1444,7 +1482,7 @@ static struct w83781d_data *w83781d_update_device(struct device *dev) | |||
1444 | } | 1482 | } |
1445 | /* Only PWM2 can be disabled */ | 1483 | /* Only PWM2 can be disabled */ |
1446 | data->pwm2_enable = (w83781d_read_value(data, | 1484 | data->pwm2_enable = (w83781d_read_value(data, |
1447 | W83781D_REG_PWMCLK12) & 0x08) >> 3; | 1485 | W83781D_REG_PWMCLK12) & 0x08) >> 3; |
1448 | } | 1486 | } |
1449 | 1487 | ||
1450 | data->temp = w83781d_read_value(data, W83781D_REG_TEMP(1)); | 1488 | data->temp = w83781d_read_value(data, W83781D_REG_TEMP(1)); |