Skip to contentSkip to conversation

hwmon: (coretemp) Fix for non-SMP builds

PATCH In review Jean Delvare 3 participants 4 messages Nov 5, 2011 – Nov 6, 2011

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

PATCH 1/1 hwmon: (coretemp) Fix for non-SMP builds

The definition of TO_ATTR_NO in the non-SMP case is wrong. As the SMP definition resolves to the correct value, just use this for both cases.

Without this fix the temperature attributes are named temp0_* instead of temp2_*, so libsensors won't pick them. Broken since kernel 3.0.

---
 drivers/hwmon/coretemp.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/hwmon/coretemp.c +1 -2
@@ -50,14 +50,13 @@
 #ifdef CONFIG_SMP
 #define TO_PHYS_ID(cpu)		cpu_data(cpu).phys_proc_id
 #define TO_CORE_ID(cpu)		cpu_data(cpu).cpu_core_id
-#define TO_ATTR_NO(cpu)		(TO_CORE_ID(cpu) + BASE_SYSFS_ATTR_NO)
 #define for_each_sibling(i, cpu)	for_each_cpu(i, cpu_sibling_mask(cpu))
 #else
 #define TO_PHYS_ID(cpu)		(cpu)
 #define TO_CORE_ID(cpu)		(cpu)
-#define TO_ATTR_NO(cpu)		(cpu)
 #define for_each_sibling(i, cpu)	for (i = 0; false; )
 #endif
+#define TO_ATTR_NO(cpu)		(TO_CORE_ID(cpu) + BASE_SYSFS_ATTR_NO)
 
 /*
  * Per-Core Temperature Data
Signature · 6 lines
Jean Delvare

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

Nice Catch.
Thanks Jean for the fix.

Quoted 11 lines

-----Original Message-----
From: Jean Delvare [mailto:[email protected]]
Sent: Saturday, November 05, 2011 11:24 PM
To: LM Sensors
Cc: R, Durgadoss; Guenter Roeck; Phil Sutter
Subject: [PATCH] hwmon: (coretemp) Fix for non-SMP builds

The definition of TO_ATTR_NO in the non-SMP case is wrong. As the SMP definition resolves to the correct value, just use this for both cases.

Quoted 5 lines

Without this fix the temperature attributes are named temp0_* instead of temp2_*, so libsensors won't pick them. Broken since kernel 3.0.

Thanks,
Durga

Quoted 25 lines
---
 drivers/hwmon/coretemp.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

--- linux-3.0.orig/drivers/hwmon/coretemp.c 2011-11-05 18:39:36.000000000
+0100
+++ linux-3.0/drivers/hwmon/coretemp.c 2011-11-05 18:48:19.000000000 +0100

drivers/hwmon/coretemp.c +1 -3
@@ -50,14 +50,13 @@
 #ifdef CONFIG_SMP
 #define TO_PHYS_ID(cpu)		cpu_data(cpu).phys_proc_id
 #define TO_CORE_ID(cpu)		cpu_data(cpu).cpu_core_id
-#define TO_ATTR_NO(cpu)		(TO_CORE_ID(cpu) + BASE_SYSFS_ATTR_NO)
 #define for_each_sibling(i, cpu)	for_each_cpu(i, cpu_sibling_mask(cpu))
 #else
 #define TO_PHYS_ID(cpu)		(cpu)
 #define TO_CORE_ID(cpu)		(cpu)
-#define TO_ATTR_NO(cpu)		(cpu)
 #define for_each_sibling(i, cpu)	for (i = 0; false; )
 #endif
+#define TO_ATTR_NO(cpu)		(TO_CORE_ID(cpu) + BASE_SYSFS_ATTR_NO)
 
 /*
  * Per-Core Temperature Data
 
--
Quoted 1 line

Jean Delvare

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

Acked-by on v1 1/1
#2 lore raw
In reply to Jean Delvare
Quoted 9 lines · Jean Delvare

The definition of TO_ATTR_NO in the non-SMP case is wrong. As the SMP definition resolves to the correct value, just use this for both cases.

Without this fix the temperature attributes are named temp0_* instead of temp2_*, so libsensors won't pick them. Broken since kernel 3.0.

Jean, I assume you take that one ?

Thanks,
Guenter

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

#3 lore raw
In reply to Jean Delvare
Quoted 5 lines · Guenter Roeck
Quoted 4 lines · Jean Delvare

The definition of TO_ATTR_NO in the non-SMP case is wrong. As the SMP definition resolves to the correct value, just use this for both cases.

Quoted 7 lines
Quoted 5 lines

Without this fix the temperature attributes are named temp0_* instead of temp2_*, so libsensors won't pick them. Broken since kernel 3.0.

Thanks.

Quoted 1 line

Jean, I assume you take that one ?

Yes I will.

Signature · 6 lines
Jean Delvare

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