Commit ae9e0ce73e9fc55a620e0b3bd4a154330a7e64cc

Authored by Jan Beulich
Committed by Guenter Roeck
1 parent 0f1deb4b82

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

Signed-off-by: Jan Beulich <jbeulich@novell.com>
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>

Showing 1 changed file with 11 additions and 14 deletions Side-by-side Diff

drivers/hwmon/via-cputemp.c
... ... @@ -238,13 +238,16 @@
238 238  
239 239 static void __cpuinit via_cputemp_device_remove(unsigned int cpu)
240 240 {
241   - struct pdev_entry *p, *n;
  241 + struct pdev_entry *p;
  242 +
242 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 245 if (p->cpu == cpu) {
245 246 platform_device_unregister(p->pdev);
246 247 list_del(&p->list);
  248 + mutex_unlock(&pdev_list_mutex);
247 249 kfree(p);
  250 + return;
248 251 }
249 252 }
250 253 mutex_unlock(&pdev_list_mutex);
... ... @@ -274,7 +277,6 @@
274 277 static int __init via_cputemp_init(void)
275 278 {
276 279 int i, err;
277   - struct pdev_entry *p, *n;
278 280  
279 281 if (cpu_data(0).x86_vendor != X86_VENDOR_CENTAUR) {
280 282 printk(KERN_DEBUG DRVNAME ": Not a VIA CPU\n");
281 283  
282 284  
283 285  
284 286  
... ... @@ -300,28 +302,23 @@
300 302 continue;
301 303 }
302 304  
303   - err = via_cputemp_device_add(i);
304   - if (err)
305   - goto exit_devices_unreg;
  305 + via_cputemp_device_add(i);
306 306 }
  307 +
  308 +#ifndef CONFIG_HOTPLUG_CPU
307 309 if (list_empty(&pdev_list)) {
308 310 err = -ENODEV;
309 311 goto exit_driver_unreg;
310 312 }
  313 +#endif
311 314  
312 315 register_hotcpu_notifier(&via_cputemp_cpu_notifier);
313 316 return 0;
314 317  
315   -exit_devices_unreg:
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);
  318 +#ifndef CONFIG_HOTPLUG_CPU
323 319 exit_driver_unreg:
324 320 platform_driver_unregister(&via_cputemp_driver);
  321 +#endif
325 322 exit:
326 323 return err;
327 324 }