aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon
diff options
context:
space:
mode:
authorJean Delvare <khali@linux-fr.org>2010-10-28 14:31:47 -0400
committerJean Delvare <khali@endymion.delvare>2010-10-28 14:31:47 -0400
commita654b9d4e7152b06557e2f22bcf0a245bc88bc98 (patch)
treea4b6ec7627b17ecfc37eb700d2ba29fa10a52d74 /drivers/hwmon
parentc1a792a6eea42d88a99e6ace215b22fbdb76c7b6 (diff)
hwmon: (w83795) Get rid of VRLSB_SHIFT
VRLSB_SHIFT is a non-sense, the actual shift depends on the sensor type (fans need 4, other sensors need 6). Get rid of it to prevent any confusion. Also get rid of the useless masking, the meaningful bits are always the MSb so there's nothing to mask out after shifting. Signed-off-by: Jean Delvare <khali@linux-fr.org>
Diffstat (limited to 'drivers/hwmon')
-rw-r--r--drivers/hwmon/w83795.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/drivers/hwmon/w83795.c b/drivers/hwmon/w83795.c
index aea3275f5dae..71b7a254beeb 100644
--- a/drivers/hwmon/w83795.c
+++ b/drivers/hwmon/w83795.c
@@ -127,7 +127,6 @@ static const u16 W83795_REG_IN[][3] = {
127 {0x24, 0xa2, 0xa3}, /* VSEN17 */ 127 {0x24, 0xa2, 0xa3}, /* VSEN17 */
128}; 128};
129#define W83795_REG_VRLSB 0x3C 129#define W83795_REG_VRLSB 0x3C
130#define VRLSB_SHIFT 6
131 130
132static const u8 W83795_REG_IN_HL_LSB[] = { 131static const u8 W83795_REG_IN_HL_LSB[] = {
133 0x8e, /* VSEN1-4 */ 132 0x8e, /* VSEN1-4 */
@@ -485,8 +484,7 @@ static struct w83795_data *w83795_update_device(struct device *dev)
485 if (!(data->has_in & (1 << i))) 484 if (!(data->has_in & (1 << i)))
486 continue; 485 continue;
487 tmp = w83795_read(client, W83795_REG_IN[i][IN_READ]) << 2; 486 tmp = w83795_read(client, W83795_REG_IN[i][IN_READ]) << 2;
488 tmp |= (w83795_read(client, W83795_REG_VRLSB) 487 tmp |= w83795_read(client, W83795_REG_VRLSB) >> 6;
489 >> VRLSB_SHIFT) & 0x03;
490 data->in[i][IN_READ] = tmp; 488 data->in[i][IN_READ] = tmp;
491 } 489 }
492 490
@@ -1140,8 +1138,7 @@ show_temp(struct device *dev, struct device_attribute *attr, char *buf)
1140 long temp = temp_from_reg(data->temp[index][nr]); 1138 long temp = temp_from_reg(data->temp[index][nr]);
1141 1139
1142 if (TEMP_READ == nr) 1140 if (TEMP_READ == nr)
1143 temp += ((data->temp_read_vrlsb[index] >> VRLSB_SHIFT) & 0x03) 1141 temp += (data->temp_read_vrlsb[index] >> 6) * 250;
1144 * 250;
1145 return sprintf(buf, "%ld\n", temp); 1142 return sprintf(buf, "%ld\n", temp);
1146} 1143}
1147 1144
@@ -1202,7 +1199,7 @@ show_dts(struct device *dev, struct device_attribute *attr, char *buf)
1202 struct w83795_data *data = w83795_update_device(dev); 1199 struct w83795_data *data = w83795_update_device(dev);
1203 long temp = temp_from_reg(data->dts[index]); 1200 long temp = temp_from_reg(data->dts[index]);
1204 1201
1205 temp += ((data->dts_read_vrlsb[index] >> VRLSB_SHIFT) & 0x03) * 250; 1202 temp += (data->dts_read_vrlsb[index] >> 6) * 250;
1206 return sprintf(buf, "%ld\n", temp); 1203 return sprintf(buf, "%ld\n", temp);
1207} 1204}
1208 1205
@@ -1981,8 +1978,7 @@ static int w83795_probe(struct i2c_client *client,
1981 data->in[i][IN_LOW] = 1978 data->in[i][IN_LOW] =
1982 w83795_read(client, W83795_REG_IN[i][IN_LOW]); 1979 w83795_read(client, W83795_REG_IN[i][IN_LOW]);
1983 tmp = w83795_read(client, W83795_REG_IN[i][IN_READ]) << 2; 1980 tmp = w83795_read(client, W83795_REG_IN[i][IN_READ]) << 2;
1984 tmp |= (w83795_read(client, W83795_REG_VRLSB) 1981 tmp |= w83795_read(client, W83795_REG_VRLSB) >> 6;
1985 >> VRLSB_SHIFT) & 0x03;
1986 data->in[i][IN_READ] = tmp; 1982 data->in[i][IN_READ] = tmp;
1987 } 1983 }
1988 for (i = 0; i < IN_LSB_REG_NUM; i++) { 1984 for (i = 0; i < IN_LSB_REG_NUM; i++) {
@@ -2010,8 +2006,7 @@ static int w83795_probe(struct i2c_client *client,
2010 data->fan_min[i] |= 2006 data->fan_min[i] |=
2011 (tmp >> W83795_REG_FAN_MIN_LSB_SHIFT(i)) & 0x0F; 2007 (tmp >> W83795_REG_FAN_MIN_LSB_SHIFT(i)) & 0x0F;
2012 data->fan[i] = w83795_read(client, W83795_REG_FAN(i)) << 4; 2008 data->fan[i] = w83795_read(client, W83795_REG_FAN(i)) << 4;
2013 data->fan[i] |= 2009 data->fan[i] |= w83795_read(client, W83795_REG_VRLSB) >> 4;
2014 (w83795_read(client, W83795_REG_VRLSB) >> 4) & 0x0F;
2015 } 2010 }
2016 2011
2017 /* temperature and limits */ 2012 /* temperature and limits */