]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
hwmon: (coretemp) Properly label the sensors
authorJean Delvare <khali@linux-fr.org>
Fri, 9 Jul 2010 14:22:51 +0000 (16:22 +0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 2 Aug 2010 17:18:49 +0000 (10:18 -0700)
commit 3f4f09b4be35d38d6e2bf22c989443e65e70fc4c upstream.

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/hwmon/coretemp.c

index 2b8f439794b9d741b9858bdd6e3e4a0c70b219d3..d73d0ba4785e3b103a7434b7ccd23b6db12d0fc7 100644 (file)
@@ -52,6 +52,7 @@ struct coretemp_data {
        struct mutex update_lock;
        const char *name;
        u32 id;
+       u16 core_id;
        char valid;             /* zero until following fields are valid */
        unsigned long last_updated;     /* in jiffies */
        int temp;
@@ -74,7 +75,7 @@ static ssize_t show_name(struct device *dev, struct device_attribute
        if (attr->index == SHOW_NAME)
                ret = sprintf(buf, "%s\n", data->name);
        else    /* show label */
-               ret = sprintf(buf, "Core %d\n", data->id);
+               ret = sprintf(buf, "Core %d\n", data->core_id);
        return ret;
 }
 
@@ -216,6 +217,9 @@ static int __devinit coretemp_probe(struct platform_device *pdev)
        }
 
        data->id = pdev->id;
+#ifdef CONFIG_SMP
+       data->core_id = c->cpu_core_id;
+#endif
        data->name = "coretemp";
        mutex_init(&data->update_lock);