[PATCH] x86/hwmon: fix initialization of pkgtemp

From: Jan Beulich
Date: Mon Sep 13 2010 - 06:19:05 EST


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

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxxxx>
Cc: Fenghua Yu <fenghua.yu@xxxxxxxxx>

---
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;



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/