aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/pkgtemp.c
diff options
context:
space:
mode:
authorChen Gong <gong.chen@linux.intel.com>2010-10-08 01:53:35 -0400
committerGuenter Roeck <guenter.roeck@ericsson.com>2010-10-25 17:11:20 -0400
commitfd53d08465a79d742a297be1d7d173f8a13972a6 (patch)
tree600fcad9649d689916153bc7fac38b0c17d46da2 /drivers/hwmon/pkgtemp.c
parente5f5c99a39375ce533aacfdfb269978070121e1c (diff)
hwmon: (pkgtemp) align driver initialization style with coretemp
pkgtemp is derived from coretemp, so some reasonable logics should be applied onto pkgtemp, too. Such as the init logic here. Signed-off-by: Chen Gong <gong.chen@linux.intel.com> Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
Diffstat (limited to 'drivers/hwmon/pkgtemp.c')
-rw-r--r--drivers/hwmon/pkgtemp.c22
1 files changed, 8 insertions, 14 deletions
diff --git a/drivers/hwmon/pkgtemp.c b/drivers/hwmon/pkgtemp.c
index c9f652d84ea1..a8fc35e854c7 100644
--- a/drivers/hwmon/pkgtemp.c
+++ b/drivers/hwmon/pkgtemp.c
@@ -34,6 +34,7 @@
34#include <linux/cpu.h> 34#include <linux/cpu.h>
35#include <asm/msr.h> 35#include <asm/msr.h>
36#include <asm/processor.h> 36#include <asm/processor.h>
37#include <asm/smp.h>
37 38
38#define DRVNAME "pkgtemp" 39#define DRVNAME "pkgtemp"
39 40
@@ -391,7 +392,6 @@ static struct notifier_block pkgtemp_cpu_notifier __refdata = {
391static int __init pkgtemp_init(void) 392static int __init pkgtemp_init(void)
392{ 393{
393 int i, err = -ENODEV; 394 int i, err = -ENODEV;
394 struct pdev_entry *p, *n;
395 395
396 /* quick check if we run Intel */ 396 /* quick check if we run Intel */
397 if (cpu_data(0).x86_vendor != X86_VENDOR_INTEL) 397 if (cpu_data(0).x86_vendor != X86_VENDOR_INTEL)
@@ -401,31 +401,25 @@ static int __init pkgtemp_init(void)
401 if (err) 401 if (err)
402 goto exit; 402 goto exit;
403 403
404 for_each_online_cpu(i) { 404 for_each_online_cpu(i)
405 err = pkgtemp_device_add(i); 405 pkgtemp_device_add(i);
406 if (err) 406
407 goto exit_devices_unreg; 407#ifndef CONFIG_HOTPLUG_CPU
408 }
409 if (list_empty(&pdev_list)) { 408 if (list_empty(&pdev_list)) {
410 err = -ENODEV; 409 err = -ENODEV;
411 goto exit_driver_unreg; 410 goto exit_driver_unreg;
412 } 411 }
412#endif
413 413
414#ifdef CONFIG_HOTPLUG_CPU 414#ifdef CONFIG_HOTPLUG_CPU
415 register_hotcpu_notifier(&pkgtemp_cpu_notifier); 415 register_hotcpu_notifier(&pkgtemp_cpu_notifier);
416#endif 416#endif
417 return 0; 417 return 0;
418 418
419exit_devices_unreg: 419#ifndef CONFIG_HOTPLUG_CPU
420 mutex_lock(&pdev_list_mutex);
421 list_for_each_entry_safe(p, n, &pdev_list, list) {
422 platform_device_unregister(p->pdev);
423 list_del(&p->list);
424 kfree(p);
425 }
426 mutex_unlock(&pdev_list_mutex);
427exit_driver_unreg: 420exit_driver_unreg:
428 platform_driver_unregister(&pkgtemp_driver); 421 platform_driver_unregister(&pkgtemp_driver);
422#endif
429exit: 423exit:
430 return err; 424 return err;
431} 425}