Commit ae9e0ce7 authored by Jan Beulich's avatar Jan Beulich Committed by Guenter Roeck

hwmon: (via-cputemp) sync hotplug handling with coretemp/pkgtemp

Signed-off-by: default avatarJan Beulich <jbeulich@novell.com>
Signed-off-by: default avatarGuenter Roeck <guenter.roeck@ericsson.com>
parent 0f1deb4b
...@@ -238,13 +238,16 @@ static int __cpuinit via_cputemp_device_add(unsigned int cpu) ...@@ -238,13 +238,16 @@ static int __cpuinit via_cputemp_device_add(unsigned int cpu)
static void __cpuinit via_cputemp_device_remove(unsigned int cpu) static void __cpuinit via_cputemp_device_remove(unsigned int cpu)
{ {
struct pdev_entry *p, *n; struct pdev_entry *p;
mutex_lock(&pdev_list_mutex); mutex_lock(&pdev_list_mutex);
list_for_each_entry_safe(p, n, &pdev_list, list) { list_for_each_entry(p, &pdev_list, list) {
if (p->cpu == cpu) { if (p->cpu == cpu) {
platform_device_unregister(p->pdev); platform_device_unregister(p->pdev);
list_del(&p->list); list_del(&p->list);
mutex_unlock(&pdev_list_mutex);
kfree(p); kfree(p);
return;
} }
} }
mutex_unlock(&pdev_list_mutex); mutex_unlock(&pdev_list_mutex);
...@@ -274,7 +277,6 @@ static struct notifier_block via_cputemp_cpu_notifier __refdata = { ...@@ -274,7 +277,6 @@ static struct notifier_block via_cputemp_cpu_notifier __refdata = {
static int __init via_cputemp_init(void) static int __init via_cputemp_init(void)
{ {
int i, err; int i, err;
struct pdev_entry *p, *n;
if (cpu_data(0).x86_vendor != X86_VENDOR_CENTAUR) { if (cpu_data(0).x86_vendor != X86_VENDOR_CENTAUR) {
printk(KERN_DEBUG DRVNAME ": Not a VIA CPU\n"); printk(KERN_DEBUG DRVNAME ": Not a VIA CPU\n");
...@@ -300,28 +302,23 @@ static int __init via_cputemp_init(void) ...@@ -300,28 +302,23 @@ static int __init via_cputemp_init(void)
continue; continue;
} }
err = via_cputemp_device_add(i); via_cputemp_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
register_hotcpu_notifier(&via_cputemp_cpu_notifier); register_hotcpu_notifier(&via_cputemp_cpu_notifier);
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(&via_cputemp_driver); platform_driver_unregister(&via_cputemp_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