Skip to contentSkip to conversation

tg3: Fix temperature reporting

PATCH Applied Jean Delvare 2 participants 2 messages Sep 1, 2015

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tg3: Fix temperature reporting

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")
Cc Prashant Sreedharan <[email protected]>
Cc Michael Chan <[email protected]>
---
 drivers/net/ethernet/broadcom/tg3.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/broadcom/tg3.c +1 -1
@@ -10757,7 +10757,7 @@ static ssize_t tg3_show_temp(struct devi
 	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);
 }
 
 
Signature · 2 lines
Jean Delvare
SUSE L3 Support
maintainer Applied
#1 lore raw

From: Jean Delvare <[email protected]>
Date: Tue, 1 Sep 2015 18:07:41 +0200

Quoted 7 lines

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")

Applied, thanks.