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: 635150 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3rTQLm4ngmz9t0q for ; Tue, 14 Jun 2016 20:07:44 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=nifty.com header.i=@nifty.com header.b=mrH8KLP/; dkim-atps=neutral Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751618AbcFNKHC (ORCPT ); Tue, 14 Jun 2016 06:07:02 -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-gpio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-gpio@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(-) 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) {