linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Linus Walleij <linus.walleij@linaro.org>
To: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: "linux-gpio@vger.kernel.org" <linux-gpio@vger.kernel.org>,
	Alexandre Courbot <gnurou@gmail.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 4/5] gpio: of: remove of_gpiochip_and_xlate() and struct gg_data
Date: Thu, 23 Jun 2016 09:41:20 +0200	[thread overview]
Message-ID: <CACRpkdaOHA03oArvish8v95vB=usAtdSMnQwj2CsK-DDwCxVig@mail.gmail.com> (raw)
In-Reply-To: <1465898827-2229-5-git-send-email-yamada.masahiro@socionext.com>

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

  reply	other threads:[~2016-06-23  7:41 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-14 10:07 [PATCH 0/5] gpio: refactor of_parse_own_gpio() and of_get_named_gpiod_flags() Masahiro Yamada
2016-06-14 10:07 ` [PATCH 1/5] gpio: of: optimize "gpios" property parsing of of_parse_own_gpio() Masahiro Yamada
2016-06-23  7:23   ` Linus Walleij
2016-06-14 10:07 ` [PATCH 2/5] gpio: of: drop needless gpio_chip look-up in of_parse_own_gpio() Masahiro Yamada
2016-06-23  7:34   ` Linus Walleij
2016-06-14 10:07 ` [PATCH 3/5] gpio: of: move chip->of_gpio_n_cells checking to of_gpiochip_add() Masahiro Yamada
2016-06-23  7:36   ` Linus Walleij
2016-06-14 10:07 ` [PATCH 4/5] gpio: of: remove of_gpiochip_and_xlate() and struct gg_data Masahiro Yamada
2016-06-23  7:41   ` Linus Walleij [this message]
2016-06-14 10:07 ` [PATCH 5/5] gpio: of: factor out common code to a new helper function Masahiro Yamada
2016-06-23  7:42   ` Linus Walleij
2016-06-23  7:44 ` [PATCH 0/5] gpio: refactor of_parse_own_gpio() and of_get_named_gpiod_flags() Linus Walleij

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CACRpkdaOHA03oArvish8v95vB=usAtdSMnQwj2CsK-DDwCxVig@mail.gmail.com' \
    --to=linus.walleij@linaro.org \
    --cc=gnurou@gmail.com \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=yamada.masahiro@socionext.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).