From patchwork Sat Oct 29 14:29:04 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 688793 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 3t5jmX4Jlkz9t1B for ; Sun, 30 Oct 2016 01:33:48 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=DSrxR5Fb; 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 3t5jmX36M3zDvdb for ; Sun, 30 Oct 2016 01:33:48 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=DSrxR5Fb; dkim-atps=neutral X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Received: from mail-wm0-x242.google.com (mail-wm0-x242.google.com [IPv6:2a00:1450:400c:c09::242]) (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 3t5jgQ06SHzDvT4 for ; Sun, 30 Oct 2016 01:29:22 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=DSrxR5Fb; dkim-atps=neutral Received: by mail-wm0-x242.google.com with SMTP id 68so4715480wmz.2 for ; Sat, 29 Oct 2016 07:29:21 -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=+745uUgGOs/EC5aVmqBcILXLZqpHDY/fzzK6J9+FuJU=; b=DSrxR5FbbFBMYrK7z8xro3fnJBYIoQOIH2baWMO+P/lBmTRcL9TkavTEM2mrWrsfKi UJeoPK3CEx41B+rHqiIGlFsq2bxGb4n/TN8uRDV9Yn+MSdIcfx5U5h+cknNbohcUI2+Z /qiZ3in2RfWl8qvSavOD6qLUxtd3etWfQA7iQ4ve/vxN3f6La4uZNKG0Jd3XHGlxF2F4 aOLggGDf9AmG2u8j06g0j3pZMB+ifRzYj2W9IUVK9noPWkf+WNwToEBxZZDhJsr//R30 Ng3t/cFZ+qGJx9cLuvreoPTocX36FZSqPpE1MucwgJavR8tI9PpQv/nCE/b13kwEP6pt vz9g== 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=+745uUgGOs/EC5aVmqBcILXLZqpHDY/fzzK6J9+FuJU=; b=h59Wecu+lyElOrH90ylSjiq8KALCCOPs2uh+LsF7SxjTbkiyBHAgO1uaJiQw1GCxih upHOTeTGSa3wB+ds6959gLVbkNFgYhkwumfPwjhqtW7wU2kyVLAK0TmRcKwFnikdrYG+ AVSTk44aMzmcdDFcfRd5j7ExjmgtCuU4gyx/TG4A7PJgnDg1RdS80UhGl6Dz0bBGt8lD 9vASqQnGrLJidX18RgLczJAKdgRdrBWXL63dQoO7Dz3ZD3bQ0I7a9xvmHFWuenosL1GV 67281eerSbNuGV8qJv3c1NEzDD1eYSMEjjDNFsmDZfDcw++VtHDcEVyK2tORvqhTMAdu HR8A== X-Gm-Message-State: ABUngveMZXMX4SwDa98lmB+4IYzN7viuDWUUUllfIublinTf/z17U6NZJnQQ5QLislgKdA== X-Received: by 10.194.176.232 with SMTP id cl8mr15557452wjc.225.1477751359231; Sat, 29 Oct 2016 07:29:19 -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 y2sm19659068wjx.20.2016.10.29.07.29.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 29 Oct 2016 07:29:18 -0700 (PDT) From: Heiner Kallweit Subject: [PATCH 3/3] powerpc/fsl_soc: improve and simplify get_baudrate To: Michael Ellerman Message-ID: Date: Sat, 29 Oct 2016 16:29:04 +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 fs_baudrate into get_baudrate because it's private to this function. Signed-off-by: Heiner Kallweit --- arch/powerpc/sysdev/fsl_soc.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/arch/powerpc/sysdev/fsl_soc.c b/arch/powerpc/sysdev/fsl_soc.c index d418424..0c542f1 100644 --- a/arch/powerpc/sysdev/fsl_soc.c +++ b/arch/powerpc/sysdev/fsl_soc.c @@ -136,10 +136,9 @@ u32 get_brgfreq(void) EXPORT_SYMBOL(get_brgfreq); -static u32 fs_baudrate = -1; - u32 get_baudrate(void) { + static u32 fs_baudrate = -1; struct device_node *node; if (fs_baudrate != -1) @@ -147,12 +146,7 @@ u32 get_baudrate(void) node = of_find_node_by_type(NULL, "serial"); if (node) { - int size; - const unsigned int *prop = of_get_property(node, - "current-speed", &size); - - if (prop) - fs_baudrate = *prop; + of_property_read_u32(node, "current-speed", &fs_baudrate); of_node_put(node); }