netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] tg3: Fix temperature reporting
@ 2015-09-01 16:07 Jean Delvare
  2015-09-01 22:04 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Jean Delvare @ 2015-09-01 16:07 UTC (permalink / raw)
  To: Prashant Sreedharan, Michael Chan; +Cc: netdev

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+]
---
 drivers/net/ethernet/broadcom/tg3.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- linux-4.2.orig/drivers/net/ethernet/broadcom/tg3.c	2015-09-01 17:38:59.786648348 +0200
+++ linux-4.2/drivers/net/ethernet/broadcom/tg3.c	2015-09-01 17:47:14.237152813 +0200
@@ -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);
 }
 
 

-- 
Jean Delvare
SUSE L3 Support

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-09-01 22:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-01 16:07 [PATCH] tg3: Fix temperature reporting Jean Delvare
2015-09-01 22:04 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).