From patchwork Tue Jun 14 10:07:03 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 69982 Delivered-To: patch@linaro.org Received: by 10.140.106.246 with SMTP id e109csp1963158qgf; Tue, 14 Jun 2016 03:07:08 -0700 (PDT) X-Received: by 10.107.38.145 with SMTP id m139mr30406523iom.15.1465898828577; Tue, 14 Jun 2016 03:07:08 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f6si6176620pfc.249.2016.06.14.03.07.08; Tue, 14 Jun 2016 03:07:08 -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=@nifty.com; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752338AbcFNKHF (ORCPT + 30 others); Tue, 14 Jun 2016 06:07:05 -0400 Received: from conuserg-08.nifty.com ([210.131.2.75]:55848 "EHLO conuserg-08.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751512AbcFNKGg (ORCPT ); Tue, 14 Jun 2016 06:06:36 -0400 Received: from beagle.diag.org (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-08.nifty.com with ESMTP id u5EA5ngE003372; Tue, 14 Jun 2016 19:05:50 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com u5EA5ngE003372 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1465898751; bh=g1UbmUFm0d0wTt540syhjP10BYqwDkH6BL8yapcs6F8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mrH8KLP/o0xT8bDI4zqe14FJsisXvTD4b1BJGn509muYMZyrHJ88XY8LTg9IpSbG/ 9mKedv7IaiOoVGYOrcXtEqRfe0fRCbioESrwCk2w4RQK+YyTGzeULjx2UGdUx5KLKM z1XkEydbMJQkpj4cThL4h7HgRp6RVcUszjGOsGtI3vAAVdWVXA4yksbAGF9EflL6sS xMagFSR5Ku71/dYi/peKQfxwKVoBTl5p7r5ceDoeTD/LdxZiNtDelSzqBcmOBkDxHQ 8sw6Rcz/86AhGuRvgCX4uHOWKmKSGhwVD1LE1VVrXBT02/id2rOL6WTpAPWdVcdWGQ 53Rpf6k8+cCUw== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-gpio@vger.kernel.org Cc: Masahiro Yamada , Linus Walleij , Alexandre Courbot , linux-kernel@vger.kernel.org Subject: [PATCH 1/5] gpio: of: optimize "gpios" property parsing of of_parse_own_gpio() Date: Tue, 14 Jun 2016 19:07:03 +0900 Message-Id: <1465898827-2229-2-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1465898827-2229-1-git-send-email-yamada.masahiro@socionext.com> References: <1465898827-2229-1-git-send-email-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Call of_property_read_u32_array() only once rather than iterating of_property_read_u32_index(). Signed-off-by: Masahiro Yamada --- drivers/gpio/gpiolib-of.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) -- 1.9.1 diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c index 0e963ef..99fc40e 100644 --- a/drivers/gpio/gpiolib-of.c +++ b/drivers/gpio/gpiolib-of.c @@ -141,7 +141,7 @@ static struct gpio_desc *of_parse_own_gpio(struct device_node *np, .flags = &xlate_flags, }; u32 tmp; - int i, ret; + int ret; chip_np = np->parent; if (!chip_np) @@ -160,12 +160,10 @@ static struct gpio_desc *of_parse_own_gpio(struct device_node *np, gg_data.gpiospec.args_count = tmp; gg_data.gpiospec.np = chip_np; - for (i = 0; i < tmp; i++) { - ret = of_property_read_u32_index(np, "gpios", i, - &gg_data.gpiospec.args[i]); - if (ret) - return ERR_PTR(ret); - } + ret = of_property_read_u32_array(np, "gpios", gg_data.gpiospec.args, + tmp); + if (ret) + return ERR_PTR(ret); gpiochip_find(&gg_data, of_gpiochip_find_and_xlate); if (!gg_data.out_gpio) {