[lm-sensors] [PATCH] x86/hwmon: fix initialization of pkgtemp

Jan Beulich JBeulich at novell.com
Mon Sep 13 12:18:54 CEST 2010


Feature availability should also be checked in the hotplug code path.

Signed-off-by: Jan Beulich <jbeulich at novell.com>
Cc: Fenghua Yu <fenghua.yu at intel.com>

---
 drivers/hwmon/pkgtemp.c |   10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

--- linux-2.6.36-rc4/drivers/hwmon/pkgtemp.c	2010-09-13 08:45:03.000000000 +0200
+++ 2.6.36-rc4-x86-pkgtemp-feature-check/drivers/hwmon/pkgtemp.c	2010-09-03 17:54:30.000000000 +0200
@@ -281,9 +281,10 @@ static int __cpuinit pkgtemp_device_add(
 	int err;
 	struct platform_device *pdev;
 	struct pdev_entry *pdev_entry;
-#ifdef CONFIG_SMP
 	struct cpuinfo_x86 *c = &cpu_data(cpu);
-#endif
+
+	if (!cpu_has(c, X86_FEATURE_PTS))
+		return 0;
 
 	mutex_lock(&pdev_list_mutex);
 
@@ -399,11 +400,6 @@ static int __init pkgtemp_init(void)
 		goto exit;
 
 	for_each_online_cpu(i) {
-		struct cpuinfo_x86 *c = &cpu_data(i);
-
-		if (!cpu_has(c, X86_FEATURE_PTS))
-			continue;
-
 		err = pkgtemp_device_add(i);
 		if (err)
 			goto exit_devices_unreg;







More information about the lm-sensors mailing list