All of lore.kernel.org
 help / color / mirror / Atom feed
* [lm-sensors] [PATCH] hwmon: (coretemp) Initialize tmin
@ 2011-09-14  8:43 Jean Delvare
  2011-09-14 11:15 ` Guenter Roeck
  0 siblings, 1 reply; 2+ messages in thread
From: Jean Delvare @ 2011-09-14  8:43 UTC (permalink / raw)
  To: lm-sensors

ttarget is initialized when the driver is loaded, but tmin is not.
As a result, tempX_max_hyst attributes read 0. Fix this.

Also use THERM_*_THRESHOLD* constants in these initializations instead
of hard-coding the constants.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Cc: "R, Durgadoss" <durgadoss.r@intel.com>
Cc: Guenter Roeck <guenter.roeck@ericsson.com>
Cc: Fenghua Yu <fenghua.yu@intel.com>
---
 drivers/hwmon/coretemp.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

--- linux-3.1-rc4.orig/drivers/hwmon/coretemp.c	2011-08-23 21:34:44.000000000 +0200
+++ linux-3.1-rc4/drivers/hwmon/coretemp.c	2011-09-14 09:32:11.000000000 +0200
@@ -601,7 +601,12 @@ static int create_core_data(struct platf
 	err = rdmsr_safe_on_cpu(cpu, tdata->intrpt_reg, &eax, &edx);
 	if (!err) {
 		tdata->attr_size += MAX_THRESH_ATTRS;
-		tdata->ttarget = tdata->tjmax - ((eax >> 16) & 0x7f) * 1000;
+		tdata->tmin = tdata->tjmax -
+			      ((eax & THERM_MASK_THRESHOLD0) >>
+			       THERM_SHIFT_THRESHOLD0) * 1000;
+		tdata->ttarget = tdata->tjmax -
+				 ((eax & THERM_MASK_THRESHOLD1) >>
+				  THERM_SHIFT_THRESHOLD1) * 1000;
 	}
 
 	pdata->core_data[attr_no] = tdata;


-- 
Jean Delvare

_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

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

* Re: [lm-sensors] [PATCH] hwmon: (coretemp) Initialize tmin
  2011-09-14  8:43 [lm-sensors] [PATCH] hwmon: (coretemp) Initialize tmin Jean Delvare
@ 2011-09-14 11:15 ` Guenter Roeck
  0 siblings, 0 replies; 2+ messages in thread
From: Guenter Roeck @ 2011-09-14 11:15 UTC (permalink / raw)
  To: lm-sensors

On Wed, Sep 14, 2011 at 04:43:07AM -0400, Jean Delvare wrote:
> ttarget is initialized when the driver is loaded, but tmin is not.
> As a result, tempX_max_hyst attributes read 0. Fix this.
> 
> Also use THERM_*_THRESHOLD* constants in these initializations instead
> of hard-coding the constants.
> 
> Signed-off-by: Jean Delvare <khali@linux-fr.org>
> Cc: "R, Durgadoss" <durgadoss.r@intel.com>
> Cc: Guenter Roeck <guenter.roeck@ericsson.com>
> Cc: Fenghua Yu <fenghua.yu@intel.com>

Works nicely. Applied.

Thanks a lot for looking into this.

Guenter

_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

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

end of thread, other threads:[~2011-09-14 11:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-14  8:43 [lm-sensors] [PATCH] hwmon: (coretemp) Initialize tmin Jean Delvare
2011-09-14 11:15 ` Guenter Roeck

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.