aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon
diff options
context:
space:
mode:
authorJean Delvare <khali@linux-fr.org>2010-10-28 14:31:49 -0400
committerJean Delvare <khali@endymion.delvare>2010-10-28 14:31:49 -0400
commiteb02755a50f8f3508030b311e3788426fbdc23b7 (patch)
tree689aa8b124d7209b53b7c14bc93680e312620720 /drivers/hwmon
parent5d2cd958f777e533fa2809527836996f59b2d823 (diff)
hwmon: (w83795) More style cleanups
Cleanups suggested by Guenter Roeck, falling into 4 categories: * Swapping test orders, because if (var == CONSTANT) is much easier to read than if (CONSTANT == var). * Simplifying comparisons with 0. * Dropping unneeded masks. * Dropping unneeded parentheses and curly braces. Signed-off-by: Jean Delvare <khali@linux-fr.org> Acked-by: Guenter Roeck <guenter.roeck@ericsson.com>
Diffstat (limited to 'drivers/hwmon')
-rw-r--r--drivers/hwmon/w83795.c28
1 files changed, 13 insertions, 15 deletions
diff --git a/drivers/hwmon/w83795.c b/drivers/hwmon/w83795.c
index 9d73768060d4..ce1e71ba6c73 100644
--- a/drivers/hwmon/w83795.c
+++ b/drivers/hwmon/w83795.c
@@ -491,7 +491,7 @@ static void w83795_update_limits(struct i2c_client *client)
491 } 491 }
492 492
493 /* Read the DTS limits */ 493 /* Read the DTS limits */
494 if (data->enable_dts != 0) { 494 if (data->enable_dts) {
495 for (limit = DTS_CRIT; limit <= DTS_WARN_HYST; limit++) 495 for (limit = DTS_CRIT; limit <= DTS_WARN_HYST; limit++)
496 data->dts_ext[limit] = 496 data->dts_ext[limit] =
497 w83795_read(client, W83795_REG_DTS_EXT(limit)); 497 w83795_read(client, W83795_REG_DTS_EXT(limit));
@@ -544,7 +544,7 @@ static struct w83795_data *w83795_update_pwm_config(struct device *dev)
544 data->pwm_temp[i][TEMP_PWM_CTFS] = 544 data->pwm_temp[i][TEMP_PWM_CTFS] =
545 w83795_read(client, W83795_REG_CTFS(i)); 545 w83795_read(client, W83795_REG_CTFS(i));
546 tmp = w83795_read(client, W83795_REG_HT(i)); 546 tmp = w83795_read(client, W83795_REG_HT(i));
547 data->pwm_temp[i][TEMP_PWM_HCT] = (tmp >> 4) & 0x0f; 547 data->pwm_temp[i][TEMP_PWM_HCT] = tmp >> 4;
548 data->pwm_temp[i][TEMP_PWM_HOT] = tmp & 0x0f; 548 data->pwm_temp[i][TEMP_PWM_HOT] = tmp & 0x0f;
549 } 549 }
550 550
@@ -618,8 +618,7 @@ static struct w83795_data *w83795_update_device(struct device *dev)
618 if (!(data->has_fan & (1 << i))) 618 if (!(data->has_fan & (1 << i)))
619 continue; 619 continue;
620 data->fan[i] = w83795_read(client, W83795_REG_FAN(i)) << 4; 620 data->fan[i] = w83795_read(client, W83795_REG_FAN(i)) << 4;
621 data->fan[i] |= 621 data->fan[i] |= w83795_read(client, W83795_REG_VRLSB) >> 4;
622 (w83795_read(client, W83795_REG_VRLSB) >> 4) & 0x0F;
623 } 622 }
624 623
625 /* Update temperature */ 624 /* Update temperature */
@@ -631,7 +630,7 @@ static struct w83795_data *w83795_update_device(struct device *dev)
631 } 630 }
632 631
633 /* Update dts temperature */ 632 /* Update dts temperature */
634 if (data->enable_dts != 0) { 633 if (data->enable_dts) {
635 for (i = 0; i < ARRAY_SIZE(data->dts); i++) { 634 for (i = 0; i < ARRAY_SIZE(data->dts); i++) {
636 if (!(data->has_dts & (1 << i))) 635 if (!(data->has_dts & (1 << i)))
637 continue; 636 continue;
@@ -677,11 +676,10 @@ show_alarm_beep(struct device *dev, struct device_attribute *attr, char *buf)
677 int bit = sensor_attr->index & 0x07; 676 int bit = sensor_attr->index & 0x07;
678 u8 val; 677 u8 val;
679 678
680 if (ALARM_STATUS == nr) { 679 if (nr == ALARM_STATUS)
681 val = (data->alarms[index] >> (bit)) & 1; 680 val = (data->alarms[index] >> bit) & 1;
682 } else { /* BEEP_ENABLE */ 681 else /* BEEP_ENABLE */
683 val = (data->beeps[index] >> (bit)) & 1; 682 val = (data->beeps[index] >> bit) & 1;
684 }
685 683
686 return sprintf(buf, "%u\n", val); 684 return sprintf(buf, "%u\n", val);
687} 685}
@@ -744,7 +742,7 @@ show_fan(struct device *dev, struct device_attribute *attr, char *buf)
744 struct w83795_data *data = w83795_update_device(dev); 742 struct w83795_data *data = w83795_update_device(dev);
745 u16 val; 743 u16 val;
746 744
747 if (FAN_INPUT == nr) 745 if (nr == FAN_INPUT)
748 val = data->fan[index] & 0x0fff; 746 val = data->fan[index] & 0x0fff;
749 else 747 else
750 val = data->fan_min[index] & 0x0fff; 748 val = data->fan_min[index] & 0x0fff;
@@ -1011,7 +1009,7 @@ store_temp_pwm_enable(struct device *dev, struct device_attribute *attr,
1011 1009
1012 switch (nr) { 1010 switch (nr) {
1013 case TEMP_PWM_ENABLE: 1011 case TEMP_PWM_ENABLE:
1014 if ((tmp != 3) && (tmp != 4)) 1012 if (tmp != 3 && tmp != 4)
1015 return -EINVAL; 1013 return -EINVAL;
1016 tmp -= 3; 1014 tmp -= 3;
1017 mutex_lock(&data->update_lock); 1015 mutex_lock(&data->update_lock);
@@ -1074,7 +1072,7 @@ store_fanin(struct device *dev, struct device_attribute *attr,
1074 switch (nr) { 1072 switch (nr) {
1075 case FANIN_TARGET: 1073 case FANIN_TARGET:
1076 val = fan_to_reg(SENSORS_LIMIT(val, 0, 0xfff)); 1074 val = fan_to_reg(SENSORS_LIMIT(val, 0, 0xfff));
1077 w83795_write(client, W83795_REG_FTSH(index), (val >> 4) & 0xff); 1075 w83795_write(client, W83795_REG_FTSH(index), val >> 4);
1078 w83795_write(client, W83795_REG_FTSL(index), (val << 4) & 0xf0); 1076 w83795_write(client, W83795_REG_FTSL(index), (val << 4) & 0xf0);
1079 data->target_speed[index] = val; 1077 data->target_speed[index] = val;
1080 break; 1078 break;
@@ -1234,7 +1232,7 @@ show_temp(struct device *dev, struct device_attribute *attr, char *buf)
1234 struct w83795_data *data = w83795_update_device(dev); 1232 struct w83795_data *data = w83795_update_device(dev);
1235 long temp = temp_from_reg(data->temp[index][nr]); 1233 long temp = temp_from_reg(data->temp[index][nr]);
1236 1234
1237 if (TEMP_READ == nr) 1235 if (nr == TEMP_READ)
1238 temp += (data->temp_read_vrlsb[index] >> 6) * 250; 1236 temp += (data->temp_read_vrlsb[index] >> 6) * 250;
1239 return sprintf(buf, "%ld\n", temp); 1237 return sprintf(buf, "%ld\n", temp);
1240} 1238}
@@ -1891,7 +1889,7 @@ static int w83795_handle_files(struct device *dev, int (*fn)(struct device *,
1891 } 1889 }
1892 } 1890 }
1893 1891
1894 if (data->enable_dts != 0) { 1892 if (data->enable_dts) {
1895 for (i = 0; i < ARRAY_SIZE(w83795_dts); i++) { 1893 for (i = 0; i < ARRAY_SIZE(w83795_dts); i++) {
1896 if (!(data->has_dts & (1 << i))) 1894 if (!(data->has_dts & (1 << i)))
1897 continue; 1895 continue;