Skip to content

Commit 3f4f09b

Browse files
author
Jean Delvare
committed
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
1 parent d883b9f commit 3f4f09b

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

‎drivers/hwmon/coretemp.c‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ struct coretemp_data {
5353
struct mutex update_lock;
5454
const char *name;
5555
u32 id;
56+
u16 core_id;
5657
char valid; /* zero until following fields are valid */
5758
unsigned long last_updated; /* in jiffies */
5859
int temp;
@@ -75,7 +76,7 @@ static ssize_t show_name(struct device *dev, struct device_attribute
7576
if (attr->index == SHOW_NAME)
7677
ret = sprintf(buf, "%s\n", data->name);
7778
else /* show label */
78-
ret = sprintf(buf, "Core %d\n", data->id);
79+
ret = sprintf(buf, "Core %d\n", data->core_id);
7980
return ret;
8081
}
8182

@@ -304,6 +305,9 @@ static int __devinit coretemp_probe(struct platform_device *pdev)
304305
}
305306

306307
data->id = pdev->id;
308+
#ifdef CONFIG_SMP
309+
data->core_id = c->cpu_core_id;
310+
#endif
307311
data->name = "coretemp";
308312
mutex_init(&data->update_lock);
309313

0 commit comments

Comments
 (0)