From patchwork Wed May 31 16:59:29 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juri Lelli X-Patchwork-Id: 100805 Delivered-To: patch@linaro.org Received: by 10.140.96.100 with SMTP id j91csp418796qge; Wed, 31 May 2017 10:03:47 -0700 (PDT) X-Received: by 10.99.2.3 with SMTP id 3mr32992718pgc.17.1496250227584; Wed, 31 May 2017 10:03:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1496250227; cv=none; d=google.com; s=arc-20160816; b=X4L2yu7unN59gqIgOuyZzdsiUR4dy4Rijd2Unlz42/K9bv3z2btTy+VA8DLXy9mgHF qhM0gl62nDKaw3wY7WNe9Nwz4lYNA63i9XQpvtNSq3RkhqOErukBye07z+W1sFpDg90p 5r7KDou7OyWR40rmFccuxcv7M32NjFb+Ao4Js762Tpi+I1nSYB1XWfRuV4wPk5rxXbVU qbB67CmtP/y6GRG7BkLJKWkYBXohUYgOfG6y1v69REm4wSLPTmnU5vbXq44M7J7ozxox XxduC9RQ9omqviyO9qVxQ4isF4FgrSzYhK48oOsxmIwPzJXsrKpM58hElwYbnxaRBHvv KspQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=V8tMCCKS7g+j6k/U5BzD8JhPsYUi84HDCCiBUG84l1k=; b=0HkmoWeSMJRF0+S0JeRCfioY4Hv/pVOAVo+gPrlx2ecDrDnavGjYUZBIhhYDIuYxJX Bc6/m2otC7zCmMh4EZKGUlMVsm7JXy1I/YMGdB8N24O2MD2fw0pB/ezajDx+IPSxpfmH rZlI/rTWaes7aMQjVCN0xc8T3QbpqbY7hK+21F6dkepLpL62HTIgt/FsT15JsEmkak6Z pnRGfkCkrZsyWqPE6xzhXO1K3L6UuhZMpt3xsB8RSDW2G81gbARrqr/ZGfxKfC/SZus2 7/5fPngFROulob7TS+KQv8Qv7rZfv3LCx8CTtnTVqVGjuFS+xC93BnQEB+2XDzk/o9Cm 9Hrw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d7si48869757pln.333.2017.05.31.10.03.47; Wed, 31 May 2017 10:03:47 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751397AbdEaRAk (ORCPT + 25 others); Wed, 31 May 2017 13:00:40 -0400 Received: from foss.arm.com ([217.140.101.70]:46856 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751190AbdEaRAE (ORCPT ); Wed, 31 May 2017 13:00:04 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 5559E165C; Wed, 31 May 2017 10:00:04 -0700 (PDT) Received: from cam-smtp0.cambridge.arm.com (e106622-lin.cambridge.arm.com [10.1.211.43]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 766EC3F589; Wed, 31 May 2017 10:00:01 -0700 (PDT) From: Juri Lelli To: linux-kernel@vger.kernel.org Cc: linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, peterz@infradead.org, vincent.guittot@linaro.org, robh+dt@kernel.org, mark.rutland@arm.com, linux@arm.linux.org.uk, sudeep.holla@arm.com, lorenzo.pieralisi@arm.com, catalin.marinas@arm.com, will.deacon@arm.com, morten.rasmussen@arm.com, dietmar.eggemann@arm.com, juri.lelli@arm.com, broonie@kernel.org, gregkh@linuxfoundation.org Subject: [PATCH v5 5/7] arm, arm64, drivers: reduce scope of cap_parsing_failed Date: Wed, 31 May 2017 17:59:29 +0100 Message-Id: <20170531165931.6945-6-juri.lelli@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170531165931.6945-1-juri.lelli@arm.com> References: <20170531165931.6945-1-juri.lelli@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Reduce the scope of cap_parsing_failed (making it static in drivers/base/arch_topology.c) by slightly changing {arm,arm64} DT parsing code. For arm checking for !cap_parsing_failed before calling normalize_ cpu_capacity() is superfluous, as returning an error from parse_ cpu_capacity() (above) means cap_from _dt is set to false. For arm64 we can simply check if raw_capacity points to something, which is not if capacity parsing has failed. Suggested-by: Morten Rasmussen Signed-off-by: Juri Lelli Acked-by: Russell King Acked-by: Catalin Marinas Acked-by: Greg Kroah-Hartman --- arch/arm/kernel/topology.c | 3 +-- arch/arm64/kernel/topology.c | 5 +---- drivers/base/arch_topology.c | 4 ++-- 3 files changed, 4 insertions(+), 8 deletions(-) -- 2.11.0 diff --git a/arch/arm/kernel/topology.c b/arch/arm/kernel/topology.c index 49ef025ffaa0..1e35a3265ddf 100644 --- a/arch/arm/kernel/topology.c +++ b/arch/arm/kernel/topology.c @@ -76,7 +76,6 @@ static unsigned long *__cpu_capacity; static unsigned long middle_capacity = 1; static bool cap_from_dt = true; -extern bool cap_parsing_failed; extern void normalize_cpu_capacity(void); extern int __init parse_cpu_capacity(struct device_node *cpu_node, int cpu); @@ -165,7 +164,7 @@ static void __init parse_dt_topology(void) middle_capacity = ((max_capacity / 3) >> (SCHED_CAPACITY_SHIFT-1)) + 1; - if (cap_from_dt && !cap_parsing_failed) + if (cap_from_dt) normalize_cpu_capacity(); } diff --git a/arch/arm64/kernel/topology.c b/arch/arm64/kernel/topology.c index c5bc31eb97e8..7e1f6f75185b 100644 --- a/arch/arm64/kernel/topology.c +++ b/arch/arm64/kernel/topology.c @@ -27,7 +27,6 @@ #include #include -extern bool cap_parsing_failed; extern void normalize_cpu_capacity(void); extern int __init parse_cpu_capacity(struct device_node *cpu_node, int cpu); @@ -187,10 +186,8 @@ static int __init parse_dt_topology(void) * cluster with restricted subnodes. */ map = of_get_child_by_name(cn, "cpu-map"); - if (!map) { - cap_parsing_failed = true; + if (!map) goto out; - } ret = parse_cluster(map, 0); if (ret != 0) diff --git a/drivers/base/arch_topology.c b/drivers/base/arch_topology.c index 097834f0fcd7..acf99372c5cf 100644 --- a/drivers/base/arch_topology.c +++ b/drivers/base/arch_topology.c @@ -95,7 +95,7 @@ subsys_initcall(register_cpu_capacity_sysctl); static u32 capacity_scale; static u32 *raw_capacity; -bool cap_parsing_failed; +static bool cap_parsing_failed; void normalize_cpu_capacity(void) { @@ -210,7 +210,7 @@ static int __init register_cpufreq_notifier(void) * until we have the necessary code to parse the cpu capacity, so * skip registering cpufreq notifier. */ - if (!acpi_disabled || cap_parsing_failed) + if (!acpi_disabled || !raw_capacity) return -EINVAL; if (!alloc_cpumask_var(&cpus_to_visit, GFP_KERNEL)) {