All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chen Gong <gong.chen@linux.intel.com>
To: lm-sensors@lm-sensors.org
Cc: JBeulich@novell.com, guenter.roeck@ericsson.com,
	linux-kernel@vger.kernel.org,
	Chen Gong <gong.chen@linux.intel.com>
Subject: [lm-sensors] [PATCH V2 1/2] hwmon: uniform the init style of pkgtemp
Date: Fri, 08 Oct 2010 05:53:35 +0000	[thread overview]
Message-ID: <1286517216-15640-2-git-send-email-gong.chen@linux.intel.com> (raw)
In-Reply-To: <1286517216-15640-1-git-send-email-gong.chen@linux.intel.com>

pkgtemp is derived from coretemp, so some reasonable
logics should be applied onto pkgtemp, too. Such as
the init logic here.

Signed-off-by: Chen Gong <gong.chen@linux.intel.com>
---
 drivers/hwmon/pkgtemp.c |   22 ++++++++--------------
 1 files changed, 8 insertions(+), 14 deletions(-)

diff --git a/drivers/hwmon/pkgtemp.c b/drivers/hwmon/pkgtemp.c
index f119039..29fef42 100644
--- a/drivers/hwmon/pkgtemp.c
+++ b/drivers/hwmon/pkgtemp.c
@@ -35,6 +35,7 @@
 #include <linux/cpu.h>
 #include <asm/msr.h>
 #include <asm/processor.h>
+#include <asm/smp.h>
 
 #define DRVNAME	"pkgtemp"
 
@@ -392,7 +393,6 @@ static struct notifier_block pkgtemp_cpu_notifier __refdata = {
 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 +402,25 @@ 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;
 }
-- 
1.7.2.2.173.g515cc


_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

WARNING: multiple messages have this Message-ID (diff)
From: Chen Gong <gong.chen@linux.intel.com>
To: lm-sensors@lm-sensors.org
Cc: JBeulich@novell.com, guenter.roeck@ericsson.com,
	linux-kernel@vger.kernel.org,
	Chen Gong <gong.chen@linux.intel.com>
Subject: [PATCH V2 1/2] hwmon: uniform the init style of pkgtemp
Date: Fri,  8 Oct 2010 13:53:35 +0800	[thread overview]
Message-ID: <1286517216-15640-2-git-send-email-gong.chen@linux.intel.com> (raw)
In-Reply-To: <1286517216-15640-1-git-send-email-gong.chen@linux.intel.com>

pkgtemp is derived from coretemp, so some reasonable
logics should be applied onto pkgtemp, too. Such as
the init logic here.

Signed-off-by: Chen Gong <gong.chen@linux.intel.com>
---
 drivers/hwmon/pkgtemp.c |   22 ++++++++--------------
 1 files changed, 8 insertions(+), 14 deletions(-)

diff --git a/drivers/hwmon/pkgtemp.c b/drivers/hwmon/pkgtemp.c
index f119039..29fef42 100644
--- a/drivers/hwmon/pkgtemp.c
+++ b/drivers/hwmon/pkgtemp.c
@@ -35,6 +35,7 @@
 #include <linux/cpu.h>
 #include <asm/msr.h>
 #include <asm/processor.h>
+#include <asm/smp.h>
 
 #define DRVNAME	"pkgtemp"
 
@@ -392,7 +393,6 @@ static struct notifier_block pkgtemp_cpu_notifier __refdata = {
 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 +402,25 @@ 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;
 }
-- 
1.7.2.2.173.g515cc


  reply	other threads:[~2010-10-08  5:53 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-08  5:53 [lm-sensors] update and cleanup patches for core{pkg, via}temp etc Chen Gong
2010-10-08  5:53 ` Chen Gong
2010-10-08  5:53 ` Chen Gong [this message]
2010-10-08  5:53   ` [PATCH V2 1/2] hwmon: uniform the init style of pkgtemp Chen Gong
2010-10-08 12:08   ` [lm-sensors] [PATCH V2 1/2] hwmon: uniform the init style of Guenter Roeck
2010-10-08 12:08     ` [PATCH V2 1/2] hwmon: uniform the init style of pkgtemp Guenter Roeck
2010-10-08  5:53 ` [lm-sensors] [PATCH V2 2/2] hwmon: cleanup some hotplug related Chen Gong
2010-10-08  5:53   ` [PATCH V2 2/2] hwmon: cleanup some hotplug related macro definition Chen Gong
2010-10-08 12:11   ` [lm-sensors] [PATCH V2 2/2] hwmon: cleanup some hotplug related Guenter Roeck
2010-10-08 12:11     ` [PATCH V2 2/2] hwmon: cleanup some hotplug related macro definition Guenter Roeck
2010-10-09  2:01   ` [lm-sensors] the 2nd patch is updated Chen Gong
2010-10-09  2:01     ` Chen Gong
2010-10-09  2:01   ` [lm-sensors] [PATCH] hwmon: cleanup useless hotplug related macro Chen Gong
2010-10-09  2:01     ` [PATCH] hwmon: cleanup useless hotplug related macro definition Chen Gong
2010-10-09 16:43     ` [lm-sensors] [PATCH] hwmon: cleanup useless hotplug related Guenter Roeck
2010-10-09 16:43       ` [PATCH] hwmon: cleanup useless hotplug related macro definition Guenter Roeck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1286517216-15640-2-git-send-email-gong.chen@linux.intel.com \
    --to=gong.chen@linux.intel.com \
    --cc=JBeulich@novell.com \
    --cc=guenter.roeck@ericsson.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lm-sensors@lm-sensors.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.