tg3: Fix temperature reporting
authorJean Delvare <jdelvare@suse.de>
Tue, 1 Sep 2015 16:07:41 +0000 (18:07 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 1 Oct 2015 10:07:28 +0000 (12:07 +0200)
commit d3d11fe08ccc9bff174fc958722b5661f0932486 upstream.

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>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/ethernet/broadcom/tg3.c

index 680d26d6d2c308a3314b8b3c78ec7b356d65a74d..518cc4b6c7ddcb900b80c485ba754b7597fa0be4 100644 (file)
@@ -10518,7 +10518,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);
 }