tg3: Fix temperature reporting
authorJean Delvare <jdelvare@suse.de>
Tue, 1 Sep 2015 16:07:41 +0000 (18:07 +0200)
committerDavid S. Miller <davem@davemloft.net>
Tue, 1 Sep 2015 22:03:59 +0000 (15:03 -0700)
The temperature registers appear to report values in degrees Celsius
while the hwmon API mandates values to be exposed in millidegrees
Celsius. Do the conversion so that the values reported by "sensors"
are correct.

Fixes: aed93e0bf493 ("tg3: Add hwmon support for temperature")
Signed-off-by: Jean Delvare <jdelvare@suse.de>
Cc: Prashant Sreedharan <prashant@broadcom.com>
Cc: Michael Chan <mchan@broadcom.com>
Cc: stable@vger.kernel.org [v3.6+]
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/broadcom/tg3.c

index 73c934cf6c61c28dc43f8d7e20a7f718a1067236..79789d8e52da3e7aba39acdb4be1ddcae1baaa9e 100644 (file)
@@ -10757,7 +10757,7 @@ static ssize_t tg3_show_temp(struct device *dev,
        tg3_ape_scratchpad_read(tp, &temperature, attr->index,
                                sizeof(temperature));
        spin_unlock_bh(&tp->lock);
-       return sprintf(buf, "%u\n", temperature);
+       return sprintf(buf, "%u\n", temperature * 1000);
 }