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

+5 -1
+5 -1
drivers/hwmon/coretemp.c
··· 53 53 struct mutex update_lock; 54 54 const char *name; 55 55 u32 id; 56 + u16 core_id; 56 57 char valid; /* zero until following fields are valid */ 57 58 unsigned long last_updated; /* in jiffies */ 58 59 int temp; ··· 76 75 if (attr->index == SHOW_NAME) 77 76 ret = sprintf(buf, "%s\n", data->name); 78 77 else /* show label */ 79 - ret = sprintf(buf, "Core %d\n", data->id); 78 + ret = sprintf(buf, "Core %d\n", data->core_id); 80 79 return ret; 81 80 } 82 81 ··· 305 304 } 306 305 307 306 data->id = pdev->id; 307 + #ifdef CONFIG_SMP 308 + data->core_id = c->cpu_core_id; 309 + #endif 308 310 data->name = "coretemp"; 309 311 mutex_init(&data->update_lock); 310 312