diff options
Diffstat (limited to 'drivers/hwmon/via-cputemp.c')
-rw-r--r-- | drivers/hwmon/via-cputemp.c | 35 |
1 files changed, 16 insertions, 19 deletions
diff --git a/drivers/hwmon/via-cputemp.c b/drivers/hwmon/via-cputemp.c index ec7fad747adc..0d18de424c66 100644 --- a/drivers/hwmon/via-cputemp.c +++ b/drivers/hwmon/via-cputemp.c | |||
@@ -21,6 +21,8 @@ | |||
21 | * 02110-1301 USA. | 21 | * 02110-1301 USA. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
25 | |||
24 | #include <linux/module.h> | 26 | #include <linux/module.h> |
25 | #include <linux/init.h> | 27 | #include <linux/init.h> |
26 | #include <linux/slab.h> | 28 | #include <linux/slab.h> |
@@ -202,7 +204,7 @@ static int __cpuinit via_cputemp_device_add(unsigned int cpu) | |||
202 | pdev = platform_device_alloc(DRVNAME, cpu); | 204 | pdev = platform_device_alloc(DRVNAME, cpu); |
203 | if (!pdev) { | 205 | if (!pdev) { |
204 | err = -ENOMEM; | 206 | err = -ENOMEM; |
205 | printk(KERN_ERR DRVNAME ": Device allocation failed\n"); | 207 | pr_err("Device allocation failed\n"); |
206 | goto exit; | 208 | goto exit; |
207 | } | 209 | } |
208 | 210 | ||
@@ -214,8 +216,7 @@ static int __cpuinit via_cputemp_device_add(unsigned int cpu) | |||
214 | 216 | ||
215 | err = platform_device_add(pdev); | 217 | err = platform_device_add(pdev); |
216 | if (err) { | 218 | if (err) { |
217 | printk(KERN_ERR DRVNAME ": Device addition failed (%d)\n", | 219 | pr_err("Device addition failed (%d)\n", err); |
218 | err); | ||
219 | goto exit_device_free; | 220 | goto exit_device_free; |
220 | } | 221 | } |
221 | 222 | ||
@@ -237,13 +238,16 @@ exit: | |||
237 | 238 | ||
238 | static void __cpuinit via_cputemp_device_remove(unsigned int cpu) | 239 | static void __cpuinit via_cputemp_device_remove(unsigned int cpu) |
239 | { | 240 | { |
240 | struct pdev_entry *p, *n; | 241 | struct pdev_entry *p; |
242 | |||
241 | mutex_lock(&pdev_list_mutex); | 243 | mutex_lock(&pdev_list_mutex); |
242 | list_for_each_entry_safe(p, n, &pdev_list, list) { | 244 | list_for_each_entry(p, &pdev_list, list) { |
243 | if (p->cpu == cpu) { | 245 | if (p->cpu == cpu) { |
244 | platform_device_unregister(p->pdev); | 246 | platform_device_unregister(p->pdev); |
245 | list_del(&p->list); | 247 | list_del(&p->list); |
248 | mutex_unlock(&pdev_list_mutex); | ||
246 | kfree(p); | 249 | kfree(p); |
250 | return; | ||
247 | } | 251 | } |
248 | } | 252 | } |
249 | mutex_unlock(&pdev_list_mutex); | 253 | mutex_unlock(&pdev_list_mutex); |
@@ -273,7 +277,6 @@ static struct notifier_block via_cputemp_cpu_notifier __refdata = { | |||
273 | static int __init via_cputemp_init(void) | 277 | static int __init via_cputemp_init(void) |
274 | { | 278 | { |
275 | int i, err; | 279 | int i, err; |
276 | struct pdev_entry *p, *n; | ||
277 | 280 | ||
278 | if (cpu_data(0).x86_vendor != X86_VENDOR_CENTAUR) { | 281 | if (cpu_data(0).x86_vendor != X86_VENDOR_CENTAUR) { |
279 | printk(KERN_DEBUG DRVNAME ": Not a VIA CPU\n"); | 282 | printk(KERN_DEBUG DRVNAME ": Not a VIA CPU\n"); |
@@ -295,33 +298,27 @@ static int __init via_cputemp_init(void) | |||
295 | continue; | 298 | continue; |
296 | 299 | ||
297 | if (c->x86_model > 0x0f) { | 300 | if (c->x86_model > 0x0f) { |
298 | printk(KERN_WARNING DRVNAME ": Unknown CPU " | 301 | pr_warn("Unknown CPU model 0x%x\n", c->x86_model); |
299 | "model 0x%x\n", c->x86_model); | ||
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 | } |