From patchwork Sat Oct 29 14:27:14 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 688791 X-Patchwork-Delegate: scottwood@freescale.com Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3t5jhx0Fmdz9t0q for ; Sun, 30 Oct 2016 01:30:41 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=ZlnTYFFB; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3t5jhw6JfLzDvXq for ; Sun, 30 Oct 2016 01:30:40 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=ZlnTYFFB; dkim-atps=neutral X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Received: from mail-wm0-x241.google.com (mail-wm0-x241.google.com [IPv6:2a00:1450:400c:c09::241]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3t5jgM6bHjzDvT1 for ; Sun, 30 Oct 2016 01:29:19 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=ZlnTYFFB; dkim-atps=neutral Received: by mail-wm0-x241.google.com with SMTP id p190so5222040wmp.1 for ; Sat, 29 Oct 2016 07:29:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:subject:to:cc:message-id:date:user-agent:mime-version :content-transfer-encoding; bh=1gGb91CB56MMTBRjVcbRxQ8067Kxl2YuSTQED1afcHc=; b=ZlnTYFFBbY2KFb++C1GwZSTezA5Fzt9b9saKW/SQ5WvZ5KbxO2sQEuqZV/m1/YJHMt Iwx4spJ2ijfuflpIXEbMpStV+6h+hR5LYRVMUwOHbubkUFQ/94Cr21kqCL8WkMzvyqHm LLMCs8EfQ+23YtgtnVmmOQLOC1Dq5iY+P2s9VmTRZsr9sVqzlgGUENK16OcFBaiyMoKI FXS4+IjQeggKVudAaXQH33Zf6EcwrgCsrJlUYRDsz1b++6GIzM6b8wilLglVqhnkJnUm c5cZ6XjyvWCVRQLGMfAXdup2vV8BC8X0Klbg+oY88sjteibJv1YqQZZ0rrxLiPVHQs3u NnDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:subject:to:cc:message-id:date:user-agent :mime-version:content-transfer-encoding; bh=1gGb91CB56MMTBRjVcbRxQ8067Kxl2YuSTQED1afcHc=; b=C92MUmVF/46Ha9suH5r1XINwYgz4EvGuC9ncPmDyBvSxdultvnuHx/tKrUEd+WNPEJ cnRXv/a3sN6zbIwyNuoBB6p2in7dZ2jDlc1OUG7WMkflPpCwaAlABCHSw6zsWUKXKivD EWUrcjwhmvpXV/GrOp6Io8QsmlTCe+Th6TAVC/KMOnM260dv6q2p/p+1dgQOx0nAU8ac XFC6YcS7wY66dlBGVoVvcusQ7wdi7fVGr5UI7Cuu79c29qn0nypbUnKDp8VtSLBL4zgx 52NTqFMPkTKENiQjJLlY1CxmXnsH1wRjoI97KU04F3yOeosIZ00/5maOPS5Dcf5aWmgz xXAg== X-Gm-Message-State: ABUngvdOTL5AyOXF/m6wVRUOTs06DC3nefqafKDMsjZHDk9/R+T5ZsR0YHvoy9X9IwVSGA== X-Received: by 10.194.87.7 with SMTP id t7mr15263719wjz.196.1477751356760; Sat, 29 Oct 2016 07:29:16 -0700 (PDT) Received: from ?IPv6:2003:62:5f43:4700:f53f:2b80:9e4e:1ff0? (p200300625F434700F53F2B809E4E1FF0.dip0.t-ipconnect.de. [2003:62:5f43:4700:f53f:2b80:9e4e:1ff0]) by smtp.googlemail.com with ESMTPSA id h2sm9053371wjy.40.2016.10.29.07.29.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 29 Oct 2016 07:29:16 -0700 (PDT) From: Heiner Kallweit Subject: [PATCH 1/3] powerpc/fsl_soc: improve and simplify fsl_get_sys_freq To: Michael Ellerman Message-ID: Date: Sat, 29 Oct 2016 16:27:14 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linuxppc-dev@lists.ozlabs.org Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" Use of_property_read_u32 instead of the generic of_get_property to simplify the code. In addition move the declaration of sysfreq into fsl_get_sys_freq because it's private to this function. Signed-off-by: Heiner Kallweit --- arch/powerpc/sysdev/fsl_soc.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/arch/powerpc/sysdev/fsl_soc.c b/arch/powerpc/sysdev/fsl_soc.c index d93056e..48fc36b 100644 --- a/arch/powerpc/sysdev/fsl_soc.c +++ b/arch/powerpc/sysdev/fsl_soc.c @@ -77,13 +77,10 @@ phys_addr_t get_immrbase(void) EXPORT_SYMBOL(get_immrbase); -static u32 sysfreq = -1; - u32 fsl_get_sys_freq(void) { + static u32 sysfreq = -1; struct device_node *soc; - const u32 *prop; - int size; if (sysfreq != -1) return sysfreq; @@ -92,12 +89,9 @@ u32 fsl_get_sys_freq(void) if (!soc) return -1; - prop = of_get_property(soc, "clock-frequency", &size); - if (!prop || size != sizeof(*prop) || *prop == 0) - prop = of_get_property(soc, "bus-frequency", &size); - - if (prop && size == sizeof(*prop)) - sysfreq = *prop; + of_property_read_u32(soc, "clock-frequency", &sysfreq); + if (sysfreq == -1 || !sysfreq) + of_property_read_u32(soc, "bus-frequency", &sysfreq); of_node_put(soc); return sysfreq;