linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: Francesco Dolcini <francesco.dolcini@toradex.com>,
	Lee Jones <lee@kernel.org>,
	Maxime Coquelin <mcoquelin.stm32@gmail.com>,
	Alexandre Torgue <alexandre.torgue@foss.st.com>,
	Marcel Ziswiler <marcel.ziswiler@toradex.com>,
	Bartosz Golaszewski <brgl@bgdev.pl>,
	linux-stm32@st-md-mailman.stormreply.com,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mfd: stmpe: switch to using gpiod API
Date: Tue, 6 Sep 2022 11:17:22 -0700	[thread overview]
Message-ID: <YxeOsttmiKZJL3Nz@google.com> (raw)
In-Reply-To: <CACRpkdZU5vN6M31MN_EEQHpi+WfMOr4CTpkc7PD=AVvy_kb99A@mail.gmail.com>

On Tue, Sep 06, 2022 at 01:29:21PM +0200, Linus Walleij wrote:
> On Tue, Sep 6, 2022 at 12:11 PM Francesco Dolcini
> <francesco.dolcini@toradex.com> wrote:
> > On Mon, Sep 05, 2022 at 10:01:47PM -0700, Dmitry Torokhov wrote:
> > > This patch switches the driver away from legacy gpio/of_gpio API to
> > > gpiod API, and removes use of of_get_named_gpio_flags() which I want to
> > > make private to gpiolib.
> > >
> > > Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> > > ---
> > >  drivers/mfd/stmpe.c | 36 +++++++++++++-----------------------
> > >  1 file changed, 13 insertions(+), 23 deletions(-)
> > >
> > > diff --git a/drivers/mfd/stmpe.c b/drivers/mfd/stmpe.c
> > > index 987e251d90ae..0c4f74197d3e 100644
> > > --- a/drivers/mfd/stmpe.c
> > > +++ b/drivers/mfd/stmpe.c
> > > @@ -8,14 +8,13 @@
> > >   */
> > >
> >
> > <snip>
> >
> > > -     pdata->irq_gpio = of_get_named_gpio_flags(np, "irq-gpio", 0,
> > <snip>
> > > +     irq_gpio = devm_gpiod_get_optional(ci->dev, "irq", GPIOD_ASIS);
> > isn't this changing from irq-gpio to irq-gpios property name?
> 
> The gpiolib core will automatically append and test the strings
> *-gpios and *-gpio (in that order)
> 
> > in the DTS files we do have something like that:
> >
> >  irq-gpio = <&gpio TEGRA_GPIO(V, 0) IRQ_TYPE_LEVEL_LOW>;
> 
> This seems to be an orthogonal bug.
> 
> That flag in the last cell is invalid for a GPIO, the DT schema should
> scream at you if you have one. GPIO flags are
> GPIO_ACTIVE_LOW, GPIO_OPEN_DRAIN etc. That looks more
> like an IRQ, and then the property should be irqs = <...>.

Francesco is right though in the sense that we need to update DTS
together with the patch, or we will break the driver... The original
code relied on the fact that flags returned by of_get_named_gpio_flags()
could contain anything, not necessarily valid GPIO flags.

Thanks.

-- 
Dmitry

      reply	other threads:[~2022-09-06 18:17 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-06  5:01 [PATCH] mfd: stmpe: switch to using gpiod API Dmitry Torokhov
2022-09-06 10:11 ` Francesco Dolcini
2022-09-06 11:29   ` Linus Walleij
2022-09-06 18:17     ` Dmitry Torokhov [this message]

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=YxeOsttmiKZJL3Nz@google.com \
    --to=dmitry.torokhov@gmail.com \
    --cc=alexandre.torgue@foss.st.com \
    --cc=brgl@bgdev.pl \
    --cc=francesco.dolcini@toradex.com \
    --cc=lee@kernel.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-stm32@st-md-mailman.stormreply.com \
    --cc=marcel.ziswiler@toradex.com \
    --cc=mcoquelin.stm32@gmail.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).