aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/via-cputemp.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/hwmon/via-cputemp.c')
-rw-r--r--drivers/hwmon/via-cputemp.c25
1 files changed, 11 insertions, 14 deletions
diff --git a/drivers/hwmon/via-cputemp.c b/drivers/hwmon/via-cputemp.c
index 45b08c78b531..0d18de424c66 100644
--- a/drivers/hwmon/via-cputemp.c
+++ b/drivers/hwmon/via-cputemp.c
@@ -238,13 +238,16 @@ exit:
238 238
239static void __cpuinit via_cputemp_device_remove(unsigned int cpu) 239static void __cpuinit via_cputemp_device_remove(unsigned int cpu)
240{ 240{
241 struct pdev_entry *p, *n; 241 struct pdev_entry *p;
242
242 mutex_lock(&pdev_list_mutex); 243 mutex_lock(&pdev_list_mutex);
243 list_for_each_entry_safe(p, n, &pdev_list, list) { 244 list_for_each_entry(p, &pdev_list, list) {
244 if (p->cpu == cpu) { 245 if (p->cpu == cpu) {
245 platform_device_unregister(p->pdev); 246 platform_device_unregister(p->pdev);
246 list_del(&p->list); 247 list_del(&p->list);
248 mutex_unlock(&pdev_list_mutex);
247 kfree(p); 249 kfree(p);
250 return;
248 } 251 }
249 } 252 }
250 mutex_unlock(&pdev_list_mutex); 253 mutex_unlock(&pdev_list_mutex);
@@ -274,7 +277,6 @@ static struct notifier_block via_cputemp_cpu_notifier __refdata = {
274static int __init via_cputemp_init(void) 277static int __init via_cputemp_init(void)
275{ 278{
276 int i, err; 279 int i, err;
277 struct pdev_entry *p, *n;
278 280
279 if (cpu_data(0).x86_vendor != X86_VENDOR_CENTAUR) { 281 if (cpu_data(0).x86_vendor != X86_VENDOR_CENTAUR) {
280 printk(KERN_DEBUG DRVNAME ": Not a VIA CPU\n"); 282 printk(KERN_DEBUG DRVNAME ": Not a VIA CPU\n");
@@ -300,28 +302,23 @@ static int __init via_cputemp_init(void)
300 continue; 302 continue;
301 } 303 }
302 304
303 err = via_cputemp_device_add(i); 305 via_cputemp_device_add(i);
304 if (err)
305 goto exit_devices_unreg;
306 } 306 }
307
308#ifndef CONFIG_HOTPLUG_CPU
307 if (list_empty(&pdev_list)) { 309 if (list_empty(&pdev_list)) {
308 err = -ENODEV; 310 err = -ENODEV;
309 goto exit_driver_unreg; 311 goto exit_driver_unreg;
310 } 312 }
313#endif
311 314
312 register_hotcpu_notifier(&via_cputemp_cpu_notifier); 315 register_hotcpu_notifier(&via_cputemp_cpu_notifier);
313 return 0; 316 return 0;
314 317
315exit_devices_unreg: 318#ifndef CONFIG_HOTPLUG_CPU
316 mutex_lock(&pdev_list_mutex);
317 list_for_each_entry_safe(p, n, &pdev_list, list) {
318 platform_device_unregister(p->pdev);
319 list_del(&p->list);
320 kfree(p);
321 }
322 mutex_unlock(&pdev_list_mutex);
323exit_driver_unreg: 319exit_driver_unreg:
324 platform_driver_unregister(&via_cputemp_driver); 320 platform_driver_unregister(&via_cputemp_driver);
321#endif
325exit: 322exit:
326 return err; 323 return err;
327} 324}