aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/pkgtemp.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/hwmon/pkgtemp.c')
-rw-r--r--drivers/hwmon/pkgtemp.c32
1 files changed, 10 insertions, 22 deletions
diff --git a/drivers/hwmon/pkgtemp.c b/drivers/hwmon/pkgtemp.c
index f11903936c8b..0798210590bc 100644
--- a/drivers/hwmon/pkgtemp.c
+++ b/drivers/hwmon/pkgtemp.c
@@ -21,7 +21,6 @@
21 */ 21 */
22 22
23#include <linux/module.h> 23#include <linux/module.h>
24#include <linux/delay.h>
25#include <linux/init.h> 24#include <linux/init.h>
26#include <linux/slab.h> 25#include <linux/slab.h>
27#include <linux/jiffies.h> 26#include <linux/jiffies.h>
@@ -35,6 +34,7 @@
35#include <linux/cpu.h> 34#include <linux/cpu.h>
36#include <asm/msr.h> 35#include <asm/msr.h>
37#include <asm/processor.h> 36#include <asm/processor.h>
37#include <asm/smp.h>
38 38
39#define DRVNAME "pkgtemp" 39#define DRVNAME "pkgtemp"
40 40
@@ -339,8 +339,7 @@ exit:
339 return err; 339 return err;
340} 340}
341 341
342#ifdef CONFIG_HOTPLUG_CPU 342static void __cpuinit pkgtemp_device_remove(unsigned int cpu)
343static void pkgtemp_device_remove(unsigned int cpu)
344{ 343{
345 struct pdev_entry *p; 344 struct pdev_entry *p;
346 unsigned int i; 345 unsigned int i;
@@ -387,12 +386,10 @@ static int __cpuinit pkgtemp_cpu_callback(struct notifier_block *nfb,
387static struct notifier_block pkgtemp_cpu_notifier __refdata = { 386static struct notifier_block pkgtemp_cpu_notifier __refdata = {
388 .notifier_call = pkgtemp_cpu_callback, 387 .notifier_call = pkgtemp_cpu_callback,
389}; 388};
390#endif /* !CONFIG_HOTPLUG_CPU */
391 389
392static int __init pkgtemp_init(void) 390static int __init pkgtemp_init(void)
393{ 391{
394 int i, err = -ENODEV; 392 int i, err = -ENODEV;
395 struct pdev_entry *p, *n;
396 393
397 /* quick check if we run Intel */ 394 /* quick check if we run Intel */
398 if (cpu_data(0).x86_vendor != X86_VENDOR_INTEL) 395 if (cpu_data(0).x86_vendor != X86_VENDOR_INTEL)
@@ -402,31 +399,23 @@ static int __init pkgtemp_init(void)
402 if (err) 399 if (err)
403 goto exit; 400 goto exit;
404 401
405 for_each_online_cpu(i) { 402 for_each_online_cpu(i)
406 err = pkgtemp_device_add(i); 403 pkgtemp_device_add(i);
407 if (err) 404
408 goto exit_devices_unreg; 405#ifndef CONFIG_HOTPLUG_CPU
409 }
410 if (list_empty(&pdev_list)) { 406 if (list_empty(&pdev_list)) {
411 err = -ENODEV; 407 err = -ENODEV;
412 goto exit_driver_unreg; 408 goto exit_driver_unreg;
413 } 409 }
410#endif
414 411
415#ifdef CONFIG_HOTPLUG_CPU
416 register_hotcpu_notifier(&pkgtemp_cpu_notifier); 412 register_hotcpu_notifier(&pkgtemp_cpu_notifier);
417#endif
418 return 0; 413 return 0;
419 414
420exit_devices_unreg: 415#ifndef CONFIG_HOTPLUG_CPU
421 mutex_lock(&pdev_list_mutex);
422 list_for_each_entry_safe(p, n, &pdev_list, list) {
423 platform_device_unregister(p->pdev);
424 list_del(&p->list);
425 kfree(p);
426 }
427 mutex_unlock(&pdev_list_mutex);
428exit_driver_unreg: 416exit_driver_unreg:
429 platform_driver_unregister(&pkgtemp_driver); 417 platform_driver_unregister(&pkgtemp_driver);
418#endif
430exit: 419exit:
431 return err; 420 return err;
432} 421}
@@ -434,9 +423,8 @@ exit:
434static void __exit pkgtemp_exit(void) 423static void __exit pkgtemp_exit(void)
435{ 424{
436 struct pdev_entry *p, *n; 425 struct pdev_entry *p, *n;
437#ifdef CONFIG_HOTPLUG_CPU 426
438 unregister_hotcpu_notifier(&pkgtemp_cpu_notifier); 427 unregister_hotcpu_notifier(&pkgtemp_cpu_notifier);
439#endif
440 mutex_lock(&pdev_list_mutex); 428 mutex_lock(&pdev_list_mutex);
441 list_for_each_entry_safe(p, n, &pdev_list, list) { 429 list_for_each_entry_safe(p, n, &pdev_list, list) {
442 platform_device_unregister(p->pdev); 430 platform_device_unregister(p->pdev);