From patchwork Wed Sep 16 15:18:56 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tobias Klauser X-Patchwork-Id: 7195991 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 51B4ABEEC1 for ; Wed, 16 Sep 2015 15:21:22 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7F9BB2087C for ; Wed, 16 Sep 2015 15:21:21 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2625020876 for ; Wed, 16 Sep 2015 15:21:20 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZcEUg-0000du-6P; Wed, 16 Sep 2015 15:19:34 +0000 Received: from mail.zhinst.com ([212.126.164.98]) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZcEUc-0000ZE-U7 for linux-arm-kernel@lists.infradead.org; Wed, 16 Sep 2015 15:19:32 +0000 Received: from ziws06.zhinst.com ([10.42.0.71]) by mail.zhinst.com (Kerio Connect 8.5.2); Wed, 16 Sep 2015 17:18:56 +0200 From: Tobias Klauser To: Russell King Subject: [PATCH] ARM: topology: Use of_property_read_u32 instead of open-coding it Date: Wed, 16 Sep 2015 17:18:56 +0200 Message-Id: <1442416736-10185-1-git-send-email-tklauser@distanz.ch> X-Mailer: git-send-email 2.5.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150916_081931_145980_5ECE0D92 X-CRM114-Status: UNSURE ( 9.30 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -2.6 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Use of_property_read_u32 to read the "clock-frequency" property instead of using of_get_property with return value checks and endianness conversion. Signed-off-by: Tobias Klauser --- arch/arm/kernel/topology.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/arch/arm/kernel/topology.c b/arch/arm/kernel/topology.c index 08b7847..615a13c 100644 --- a/arch/arm/kernel/topology.c +++ b/arch/arm/kernel/topology.c @@ -100,8 +100,7 @@ static void __init parse_dt_topology(void) GFP_NOWAIT); for_each_possible_cpu(cpu) { - const u32 *rate; - int len; + u32 rate; /* too early to use cpu->of_node */ cn = of_get_cpu_node(cpu, NULL); @@ -117,14 +116,13 @@ static void __init parse_dt_topology(void) if (cpu_eff->compatible == NULL) continue; - rate = of_get_property(cn, "clock-frequency", &len); - if (!rate || len != 4) { + if (of_property_read_u32(cn, "clock-frequency", &rate)) { pr_err("%s missing clock-frequency property\n", cn->full_name); continue; } - capacity = ((be32_to_cpup(rate)) >> 20) * cpu_eff->efficiency; + capacity = (rate >> 20) * cpu_eff->efficiency; /* Save min capacity of the system */ if (capacity < min_capacity)