diff options
author | Jean Delvare <khali@linux-fr.org> | 2010-10-28 14:31:47 -0400 |
---|---|---|
committer | Jean Delvare <khali@endymion.delvare> | 2010-10-28 14:31:47 -0400 |
commit | 7eb8d508b5cfabbb147670ee063438469d94c465 (patch) | |
tree | d392c7c045412f8e312106aba34e7137b5bd374e /drivers/hwmon/w83795.c | |
parent | a654b9d4e7152b06557e2f22bcf0a245bc88bc98 (diff) |
hwmon: (w83795) Fix parity checks
x % 1 is obviously wrong, as it always evaluates to 0. You want
x % 2, or x & 1, for parity checking.
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Diffstat (limited to 'drivers/hwmon/w83795.c')
-rw-r--r-- | drivers/hwmon/w83795.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/hwmon/w83795.c b/drivers/hwmon/w83795.c index 71b7a254beeb..ec8a1d1f7d79 100644 --- a/drivers/hwmon/w83795.c +++ b/drivers/hwmon/w83795.c | |||
@@ -183,7 +183,7 @@ static const u8 IN_LSB_SHIFT_IDX[][2] = { | |||
183 | #define W83795_REG_FAN_MIN_HL(index) (0xB6 + (index)) | 183 | #define W83795_REG_FAN_MIN_HL(index) (0xB6 + (index)) |
184 | #define W83795_REG_FAN_MIN_LSB(index) (0xC4 + (index) / 2) | 184 | #define W83795_REG_FAN_MIN_LSB(index) (0xC4 + (index) / 2) |
185 | #define W83795_REG_FAN_MIN_LSB_SHIFT(index) \ | 185 | #define W83795_REG_FAN_MIN_LSB_SHIFT(index) \ |
186 | (((index) % 1) ? 4 : 0) | 186 | (((index) & 1) ? 4 : 0) |
187 | 187 | ||
188 | #define W83795_REG_VID_CTRL 0x6A | 188 | #define W83795_REG_VID_CTRL 0x6A |
189 | 189 | ||
@@ -670,7 +670,7 @@ store_fan_min(struct device *dev, struct device_attribute *attr, | |||
670 | data->fan_min[index] = val; | 670 | data->fan_min[index] = val; |
671 | w83795_write(client, W83795_REG_FAN_MIN_HL(index), (val >> 4) & 0xff); | 671 | w83795_write(client, W83795_REG_FAN_MIN_HL(index), (val >> 4) & 0xff); |
672 | val &= 0x0f; | 672 | val &= 0x0f; |
673 | if (index % 1) { | 673 | if (index & 1) { |
674 | val <<= 4; | 674 | val <<= 4; |
675 | val |= w83795_read(client, W83795_REG_FAN_MIN_LSB(index)) | 675 | val |= w83795_read(client, W83795_REG_FAN_MIN_LSB(index)) |
676 | & 0x0f; | 676 | & 0x0f; |
@@ -823,7 +823,7 @@ show_temp_src(struct device *dev, struct device_attribute *attr, char *buf) | |||
823 | u8 val = index / 2; | 823 | u8 val = index / 2; |
824 | u8 tmp = data->temp_src[val]; | 824 | u8 tmp = data->temp_src[val]; |
825 | 825 | ||
826 | if (index % 1) | 826 | if (index & 1) |
827 | val = 4; | 827 | val = 4; |
828 | else | 828 | else |
829 | val = 0; | 829 | val = 0; |
@@ -850,7 +850,7 @@ store_temp_src(struct device *dev, struct device_attribute *attr, | |||
850 | tmp = SENSORS_LIMIT(tmp, 0, 15); | 850 | tmp = SENSORS_LIMIT(tmp, 0, 15); |
851 | 851 | ||
852 | mutex_lock(&data->update_lock); | 852 | mutex_lock(&data->update_lock); |
853 | if (index % 1) { | 853 | if (index & 1) { |
854 | tmp <<= 4; | 854 | tmp <<= 4; |
855 | data->temp_src[val] &= 0x0f; | 855 | data->temp_src[val] &= 0x0f; |
856 | } else { | 856 | } else { |