aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/w83795.c
diff options
context:
space:
mode:
authorJean Delvare <khali@linux-fr.org>2010-10-28 14:31:46 -0400
committerJean Delvare <khali@endymion.delvare>2010-10-28 14:31:46 -0400
commit6c82b2f3fb31e43a9b898769afd2151ca64986a4 (patch)
tree1315014b74cc4ea9cea40c7fc8bf60f7826cca3d /drivers/hwmon/w83795.c
parent71caf46fbf39207a324a16ddb6d8ef37c05777b9 (diff)
hwmon: (w83795) Fix LSB reading of fan speeds
Misplaced parentheses caused the wrong register value to be read, resulting in random LSB for fan speed values and limits. Signed-off-by: Jean Delvare <khali@linux-fr.org>
Diffstat (limited to 'drivers/hwmon/w83795.c')
-rw-r--r--drivers/hwmon/w83795.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/hwmon/w83795.c b/drivers/hwmon/w83795.c
index b797b9ce2907..24e44245e548 100644
--- a/drivers/hwmon/w83795.c
+++ b/drivers/hwmon/w83795.c
@@ -272,7 +272,7 @@ static inline u16 in_to_reg(u8 index, u16 val)
272 272
273static inline unsigned long fan_from_reg(u16 val) 273static inline unsigned long fan_from_reg(u16 val)
274{ 274{
275 if ((val >= 0xff0) || (val == 0)) 275 if ((val == 0xfff) || (val == 0))
276 return 0; 276 return 0;
277 return 1350000UL / val; 277 return 1350000UL / val;
278} 278}
@@ -456,7 +456,7 @@ static struct w83795_data *w83795_update_device(struct device *dev)
456 continue; 456 continue;
457 data->fan[i] = w83795_read(client, W83795_REG_FAN(i)) << 4; 457 data->fan[i] = w83795_read(client, W83795_REG_FAN(i)) << 4;
458 data->fan[i] |= 458 data->fan[i] |=
459 (w83795_read(client, W83795_REG_VRLSB >> 4)) & 0x0F; 459 (w83795_read(client, W83795_REG_VRLSB) >> 4) & 0x0F;
460 } 460 }
461 461
462 /* Update temperature */ 462 /* Update temperature */
@@ -1940,11 +1940,11 @@ static int w83795_probe(struct i2c_client *client,
1940 data->fan_min[i] = 1940 data->fan_min[i] =
1941 w83795_read(client, W83795_REG_FAN_MIN_HL(i)) << 4; 1941 w83795_read(client, W83795_REG_FAN_MIN_HL(i)) << 4;
1942 data->fan_min[i] |= 1942 data->fan_min[i] |=
1943 (w83795_read(client, W83795_REG_FAN_MIN_LSB(i) >> 1943 (w83795_read(client, W83795_REG_FAN_MIN_LSB(i)) >>
1944 W83795_REG_FAN_MIN_LSB_SHIFT(i))) & 0x0F; 1944 W83795_REG_FAN_MIN_LSB_SHIFT(i)) & 0x0F;
1945 data->fan[i] = w83795_read(client, W83795_REG_FAN(i)) << 4; 1945 data->fan[i] = w83795_read(client, W83795_REG_FAN(i)) << 4;
1946 data->fan[i] |= 1946 data->fan[i] |=
1947 (w83795_read(client, W83795_REG_VRLSB >> 4)) & 0x0F; 1947 (w83795_read(client, W83795_REG_VRLSB) >> 4) & 0x0F;
1948 } 1948 }
1949 1949
1950 /* temperature and limits */ 1950 /* temperature and limits */