From patchwork Sun Jan 20 10:24:30 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Borislav Petkov X-Patchwork-Id: 2008081 Return-Path: X-Original-To: patchwork-linux-acpi@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 76C85DF264 for ; Sun, 20 Jan 2013 10:26:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751946Ab3ATKZh (ORCPT ); Sun, 20 Jan 2013 05:25:37 -0500 Received: from mail.skyhub.de ([78.46.96.112]:41427 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751887Ab3ATKYl (ORCPT ); Sun, 20 Jan 2013 05:24:41 -0500 X-Virus-Scanned: Nedap ESD1 at mail.skyhub.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alien8.de; s=alien8; t=1358677478; bh=jPCA0ReaSjt7ZrNBySpKhZZv7OmAgd+DoEfvXckWzPM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=ad5s M+aF2/0jSWvFn/nTp3KS2mfWYAciDsLmhHePP+v/M353ECXhAAJVLmhWuqBmUnz2nDh 6Vtn+pMwTp5rBsC/nzl92HlA2ZTJj6NZjoPf5Uin4er016JZuDv+pFOW614TV8P0RIN m6H7PIyCeuJnY/UjtAqG+LekEMXsMBflw= Received: from mail.skyhub.de ([127.0.0.1]) by localhost (door.skyhub.de [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id RmXU3b-UJSOT; Sun, 20 Jan 2013 11:24:38 +0100 (CET) Received: from liondog.tnic (p4FF1D70B.dip.t-dialin.net [79.241.215.11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id C71291DA20E; Sun, 20 Jan 2013 11:24:37 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alien8.de; s=alien8; t=1358677478; bh=jPCA0ReaSjt7ZrNBySpKhZZv7OmAgd+DoEfvXckWzPM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=ad5s M+aF2/0jSWvFn/nTp3KS2mfWYAciDsLmhHePP+v/M353ECXhAAJVLmhWuqBmUnz2nDh 6Vtn+pMwTp5rBsC/nzl92HlA2ZTJj6NZjoPf5Uin4er016JZuDv+pFOW614TV8P0RIN m6H7PIyCeuJnY/UjtAqG+LekEMXsMBflw= Received: by liondog.tnic (Postfix, from userid 1000) id CF9BF10186A; Sun, 20 Jan 2013 11:24:36 +0100 (CET) From: Borislav Petkov To: "Rafael J. Wysocki" Cc: =?UTF-8?q?Andr=C3=A9=20Przywara?= , Leonid Isaev , Tom Gundersen , cpufreq@vger.kernel.org, linux-acpi@vger.kernel.org, LKML , Borislav Petkov Subject: [PATCH 6/6] powernow-k8: Cleanup init function Date: Sun, 20 Jan 2013 11:24:30 +0100 Message-Id: <1358677470-17394-7-git-send-email-bp@alien8.de> X-Mailer: git-send-email 1.8.1.rc3 In-Reply-To: <1358677470-17394-1-git-send-email-bp@alien8.de> References: <1358677470-17394-1-git-send-email-bp@alien8.de> Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org From: Borislav Petkov Make it hotplug-safe and cleanup formatting. Signed-off-by: Borislav Petkov --- 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 */