hwmon: (coretemp) Properly label the sensors
Don't assume that CPU entry number and core ID always match. It worked in the simple cases (single CPU, no HT) but fails on multi-CPU systems. Signed-off-by: Jean Delvare <khali@linux-fr.org> Acked-by: Huaxu Wan <huaxu.wan@intel.com> Cc: stable@kernel.org
This commit is contained in:
parent
d883b9f097
commit
3f4f09b4be
|
@ -53,6 +53,7 @@ struct coretemp_data {
|
||||||
struct mutex update_lock;
|
struct mutex update_lock;
|
||||||
const char *name;
|
const char *name;
|
||||||
u32 id;
|
u32 id;
|
||||||
|
u16 core_id;
|
||||||
char valid; /* zero until following fields are valid */
|
char valid; /* zero until following fields are valid */
|
||||||
unsigned long last_updated; /* in jiffies */
|
unsigned long last_updated; /* in jiffies */
|
||||||
int temp;
|
int temp;
|
||||||
|
@ -75,7 +76,7 @@ static ssize_t show_name(struct device *dev, struct device_attribute
|
||||||
if (attr->index == SHOW_NAME)
|
if (attr->index == SHOW_NAME)
|
||||||
ret = sprintf(buf, "%s\n", data->name);
|
ret = sprintf(buf, "%s\n", data->name);
|
||||||
else /* show label */
|
else /* show label */
|
||||||
ret = sprintf(buf, "Core %d\n", data->id);
|
ret = sprintf(buf, "Core %d\n", data->core_id);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -304,6 +305,9 @@ static int __devinit coretemp_probe(struct platform_device *pdev)
|
||||||
}
|
}
|
||||||
|
|
||||||
data->id = pdev->id;
|
data->id = pdev->id;
|
||||||
|
#ifdef CONFIG_SMP
|
||||||
|
data->core_id = c->cpu_core_id;
|
||||||
|
#endif
|
||||||
data->name = "coretemp";
|
data->name = "coretemp";
|
||||||
mutex_init(&data->update_lock);
|
mutex_init(&data->update_lock);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue