summaryrefslogtreecommitdiffstats
path: root/drivers/gpio
diff options
context:
space:
mode:
authorMasahiro Yamada <yamada.masahiro@socionext.com>2016-06-14 19:07:03 +0900
committerLinus Walleij <linus.walleij@linaro.org>2016-06-23 11:07:10 +0200
commit3f9547e1c9f06219c5788668ea2f7495d3b13f60 (patch)
tree8d96c64399cbbc54508ca247be507b4ed98033c3 /drivers/gpio
parent7e7c059cb50c7c72d5a393b2c34fc57de1b01b55 (diff)
downloadlinux-3f9547e1c9f06219c5788668ea2f7495d3b13f60.tar.bz2
gpio: of: optimize "gpios" property parsing of of_parse_own_gpio()
Call of_property_read_u32_array() only once rather than iterating of_property_read_u32_index(). Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/gpio')
-rw-r--r--drivers/gpio/gpiolib-of.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c
index d8c36c1bf850..6b866fc4657d 100644
--- a/drivers/gpio/gpiolib-of.c
+++ b/drivers/gpio/gpiolib-of.c
@@ -140,7 +140,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)
@@ -159,12 +159,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) {