From f64e3aea0160316bd4cd6f6f7e173fd0613ca7eb Mon Sep 17 00:00:00 2001 From: Jan Beulich Date: Mon, 6 Dec 2010 11:48:35 -0500 Subject: [PATCH] --- yaml --- r: 227775 b: refs/heads/master c: ae9e0ce73e9fc55a620e0b3bd4a154330a7e64cc h: refs/heads/master i: 227773: 6a0cc67facc1d7cba1f49ca785a9c251bf53cd98 227771: 3ab097897c73d48285f206e02d932c3035c9324d 227767: 95fda03832622be2da9b62bd11c1d9953c596002 227759: 054a057ac657a02b5edf8d9d9a3cac8d54b4f7de 227743: de0353f1cb00b9d9e9eb2956cccd00824a1f2850 227711: 589d8b2048037c880d17437651336d1e0b7178b3 v: v3 --- [refs] | 2 +- trunk/drivers/hwmon/via-cputemp.c | 25 +++++++++++-------------- 2 files changed, 12 insertions(+), 15 deletions(-) diff --git a/[refs] b/[refs] index db61a5862311..c196ffc667c6 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 0f1deb4b820cfacf22492abd7b17e891dafc51ae +refs/heads/master: ae9e0ce73e9fc55a620e0b3bd4a154330a7e64cc diff --git a/trunk/drivers/hwmon/via-cputemp.c b/trunk/drivers/hwmon/via-cputemp.c index 45b08c78b531..0d18de424c66 100644 --- a/trunk/drivers/hwmon/via-cputemp.c +++ b/trunk/drivers/hwmon/via-cputemp.c @@ -238,13 +238,16 @@ static int __cpuinit via_cputemp_device_add(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); - list_for_each_entry_safe(p, n, &pdev_list, list) { + list_for_each_entry(p, &pdev_list, list) { if (p->cpu == cpu) { platform_device_unregister(p->pdev); list_del(&p->list); + mutex_unlock(&pdev_list_mutex); kfree(p); + return; } } mutex_unlock(&pdev_list_mutex); @@ -274,7 +277,6 @@ static struct notifier_block via_cputemp_cpu_notifier __refdata = { static int __init via_cputemp_init(void) { int i, err; - struct pdev_entry *p, *n; if (cpu_data(0).x86_vendor != X86_VENDOR_CENTAUR) { printk(KERN_DEBUG DRVNAME ": Not a VIA CPU\n"); @@ -300,28 +302,23 @@ static int __init via_cputemp_init(void) continue; } - err = via_cputemp_device_add(i); - if (err) - goto exit_devices_unreg; + via_cputemp_device_add(i); } + +#ifndef CONFIG_HOTPLUG_CPU if (list_empty(&pdev_list)) { err = -ENODEV; goto exit_driver_unreg; } +#endif register_hotcpu_notifier(&via_cputemp_cpu_notifier); return 0; -exit_devices_unreg: - 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); +#ifndef CONFIG_HOTPLUG_CPU exit_driver_unreg: platform_driver_unregister(&via_cputemp_driver); +#endif exit: return err; }