diff options
author | Guenter Roeck <linux@roeck-us.net> | 2012-01-14 15:40:05 -0500 |
---|---|---|
committer | Guenter Roeck <guenter.roeck@ericsson.com> | 2012-03-18 21:26:45 -0400 |
commit | 79738416f6016198aef64a772d94ce50fe8b0f5c (patch) | |
tree | aae326c0080052526d23fd5131875866b18a8594 /drivers | |
parent | 65fe5c79577f181909a13500106027efd05db19a (diff) |
hwmon: (abituguru3) Fix checkpatch issues
Fixed:
ERROR: do not use assignment in if condition
ERROR: "foo* bar" should be "foo *bar"
WARNING: line over 80 characters
Not fixed:
WARNING: msleep < 20ms can sleep for up to 20ms
Cc: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Robert Coulson <robert.coulson@ericsson.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/hwmon/abituguru3.c | 56 |
1 files changed, 35 insertions, 21 deletions
diff --git a/drivers/hwmon/abituguru3.c b/drivers/hwmon/abituguru3.c index 34a14a77e008..93ab1a5001c7 100644 --- a/drivers/hwmon/abituguru3.c +++ b/drivers/hwmon/abituguru3.c | |||
@@ -80,7 +80,8 @@ | |||
80 | #define ABIT_UGURU3_MAX_NO_SENSORS 26 | 80 | #define ABIT_UGURU3_MAX_NO_SENSORS 26 |
81 | /* sum of strlen +1 of: in??_input\0, in??_{min,max}\0, in??_{min,max}_alarm\0, | 81 | /* sum of strlen +1 of: in??_input\0, in??_{min,max}\0, in??_{min,max}_alarm\0, |
82 | in??_{min,max}_alarm_enable\0, in??_beep\0, in??_shutdown\0, in??_label\0 */ | 82 | in??_{min,max}_alarm_enable\0, in??_beep\0, in??_shutdown\0, in??_label\0 */ |
83 | #define ABIT_UGURU3_IN_NAMES_LENGTH (11 + 2 * 9 + 2 * 15 + 2 * 22 + 10 + 14 + 11) | 83 | #define ABIT_UGURU3_IN_NAMES_LENGTH \ |
84 | (11 + 2 * 9 + 2 * 15 + 2 * 22 + 10 + 14 + 11) | ||
84 | /* sum of strlen +1 of: temp??_input\0, temp??_max\0, temp??_crit\0, | 85 | /* sum of strlen +1 of: temp??_input\0, temp??_max\0, temp??_crit\0, |
85 | temp??_alarm\0, temp??_alarm_enable\0, temp??_beep\0, temp??_shutdown\0, | 86 | temp??_alarm\0, temp??_alarm_enable\0, temp??_beep\0, temp??_shutdown\0, |
86 | temp??_label\0 */ | 87 | temp??_label\0 */ |
@@ -112,7 +113,7 @@ | |||
112 | 113 | ||
113 | /* Structures */ | 114 | /* Structures */ |
114 | struct abituguru3_sensor_info { | 115 | struct abituguru3_sensor_info { |
115 | const char* name; | 116 | const char *name; |
116 | int port; | 117 | int port; |
117 | int type; | 118 | int type; |
118 | int multiplier; | 119 | int multiplier; |
@@ -659,34 +660,39 @@ static int abituguru3_synchronize(struct abituguru3_data *data) | |||
659 | { | 660 | { |
660 | int x, timeout = ABIT_UGURU3_SYNCHRONIZE_TIMEOUT; | 661 | int x, timeout = ABIT_UGURU3_SYNCHRONIZE_TIMEOUT; |
661 | 662 | ||
662 | if ((x = abituguru3_wait_while_busy(data)) != ABIT_UGURU3_SUCCESS) { | 663 | x = abituguru3_wait_while_busy(data); |
664 | if (x != ABIT_UGURU3_SUCCESS) { | ||
663 | ABIT_UGURU3_DEBUG("synchronize timeout during initial busy " | 665 | ABIT_UGURU3_DEBUG("synchronize timeout during initial busy " |
664 | "wait, status: 0x%02x\n", x); | 666 | "wait, status: 0x%02x\n", x); |
665 | return -EIO; | 667 | return -EIO; |
666 | } | 668 | } |
667 | 669 | ||
668 | outb(0x20, data->addr + ABIT_UGURU3_DATA); | 670 | outb(0x20, data->addr + ABIT_UGURU3_DATA); |
669 | if ((x = abituguru3_wait_while_busy(data)) != ABIT_UGURU3_SUCCESS) { | 671 | x = abituguru3_wait_while_busy(data); |
672 | if (x != ABIT_UGURU3_SUCCESS) { | ||
670 | ABIT_UGURU3_DEBUG("synchronize timeout after sending 0x20, " | 673 | ABIT_UGURU3_DEBUG("synchronize timeout after sending 0x20, " |
671 | "status: 0x%02x\n", x); | 674 | "status: 0x%02x\n", x); |
672 | return -EIO; | 675 | return -EIO; |
673 | } | 676 | } |
674 | 677 | ||
675 | outb(0x10, data->addr + ABIT_UGURU3_CMD); | 678 | outb(0x10, data->addr + ABIT_UGURU3_CMD); |
676 | if ((x = abituguru3_wait_while_busy(data)) != ABIT_UGURU3_SUCCESS) { | 679 | x = abituguru3_wait_while_busy(data); |
680 | if (x != ABIT_UGURU3_SUCCESS) { | ||
677 | ABIT_UGURU3_DEBUG("synchronize timeout after sending 0x10, " | 681 | ABIT_UGURU3_DEBUG("synchronize timeout after sending 0x10, " |
678 | "status: 0x%02x\n", x); | 682 | "status: 0x%02x\n", x); |
679 | return -EIO; | 683 | return -EIO; |
680 | } | 684 | } |
681 | 685 | ||
682 | outb(0x00, data->addr + ABIT_UGURU3_CMD); | 686 | outb(0x00, data->addr + ABIT_UGURU3_CMD); |
683 | if ((x = abituguru3_wait_while_busy(data)) != ABIT_UGURU3_SUCCESS) { | 687 | x = abituguru3_wait_while_busy(data); |
688 | if (x != ABIT_UGURU3_SUCCESS) { | ||
684 | ABIT_UGURU3_DEBUG("synchronize timeout after sending 0x00, " | 689 | ABIT_UGURU3_DEBUG("synchronize timeout after sending 0x00, " |
685 | "status: 0x%02x\n", x); | 690 | "status: 0x%02x\n", x); |
686 | return -EIO; | 691 | return -EIO; |
687 | } | 692 | } |
688 | 693 | ||
689 | if ((x = abituguru3_wait_for_read(data)) != ABIT_UGURU3_SUCCESS) { | 694 | x = abituguru3_wait_for_read(data); |
695 | if (x != ABIT_UGURU3_SUCCESS) { | ||
690 | ABIT_UGURU3_DEBUG("synchronize timeout waiting for read, " | 696 | ABIT_UGURU3_DEBUG("synchronize timeout waiting for read, " |
691 | "status: 0x%02x\n", x); | 697 | "status: 0x%02x\n", x); |
692 | return -EIO; | 698 | return -EIO; |
@@ -712,11 +718,13 @@ static int abituguru3_read(struct abituguru3_data *data, u8 bank, u8 offset, | |||
712 | { | 718 | { |
713 | int i, x; | 719 | int i, x; |
714 | 720 | ||
715 | if ((x = abituguru3_synchronize(data))) | 721 | x = abituguru3_synchronize(data); |
722 | if (x) | ||
716 | return x; | 723 | return x; |
717 | 724 | ||
718 | outb(0x1A, data->addr + ABIT_UGURU3_DATA); | 725 | outb(0x1A, data->addr + ABIT_UGURU3_DATA); |
719 | if ((x = abituguru3_wait_while_busy(data)) != ABIT_UGURU3_SUCCESS) { | 726 | x = abituguru3_wait_while_busy(data); |
727 | if (x != ABIT_UGURU3_SUCCESS) { | ||
720 | ABIT_UGURU3_DEBUG("read from 0x%02x:0x%02x timed out after " | 728 | ABIT_UGURU3_DEBUG("read from 0x%02x:0x%02x timed out after " |
721 | "sending 0x1A, status: 0x%02x\n", (unsigned int)bank, | 729 | "sending 0x1A, status: 0x%02x\n", (unsigned int)bank, |
722 | (unsigned int)offset, x); | 730 | (unsigned int)offset, x); |
@@ -724,7 +732,8 @@ static int abituguru3_read(struct abituguru3_data *data, u8 bank, u8 offset, | |||
724 | } | 732 | } |
725 | 733 | ||
726 | outb(bank, data->addr + ABIT_UGURU3_CMD); | 734 | outb(bank, data->addr + ABIT_UGURU3_CMD); |
727 | if ((x = abituguru3_wait_while_busy(data)) != ABIT_UGURU3_SUCCESS) { | 735 | x = abituguru3_wait_while_busy(data); |
736 | if (x != ABIT_UGURU3_SUCCESS) { | ||
728 | ABIT_UGURU3_DEBUG("read from 0x%02x:0x%02x timed out after " | 737 | ABIT_UGURU3_DEBUG("read from 0x%02x:0x%02x timed out after " |
729 | "sending the bank, status: 0x%02x\n", | 738 | "sending the bank, status: 0x%02x\n", |
730 | (unsigned int)bank, (unsigned int)offset, x); | 739 | (unsigned int)bank, (unsigned int)offset, x); |
@@ -732,7 +741,8 @@ static int abituguru3_read(struct abituguru3_data *data, u8 bank, u8 offset, | |||
732 | } | 741 | } |
733 | 742 | ||
734 | outb(offset, data->addr + ABIT_UGURU3_CMD); | 743 | outb(offset, data->addr + ABIT_UGURU3_CMD); |
735 | if ((x = abituguru3_wait_while_busy(data)) != ABIT_UGURU3_SUCCESS) { | 744 | x = abituguru3_wait_while_busy(data); |
745 | if (x != ABIT_UGURU3_SUCCESS) { | ||
736 | ABIT_UGURU3_DEBUG("read from 0x%02x:0x%02x timed out after " | 746 | ABIT_UGURU3_DEBUG("read from 0x%02x:0x%02x timed out after " |
737 | "sending the offset, status: 0x%02x\n", | 747 | "sending the offset, status: 0x%02x\n", |
738 | (unsigned int)bank, (unsigned int)offset, x); | 748 | (unsigned int)bank, (unsigned int)offset, x); |
@@ -740,7 +750,8 @@ static int abituguru3_read(struct abituguru3_data *data, u8 bank, u8 offset, | |||
740 | } | 750 | } |
741 | 751 | ||
742 | outb(count, data->addr + ABIT_UGURU3_CMD); | 752 | outb(count, data->addr + ABIT_UGURU3_CMD); |
743 | if ((x = abituguru3_wait_while_busy(data)) != ABIT_UGURU3_SUCCESS) { | 753 | x = abituguru3_wait_while_busy(data); |
754 | if (x != ABIT_UGURU3_SUCCESS) { | ||
744 | ABIT_UGURU3_DEBUG("read from 0x%02x:0x%02x timed out after " | 755 | ABIT_UGURU3_DEBUG("read from 0x%02x:0x%02x timed out after " |
745 | "sending the count, status: 0x%02x\n", | 756 | "sending the count, status: 0x%02x\n", |
746 | (unsigned int)bank, (unsigned int)offset, x); | 757 | (unsigned int)bank, (unsigned int)offset, x); |
@@ -748,8 +759,8 @@ static int abituguru3_read(struct abituguru3_data *data, u8 bank, u8 offset, | |||
748 | } | 759 | } |
749 | 760 | ||
750 | for (i = 0; i < count; i++) { | 761 | for (i = 0; i < count; i++) { |
751 | if ((x = abituguru3_wait_for_read(data)) != | 762 | x = abituguru3_wait_for_read(data); |
752 | ABIT_UGURU3_SUCCESS) { | 763 | if (x != ABIT_UGURU3_SUCCESS) { |
753 | ABIT_UGURU3_DEBUG("timeout reading byte %d from " | 764 | ABIT_UGURU3_DEBUG("timeout reading byte %d from " |
754 | "0x%02x:0x%02x, status: 0x%02x\n", i, | 765 | "0x%02x:0x%02x, status: 0x%02x\n", i, |
755 | (unsigned int)bank, (unsigned int)offset, x); | 766 | (unsigned int)bank, (unsigned int)offset, x); |
@@ -768,13 +779,15 @@ static int abituguru3_read_increment_offset(struct abituguru3_data *data, | |||
768 | { | 779 | { |
769 | int i, x; | 780 | int i, x; |
770 | 781 | ||
771 | for (i = 0; i < offset_count; i++) | 782 | for (i = 0; i < offset_count; i++) { |
772 | if ((x = abituguru3_read(data, bank, offset + i, count, | 783 | x = abituguru3_read(data, bank, offset + i, count, |
773 | buf + i * count)) != count) { | 784 | buf + i * count); |
785 | if (x != count) { | ||
774 | if (x < 0) | 786 | if (x < 0) |
775 | return x; | 787 | return x; |
776 | return i * count + x; | 788 | return i * count + x; |
777 | } | 789 | } |
790 | } | ||
778 | 791 | ||
779 | return i * count; | 792 | return i * count; |
780 | } | 793 | } |
@@ -923,7 +936,8 @@ static int __devinit abituguru3_probe(struct platform_device *pdev) | |||
923 | u8 buf[2]; | 936 | u8 buf[2]; |
924 | u16 id; | 937 | u16 id; |
925 | 938 | ||
926 | if (!(data = kzalloc(sizeof(struct abituguru3_data), GFP_KERNEL))) | 939 | data = kzalloc(sizeof(struct abituguru3_data), GFP_KERNEL); |
940 | if (!data) | ||
927 | return -ENOMEM; | 941 | return -ENOMEM; |
928 | 942 | ||
929 | data->addr = platform_get_resource(pdev, IORESOURCE_IO, 0)->start; | 943 | data->addr = platform_get_resource(pdev, IORESOURCE_IO, 0)->start; |
@@ -931,10 +945,10 @@ static int __devinit abituguru3_probe(struct platform_device *pdev) | |||
931 | platform_set_drvdata(pdev, data); | 945 | platform_set_drvdata(pdev, data); |
932 | 946 | ||
933 | /* Read the motherboard ID */ | 947 | /* Read the motherboard ID */ |
934 | if ((i = abituguru3_read(data, ABIT_UGURU3_MISC_BANK, | 948 | i = abituguru3_read(data, ABIT_UGURU3_MISC_BANK, ABIT_UGURU3_BOARD_ID, |
935 | ABIT_UGURU3_BOARD_ID, 2, buf)) != 2) { | 949 | 2, buf); |
950 | if (i != 2) | ||
936 | goto abituguru3_probe_error; | 951 | goto abituguru3_probe_error; |
937 | } | ||
938 | 952 | ||
939 | /* Completely read the uGuru to see if one really is there */ | 953 | /* Completely read the uGuru to see if one really is there */ |
940 | if (!abituguru3_update_device(&pdev->dev)) | 954 | if (!abituguru3_update_device(&pdev->dev)) |