From patchwork Tue Sep 11 02:12:21 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Barry Song X-Patchwork-Id: 1434811 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id 2D23DDF28C for ; Tue, 11 Sep 2012 02:16:46 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TBFzF-0005kq-J5; Tue, 11 Sep 2012 02:14:01 +0000 Received: from cluster-g.mailcontrol.com ([208.87.233.190]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1TBFzB-0005kc-V0 for linux-arm-kernel@lists.infradead.org; Tue, 11 Sep 2012 02:13:58 +0000 Received: from rly29g.srv.mailcontrol.com (localhost.localdomain [127.0.0.1]) by rly29g.srv.mailcontrol.com (MailControl) with ESMTP id q8B2DsWx014691 for ; Tue, 11 Sep 2012 03:13:54 +0100 Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by rly29g.srv.mailcontrol.com (MailControl) id q8B2DH1o011163 for ; Tue, 11 Sep 2012 03:13:17 +0100 Received: from banasiexc01.ASIA.ROOT.PRI ([202.80.51.114]) by rly29g-eth0.srv.mailcontrol.com (envelope-sender ) (MIMEDefang) with ESMTP id q8B2DDQ2010834 (TLS bits=128 verify=FAIL); Tue, 11 Sep 2012 03:13:17 +0100 (BST) Received: from SHAASIEXC02.ASIA.ROOT.PRI (10.125.12.85) by banasiexc01.ASIA.ROOT.PRI (10.190.12.21) with Microsoft SMTP Server (TLS) id 14.1.355.2; Tue, 11 Sep 2012 07:43:13 +0530 Received: from localhost.localdomain (10.125.36.195) by asimail.csr.com (10.125.12.88) with Microsoft SMTP Server (TLS) id 14.1.355.2; Tue, 11 Sep 2012 10:13:11 +0800 From: Barry Song To: , Subject: [PATCH v2] ARM: PRIMA2: rstc: Use helper function to read u32 values Date: Tue, 11 Sep 2012 10:12:21 +0800 Message-ID: <1347329541-9110-1-git-send-email-Barry.Song@csr.com> X-Mailer: git-send-email 1.7.1 MIME-Version: 1.0 X-Originating-IP: [10.125.36.195] X-Scanned-By: MailControl 9446.0 (www.mailcontrol.com) on 10.71.1.139 X-Spam-Note: CRM114 invocation failed X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [208.87.233.190 listed in list.dnswl.org] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: linux-arm-kernel@lists.infradead.org, Barry Song X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Barry Song Use helper function of_property_read_u32() in place of of_get_property and be32_to_cpup() api's for code optimization. Signed-off-by: Barry Song --- -v2: add patch description arch/arm/mach-prima2/rstc.c | 9 +++------ 1 files changed, 3 insertions(+), 6 deletions(-) diff --git a/arch/arm/mach-prima2/rstc.c b/arch/arm/mach-prima2/rstc.c index 762adb7..d03ff19 100644 --- a/arch/arm/mach-prima2/rstc.c +++ b/arch/arm/mach-prima2/rstc.c @@ -42,13 +42,10 @@ early_initcall(sirfsoc_of_rstc_init); int sirfsoc_reset_device(struct device *dev) { - const unsigned int *prop = of_get_property(dev->of_node, "reset-bit", NULL); - unsigned int reset_bit; + u32 reset_bit; - if (!prop) - return -ENODEV; - - reset_bit = be32_to_cpup(prop); + if (of_property_read_u32(dev->of_node, "reset-bit", &reset_bit)) + return -EINVAL; mutex_lock(&rstc_lock);