diff options
author | Borislav Petkov <bp@suse.de> | 2013-01-20 05:24:30 -0500 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2013-02-01 18:01:15 -0500 |
commit | c0939e46a84c6af89d6f093a34c1c9341dfe1d6e (patch) | |
tree | ece6b7432f578e0602d6d4f130dfd8ea577052f3 /drivers/cpufreq/powernow-k8.c | |
parent | 4827ea6ec9ca1e873a6d387a3ee287f78ea5ee83 (diff) |
powernow-k8: Cleanup init function
Make it hotplug-safe and cleanup formatting.
Signed-off-by: Borislav Petkov <bp@suse.de>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/cpufreq/powernow-k8.c')
-rw-r--r-- | drivers/cpufreq/powernow-k8.c | 25 |
1 files 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) | |||
1271 | static int __cpuinit powernowk8_init(void) | 1271 | static int __cpuinit powernowk8_init(void) |
1272 | { | 1272 | { |
1273 | unsigned int i, supported_cpus = 0; | 1273 | unsigned int i, supported_cpus = 0; |
1274 | int rv; | 1274 | int ret; |
1275 | 1275 | ||
1276 | if (static_cpu_has(X86_FEATURE_HW_PSTATE)) { | 1276 | if (static_cpu_has(X86_FEATURE_HW_PSTATE)) { |
1277 | __request_acpi_cpufreq(); | 1277 | __request_acpi_cpufreq(); |
@@ -1281,24 +1281,27 @@ static int __cpuinit powernowk8_init(void) | |||
1281 | if (!x86_match_cpu(powernow_k8_ids)) | 1281 | if (!x86_match_cpu(powernow_k8_ids)) |
1282 | return -ENODEV; | 1282 | return -ENODEV; |
1283 | 1283 | ||
1284 | get_online_cpus(); | ||
1284 | for_each_online_cpu(i) { | 1285 | for_each_online_cpu(i) { |
1285 | int rc; | 1286 | smp_call_function_single(i, check_supported_cpu, &ret, 1); |
1286 | smp_call_function_single(i, check_supported_cpu, &rc, 1); | 1287 | if (!ret) |
1287 | if (rc == 0) | ||
1288 | supported_cpus++; | 1288 | supported_cpus++; |
1289 | } | 1289 | } |
1290 | 1290 | ||
1291 | if (supported_cpus != num_online_cpus()) | 1291 | if (supported_cpus != num_online_cpus()) { |
1292 | put_online_cpus(); | ||
1292 | return -ENODEV; | 1293 | return -ENODEV; |
1294 | } | ||
1295 | put_online_cpus(); | ||
1293 | 1296 | ||
1294 | rv = cpufreq_register_driver(&cpufreq_amd64_driver); | 1297 | ret = cpufreq_register_driver(&cpufreq_amd64_driver); |
1298 | if (ret) | ||
1299 | return ret; | ||
1295 | 1300 | ||
1296 | if (!rv) | 1301 | pr_info(PFX "Found %d %s (%d cpu cores) (" VERSION ")\n", |
1297 | pr_info(PFX "Found %d %s (%d cpu cores) (" VERSION ")\n", | 1302 | num_online_nodes(), boot_cpu_data.x86_model_id, supported_cpus); |
1298 | num_online_nodes(), boot_cpu_data.x86_model_id, | ||
1299 | supported_cpus); | ||
1300 | 1303 | ||
1301 | return rv; | 1304 | return ret; |
1302 | } | 1305 | } |
1303 | 1306 | ||
1304 | /* driver entry point for term */ | 1307 | /* driver entry point for term */ |