Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1429540

Re: [PATCH 4/5] gpio: of: remove of_gpiochip_and_xlate() and struct gg_data

From Linus Walleij <linus.walleij@linaro.org>
Newsgroups linux.kernel
Subject Re: [PATCH 4/5] gpio: of: remove of_gpiochip_and_xlate() and struct gg_data
Date 2016-06-23 09:50 +0200
Message-ID <rN7yG-6MX-43@gated-at.bofh.it> (permalink)
References <rJTsd-3r2-3@gated-at.bofh.it> <rJTse-3r2-23@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Tue, Jun 14, 2016 at 12:07 PM, Masahiro Yamada
<yamada.masahiro@socionext.com> wrote:

> The usage of gpiochip_find(&gg_data, of_gpiochip_and_xlate) is odd.
>
> Usually gpiochip_find() is used to find a gpio_chip.  Here, however,
> the return value from gpiochip_find() is just discarded.  Instead,
> gpiochip_find(&gg_data, of_gpiochip_and_xlate) is called for the
> side-effect of the match function.
>
> The match function, of_gpiochip_find_and_xlate(), fills the given
> struct gg_data, but a match function should be simply called to
> judge the matching.
>
> This commit fixes this distortion and makes the code more readable.
> Remove of_gpiochip_find_and_xlate() and struct gg_data.  Instead,
> this adds a very simple helper function of_find_gpiochip_by_node().
> Now, of_get_named_gpiod_flags() is implemented more straight-forward.
>
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

Excellent patch, this always confused me too. Now I understand
the code.

Patch applied.

Yours,
Linus Walleij

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/5] gpio: refactor of_parse_own_gpio() and of_get_named_gpiod_flags() Masahiro Yamada <yamada.masahiro@socionext.com> - 2016-06-14 12:10 +0200
  [PATCH 2/5] gpio: of: drop needless gpio_chip look-up in of_parse_own_gpio() Masahiro Yamada <yamada.masahiro@socionext.com> - 2016-06-14 12:10 +0200
    Re: [PATCH 2/5] gpio: of: drop needless gpio_chip look-up in of_parse_own_gpio() Linus Walleij <linus.walleij@linaro.org> - 2016-06-23 09:40 +0200
  [PATCH 4/5] gpio: of: remove of_gpiochip_and_xlate() and struct gg_data Masahiro Yamada <yamada.masahiro@socionext.com> - 2016-06-14 12:10 +0200
    Re: [PATCH 4/5] gpio: of: remove of_gpiochip_and_xlate() and struct gg_data Linus Walleij <linus.walleij@linaro.org> - 2016-06-23 09:50 +0200
  Re: [PATCH 0/5] gpio: refactor of_parse_own_gpio() and of_get_named_gpiod_flags() Linus Walleij <linus.walleij@linaro.org> - 2016-06-23 09:50 +0200

csiph-web