All of lore.kernel.org
 help / color / mirror / Atom feed
From: Borislav Petkov <bp@alien8.de>
To: "Rafael J. Wysocki" <rjw@sisk.pl>
Cc: "André Przywara" <andre@andrep.de>,
	"Leonid Isaev" <lisaev@umail.iu.edu>,
	"Tom Gundersen" <teg@jklm.no>,
	cpufreq@vger.kernel.org, linux-acpi@vger.kernel.org,
	LKML <linux-kernel@vger.kernel.org>,
	"Borislav Petkov" <bp@suse.de>
Subject: [PATCH 6/6] powernow-k8: Cleanup init function
Date: Sun, 20 Jan 2013 11:24:30 +0100	[thread overview]
Message-ID: <1358677470-17394-7-git-send-email-bp@alien8.de> (raw)
In-Reply-To: <1358677470-17394-1-git-send-email-bp@alien8.de>

From: Borislav Petkov <bp@suse.de>

Make it hotplug-safe and cleanup formatting.

Signed-off-by: Borislav Petkov <bp@suse.de>
---
 drivers/cpufreq/powernow-k8.c | 25 ++++++++++++++-----------
 1 file changed, 14 insertions(+), 11 deletions(-)

diff --git a/drivers/cpufreq/powernow-k8.c b/drivers/cpufreq/powernow-k8.c
index 0234d0c6d68c..d13a13678b5f 100644
--- a/drivers/cpufreq/powernow-k8.c
+++ b/drivers/cpufreq/powernow-k8.c
@@ -1271,7 +1271,7 @@ static void __request_acpi_cpufreq(void)
 static int __cpuinit powernowk8_init(void)
 {
 	unsigned int i, supported_cpus = 0;
-	int rv;
+	int ret;
 
 	if (static_cpu_has(X86_FEATURE_HW_PSTATE)) {
 		__request_acpi_cpufreq();
@@ -1281,24 +1281,27 @@ static int __cpuinit powernowk8_init(void)
 	if (!x86_match_cpu(powernow_k8_ids))
 		return -ENODEV;
 
+	get_online_cpus();
 	for_each_online_cpu(i) {
-		int rc;
-		smp_call_function_single(i, check_supported_cpu, &rc, 1);
-		if (rc == 0)
+		smp_call_function_single(i, check_supported_cpu, &ret, 1);
+		if (!ret)
 			supported_cpus++;
 	}
 
-	if (supported_cpus != num_online_cpus())
+	if (supported_cpus != num_online_cpus()) {
+		put_online_cpus();
 		return -ENODEV;
+	}
+	put_online_cpus();
 
-	rv = cpufreq_register_driver(&cpufreq_amd64_driver);
+	ret = cpufreq_register_driver(&cpufreq_amd64_driver);
+	if (ret)
+		return ret;
 
-	if (!rv)
-		pr_info(PFX "Found %d %s (%d cpu cores) (" VERSION ")\n",
-			num_online_nodes(), boot_cpu_data.x86_model_id,
-			supported_cpus);
+	pr_info(PFX "Found %d %s (%d cpu cores) (" VERSION ")\n",
+		num_online_nodes(), boot_cpu_data.x86_model_id, supported_cpus);
 
-	return rv;
+	return ret;
 }
 
 /* driver entry point for term */
-- 
1.8.1.rc3

  parent reply	other threads:[~2013-01-20 10:24 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-20 10:24 [PATCH 0/6] acpi-cpufreq and powernow-k8 fixes Borislav Petkov
2013-01-20 10:24 ` [PATCH 1/6] powernow-k8: Add a kconfig dependency on acpi-cpufreq Borislav Petkov
2013-01-20 10:24 ` [PATCH 2/6] acpi-cpufreq: Do not load on K8 Borislav Petkov
2013-01-20 10:24 ` [PATCH 3/6] cpufreq: Make acpi-cpufreq link first Borislav Petkov
2013-01-20 10:24 ` [PATCH 4/6] cpufreq: Add a get_current_driver helper Borislav Petkov
2013-01-28  4:37   ` Viresh Kumar
2013-01-28  9:49     ` Borislav Petkov
2013-01-28  9:49       ` Borislav Petkov
2013-01-28  9:52       ` Viresh Kumar
2013-01-20 10:24 ` [PATCH 5/6] powernow-k8: Cleanup module request Borislav Petkov
2013-01-20 10:24 ` Borislav Petkov [this message]
2013-01-20 14:18 ` [PATCH 0/6] acpi-cpufreq and powernow-k8 fixes Rafael J. Wysocki
2013-01-21  0:04   ` Borislav Petkov
2013-01-21  0:13     ` Rafael J. Wysocki
2013-01-22 14:00 ` Rafael J. Wysocki

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=1358677470-17394-7-git-send-email-bp@alien8.de \
    --to=bp@alien8.de \
    --cc=andre@andrep.de \
    --cc=bp@suse.de \
    --cc=cpufreq@vger.kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lisaev@umail.iu.edu \
    --cc=rjw@sisk.pl \
    --cc=teg@jklm.no \
    /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.