Commit fd53d084 authored by Chen Gong's avatar Chen Gong Committed by Guenter Roeck

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: default avatarChen Gong <gong.chen@linux.intel.com>
Signed-off-by: default avatarGuenter Roeck <guenter.roeck@ericsson.com>
parent e5f5c99a
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
#include <linux/cpu.h> #include <linux/cpu.h>
#include <asm/msr.h> #include <asm/msr.h>
#include <asm/processor.h> #include <asm/processor.h>
#include <asm/smp.h>
#define DRVNAME "pkgtemp" #define DRVNAME "pkgtemp"
...@@ -391,7 +392,6 @@ static struct notifier_block pkgtemp_cpu_notifier __refdata = { ...@@ -391,7 +392,6 @@ static struct notifier_block pkgtemp_cpu_notifier __refdata = {
static int __init pkgtemp_init(void) static int __init pkgtemp_init(void)
{ {
int i, err = -ENODEV; int i, err = -ENODEV;
struct pdev_entry *p, *n;
/* quick check if we run Intel */ /* quick check if we run Intel */
if (cpu_data(0).x86_vendor != X86_VENDOR_INTEL) if (cpu_data(0).x86_vendor != X86_VENDOR_INTEL)
...@@ -401,31 +401,25 @@ static int __init pkgtemp_init(void) ...@@ -401,31 +401,25 @@ static int __init pkgtemp_init(void)
if (err) if (err)
goto exit; goto exit;
for_each_online_cpu(i) { for_each_online_cpu(i)
err = pkgtemp_device_add(i); pkgtemp_device_add(i);
if (err)
goto exit_devices_unreg; #ifndef CONFIG_HOTPLUG_CPU
}
if (list_empty(&pdev_list)) { if (list_empty(&pdev_list)) {
err = -ENODEV; err = -ENODEV;
goto exit_driver_unreg; goto exit_driver_unreg;
} }
#endif
#ifdef CONFIG_HOTPLUG_CPU #ifdef CONFIG_HOTPLUG_CPU
register_hotcpu_notifier(&pkgtemp_cpu_notifier); register_hotcpu_notifier(&pkgtemp_cpu_notifier);
#endif #endif
return 0; return 0;
exit_devices_unreg: #ifndef CONFIG_HOTPLUG_CPU
mutex_lock(&pdev_list_mutex);
list_for_each_entry_safe(p, n, &pdev_list, list) {
platform_device_unregister(p->pdev);
list_del(&p->list);
kfree(p);
}
mutex_unlock(&pdev_list_mutex);
exit_driver_unreg: exit_driver_unreg:
platform_driver_unregister(&pkgtemp_driver); platform_driver_unregister(&pkgtemp_driver);
#endif
exit: exit:
return err; return err;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment