Skip to contentSkip to conversation

hwmon: (coretemp) Properly label the

PATCH In review Jean Delvare 2 participants 3 messages Jun 27, 2010 – Jun 28, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 2/2 hwmon: (coretemp) Properly label the

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.

---
 drivers/hwmon/coretemp.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/hwmon/coretemp.c +3 -1
@@ -53,6 +53,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;
@@ -75,7 +76,7 @@ static ssize_t show_name(struct device *
 	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;
 }
 
@@ -304,6 +305,7 @@ static int __devinit coretemp_probe(stru
 	}
 
 	data->id = pdev->id;
+	data->core_id = c->cpu_core_id;
 	data->name = "coretemp";
 	mutex_init(&data->update_lock);
 
Signature · 6 lines
Jean Delvare

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
#1 lore raw

Good pathes. Thank you, Jean.

Please feel free to add the line Acked-by: Huaxu Wan <[email protected]>

BTW, I'm not sure whether I should forward these patches to Andrew Morton or you submit them again to LKML, because hwmon has no maintainer at present.

Thanks
Huaxu

Quoted 52 lines

-----Original Message-----
From: Jean Delvare [mailto:[email protected]]
Sent: Sunday, June 27, 2010 7:36 PM
To: LM Sensors
Cc: Wan, Huaxu
Subject: [PATCH 2/2] 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.

---
drivers/hwmon/coretemp.c | 4 +++-

1 file changed, 3 insertions(+), 1 deletion(-)

--- linux-2.6.35-rc3.orig/drivers/hwmon/coretemp.c

2010-06-27 10:14:51.000000000 +0200

+++ linux-2.6.35-rc3/drivers/hwmon/coretemp.c 2010-06-27
10:19:19.000000000 +0200

drivers/hwmon/coretemp.c +1 -0
@@ -53,6 +53,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;
drivers/hwmon/coretemp.c +2 -1
@@ -75,7 +76,7 @@ static ssize_t show_name(struct device *
 	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;
 }
 
@@ -304,6 +305,7 @@ static int __devinit coretemp_probe(stru
 	}
 
 	data->id = pdev->id;
+	data->core_id = c->cpu_core_id;
 	data->name = "coretemp";
 	mutex_init(&data->update_lock);
 
Signature · 2 lines
-- 
Jean Delvare

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

#2 lore raw
In reply to Jean Delvare

Hi Huaxu,

Quoted 3 lines · Huaxu

Good pathes. Thank you, Jean.

Please feel free to add the line Acked-by: Huaxu Wan <[email protected]>

Great, thanks for the review.

Quoted 3 lines

BTW, I'm not sure whether I should forward these patches to Andrew Morton or you submit them again to LKML, because hwmon has no maintainer at present.

I have my own hwmon tree, so I'll push the patches to Linus myself.

Quoted 47 lines
Quoted 47 lines

-----Original Message-----
From: Jean Delvare [mailto:[email protected]]
Sent: Sunday, June 27, 2010 7:36 PM
To: LM Sensors
Cc: Wan, Huaxu
Subject: [PATCH 2/2] 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.

---
drivers/hwmon/coretemp.c | 4 +++-

1 file changed, 3 insertions(+), 1 deletion(-)

--- linux-2.6.35-rc3.orig/drivers/hwmon/coretemp.c

2010-06-27 10:14:51.000000000 +0200

+++ linux-2.6.35-rc3/drivers/hwmon/coretemp.c 2010-06-27
10:19:19.000000000 +0200

drivers/hwmon/coretemp.c +1 -0
@@ -53,6 +53,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;
drivers/hwmon/coretemp.c +2 -1
@@ -75,7 +76,7 @@ static ssize_t show_name(struct device *
 	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;
 }
 
@@ -304,6 +305,7 @@ static int __devinit coretemp_probe(stru
 	}
 
 	data->id = pdev->id;
+	data->core_id = c->cpu_core_id;
 	data->name = "coretemp";
 	mutex_init(&data->update_lock);
 
Signature · 6 lines
Jean Delvare

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors