Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1421731 > unrolled thread
| Started by | Masahiro Yamada <yamada.masahiro@socionext.com> |
|---|---|
| First post | 2016-06-14 12:10 +0200 |
| Last post | 2016-06-23 09:30 +0200 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[PATCH 1/5] gpio: of: optimize "gpios" property parsing of of_parse_own_gpio() Masahiro Yamada <yamada.masahiro@socionext.com> - 2016-06-14 12:10 +0200
Re: [PATCH 1/5] gpio: of: optimize "gpios" property parsing of of_parse_own_gpio() Linus Walleij <linus.walleij@linaro.org> - 2016-06-23 09:30 +0200
| From | Masahiro Yamada <yamada.masahiro@socionext.com> |
|---|---|
| Date | 2016-06-14 12:10 +0200 |
| Subject | [PATCH 1/5] gpio: of: optimize "gpios" property parsing of of_parse_own_gpio() |
| Message-ID | <rJTse-3r2-17@gated-at.bofh.it> |
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>
---
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) {
--
1.9.1
[toc] | [next] | [standalone]
| From | Linus Walleij <linus.walleij@linaro.org> |
|---|---|
| Date | 2016-06-23 09:30 +0200 |
| Message-ID | <rN7fj-6FF-3@gated-at.bofh.it> |
| In reply to | #1421731 |
On Tue, Jun 14, 2016 at 12:07 PM, Masahiro Yamada <yamada.masahiro@socionext.com> wrote: > 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> Thanks patch applied! In this case I think the code is so old that the read_u32_array() function didn't exist when it was written. Yours, Linus Walleij
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web