]> git.karo-electronics.de Git - mv-sheeva.git/blobdiff - drivers/hwmon/pkgtemp.c
Merge branch 'master' into tk71
[mv-sheeva.git] / drivers / hwmon / pkgtemp.c
index f11903936c8b3a51c3f8dddcb20318185952fa79..21c817d98123f7d8fe6e96efcb499785ef931ddb 100644 (file)
@@ -20,8 +20,9 @@
  * 02110-1301 USA.
  */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <linux/module.h>
-#include <linux/delay.h>
 #include <linux/init.h>
 #include <linux/slab.h>
 #include <linux/jiffies.h>
@@ -35,6 +36,7 @@
 #include <linux/cpu.h>
 #include <asm/msr.h>
 #include <asm/processor.h>
+#include <asm/smp.h>
 
 #define DRVNAME        "pkgtemp"
 
@@ -303,7 +305,7 @@ static int __cpuinit pkgtemp_device_add(unsigned int cpu)
        pdev = platform_device_alloc(DRVNAME, cpu);
        if (!pdev) {
                err = -ENOMEM;
-               printk(KERN_ERR DRVNAME ": Device allocation failed\n");
+               pr_err("Device allocation failed\n");
                goto exit;
        }
 
@@ -315,8 +317,7 @@ static int __cpuinit pkgtemp_device_add(unsigned int cpu)
 
        err = platform_device_add(pdev);
        if (err) {
-               printk(KERN_ERR DRVNAME ": Device addition failed (%d)\n",
-                      err);
+               pr_err("Device addition failed (%d)\n", err);
                goto exit_device_free;
        }
 
@@ -339,8 +340,7 @@ exit:
        return err;
 }
 
-#ifdef CONFIG_HOTPLUG_CPU
-static void pkgtemp_device_remove(unsigned int cpu)
+static void __cpuinit pkgtemp_device_remove(unsigned int cpu)
 {
        struct pdev_entry *p;
        unsigned int i;
@@ -387,12 +387,10 @@ static int __cpuinit pkgtemp_cpu_callback(struct notifier_block *nfb,
 static struct notifier_block pkgtemp_cpu_notifier __refdata = {
        .notifier_call = pkgtemp_cpu_callback,
 };
-#endif                         /* !CONFIG_HOTPLUG_CPU */
 
 static int __init pkgtemp_init(void)
 {
        int i, err = -ENODEV;
-       struct pdev_entry *p, *n;
 
        /* quick check if we run Intel */
        if (cpu_data(0).x86_vendor != X86_VENDOR_INTEL)
@@ -402,31 +400,23 @@ static int __init pkgtemp_init(void)
        if (err)
                goto exit;
 
-       for_each_online_cpu(i) {
-               err = pkgtemp_device_add(i);
-               if (err)
-                       goto exit_devices_unreg;
-       }
+       for_each_online_cpu(i)
+               pkgtemp_device_add(i);
+
+#ifndef CONFIG_HOTPLUG_CPU
        if (list_empty(&pdev_list)) {
                err = -ENODEV;
                goto exit_driver_unreg;
        }
+#endif
 
-#ifdef CONFIG_HOTPLUG_CPU
        register_hotcpu_notifier(&pkgtemp_cpu_notifier);
-#endif
        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(&pkgtemp_driver);
+#endif
 exit:
        return err;
 }
@@ -434,9 +424,8 @@ exit:
 static void __exit pkgtemp_exit(void)
 {
        struct pdev_entry *p, *n;
-#ifdef CONFIG_HOTPLUG_CPU
+
        unregister_hotcpu_notifier(&pkgtemp_cpu_notifier);
-#endif
        mutex_lock(&pdev_list_mutex);
        list_for_each_entry_safe(p, n, &pdev_list, list) {
                platform_device_unregister(p->pdev);