diff options
author | Jan Beulich <JBeulich@novell.com> | 2010-12-06 11:48:35 -0500 |
---|---|---|
committer | Guenter Roeck <guenter.roeck@ericsson.com> | 2011-01-08 13:55:48 -0500 |
commit | ae9e0ce73e9fc55a620e0b3bd4a154330a7e64cc (patch) | |
tree | 8a555118c540454744b4c1ab652b75eca04fd8a9 | |
parent | 0f1deb4b820cfacf22492abd7b17e891dafc51ae (diff) |
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>
-rw-r--r-- | drivers/hwmon/via-cputemp.c | 25 |
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 | ||
239 | static void __cpuinit via_cputemp_device_remove(unsigned int cpu) | 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 | 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 = { | |||
274 | static int __init via_cputemp_init(void) | 277 | static 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 | ||
315 | exit_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); | ||
323 | exit_driver_unreg: | 319 | exit_driver_unreg: |
324 | platform_driver_unregister(&via_cputemp_driver); | 320 | platform_driver_unregister(&via_cputemp_driver); |
321 | #endif | ||
325 | exit: | 322 | exit: |
326 | return err; | 323 | return err; |
327 | } | 324 | } |