hwmon: (coretemp) Initialize tmin
authorJean Delvare <khali@linux-fr.org>
Wed, 14 Sep 2011 08:43:07 +0000 (04:43 -0400)
committerGuenter Roeck <guenter.roeck@ericsson.com>
Wed, 14 Sep 2011 10:55:05 +0000 (03:55 -0700)
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>
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
drivers/hwmon/coretemp.c

index 59d83e83da7fe0b5de39f7ce6e001899babfb7be..4112576761330fe7af5c9ee26f8715e6c4a8bc73 100644 (file)
@@ -601,7 +601,12 @@ static int create_core_data(struct platform_data *pdata,
        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;