From patchwork Wed Jun 21 04:46:43 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 106038 Delivered-To: patch@linaro.org Received: by 10.140.91.2 with SMTP id y2csp1744161qgd; Tue, 20 Jun 2017 21:47:21 -0700 (PDT) X-Received: by 10.99.39.194 with SMTP id n185mr35231811pgn.94.1498020441845; Tue, 20 Jun 2017 21:47:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1498020441; cv=none; d=google.com; s=arc-20160816; b=i0e3VE0l8BJ5STn4BzY5KIznsLC2rkQu1xu+UJRoYbD8uypIAmtbAMAABiV4XEiwNA F/4aH7qWF6AzI77/5JvE2Gw2+YtfnqgOD2JWTSiIRk2vquBwiuYDLe3rpf8GShDEmlOt KGvdExrjSPicsOwaLPJkWND56xv3WZodt20XdoCeib9KqxehvJu5C9SY5iFubss8LSPx 5oqmGne60zBWFMzmZ/KrRrXOC3cy7BLujrs4NUeC396n8+97lJL7++SKiukxPyXwYDSU x8Fh43vaPccHyJ1x1mofaAz2P/tUwNTtMUwJvEiSusOfQK8QDG0FlEds1TeVblcQA9cp CK6Q== 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:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=c73WRyTByEI4Lk3G49BUjur3bjy6NdqEXRm+0XxIM78=; b=Qx6gSMwQLJQLYiRHRFotMHi65NctT9OUGSXrOKoHr2hR+bvikT7kEJS4J+lCfOQunA 7SqEVUUnQyy2WrxRagcngjxOmiHJhhyf1HHesO3HwNC8ySG3sbfTpgApamggoh++0LHB KbGpEm9Oqhj87iZEXGF/kCdQfjvQk1SzlVvw4MGf+YEHbuTDmK2jQvgstfWc/HvCliV6 p0UzmpNC9Q9mih/ensoK0w6qSzFprnRr9tMVEELLJeUE9t4r2Zjdu9lS9R13KsAQ2G9O a0Q9NbwUMNQcOk9RQK67iv2Pj20cI26dIs3dIcO5d4ob3DdwCh4Uq5b8HZYGXK9kbdyS 3Jpw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.b=BfRW8W1O; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c19si12534085pgk.501.2017.06.20.21.47.21; Tue, 20 Jun 2017 21:47:21 -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; dkim=pass header.i=@linaro.org header.b=BfRW8W1O; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753094AbdFUErS (ORCPT + 25 others); Wed, 21 Jun 2017 00:47:18 -0400 Received: from mail-pf0-f169.google.com ([209.85.192.169]:34846 "EHLO mail-pf0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753039AbdFUErP (ORCPT ); Wed, 21 Jun 2017 00:47:15 -0400 Received: by mail-pf0-f169.google.com with SMTP id c73so19479433pfk.2 for ; Tue, 20 Jun 2017 21:47:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=c73WRyTByEI4Lk3G49BUjur3bjy6NdqEXRm+0XxIM78=; b=BfRW8W1O4JZDVJIntgkb8Pk2azkzBHqOOonkZaqd9jRD2ov3KpJkZJlyK+vpz5J/EN AkmE45ImFB/Le5sjVBkM6CEJQq0l0hovenShe0++C/Hr2K4VotKUJZoS09aHZ3pJZbnY FtQ/JHU2Rgwsm2utKYguQAoR6uA+7iVpKEBsg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=c73WRyTByEI4Lk3G49BUjur3bjy6NdqEXRm+0XxIM78=; b=unPxPGO0lxiM7ke1FQHbgSgy/9/axlFvsbhqM8RdvZZz+Mx3ffUUtMlOTviOkDxp6l +XseBrwZZSmHqn3wn3C/fokIee3EdPYIESL/unRlS+07DI0x8oPe7r6hv4NmkatYBK5d fFN0XMxakq9EI11uQs/+SVqXwsGK//xYHez1jiy+A612SsWzvLXO0VwtcE705wU2aOwp /aeN0v/KV5CzjNbnlqkH2lGT92xufqZ2AqL2dy1GfVH7ngZ1di4SfkxnWyKzEc/wpcxj RqfFBmQEren8kvVQ7efSydAghGUkOLctbC7GXyZ+JvT+k1A+Bb0/PZEHhdUnmFZ3Dgdr gkVg== X-Gm-Message-State: AKS2vOy2oUmD2K2RurxOX7mX2T5tnSs3bkyzNe6P2zTWV9Xw3bR22ENv dD40CgKXaUdODaGt X-Received: by 10.98.80.140 with SMTP id g12mr34874566pfj.146.1498020424773; Tue, 20 Jun 2017 21:47:04 -0700 (PDT) Received: from localhost ([122.172.59.234]) by smtp.gmail.com with ESMTPSA id m73sm27369304pfi.12.2017.06.20.21.47.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 20 Jun 2017 21:47:04 -0700 (PDT) From: Viresh Kumar To: Juri Lelli , Greg Kroah-Hartman Cc: Viresh Kumar , linux-arm-kernel@lists.infradead.org, Catalin Marinas , linux@arm.linux.org.uk, Will Deacon , Vincent Guittot , arnd.bergmann@linaro.org, linux-kernel@vger.kernel.org Subject: [PATCH V2 4/5] arch_topology: Return 0 or -ve errors from topology_parse_cpu_capacity() Date: Wed, 21 Jun 2017 10:16:43 +0530 Message-Id: <2213a1f0657ef057dd775085943b362dc3e9757d.1498019799.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.13.0.71.gd7076ec9c9cb In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use the standard way of returning errors instead of returning 0(failure) OR 1(success) and making it hard to read. Signed-off-by: Viresh Kumar --- arch/arm/kernel/topology.c | 2 +- drivers/base/arch_topology.c | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) -- 2.13.0.71.gd7076ec9c9cb diff --git a/arch/arm/kernel/topology.c b/arch/arm/kernel/topology.c index bf949a763dbe..a7ef4c35855e 100644 --- a/arch/arm/kernel/topology.c +++ b/arch/arm/kernel/topology.c @@ -111,7 +111,7 @@ static void __init parse_dt_topology(void) continue; } - if (topology_parse_cpu_capacity(cn, cpu)) { + if (!topology_parse_cpu_capacity(cn, cpu)) { of_node_put(cn); continue; } diff --git a/drivers/base/arch_topology.c b/drivers/base/arch_topology.c index 07784ba666a7..ff8713b83090 100644 --- a/drivers/base/arch_topology.c +++ b/drivers/base/arch_topology.c @@ -121,11 +121,11 @@ void topology_normalize_cpu_scale(void) int __init topology_parse_cpu_capacity(struct device_node *cpu_node, int cpu) { - int ret = 1; + int ret; u32 cpu_capacity; if (cap_parsing_failed) - return !ret; + return -EINVAL; ret = of_property_read_u32(cpu_node, "capacity-dmips-mhz", &cpu_capacity); @@ -137,7 +137,7 @@ int __init topology_parse_cpu_capacity(struct device_node *cpu_node, int cpu) if (!raw_capacity) { pr_err("cpu_capacity: failed to allocate memory for raw capacities\n"); cap_parsing_failed = true; - return 0; + return -ENOMEM; } } capacity_scale = max(cpu_capacity, capacity_scale); @@ -154,7 +154,7 @@ int __init topology_parse_cpu_capacity(struct device_node *cpu_node, int cpu) kfree(raw_capacity); } - return !ret; + return ret; } #ifdef CONFIG_CPU_FREQ