linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Brian Masney <bmasney@redhat.com>
To: Thierry Reding <thierry.reding@gmail.com>
Cc: linus.walleij@linaro.org, brgl@bgdev.pl,
	linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-msm@vger.kernel.org, psodagud@quicinc.com,
	quic_shazhuss@quicinc.com, quic_ppareek@quicinc.com,
	ahalaney@redhat.com, echanude@redhat.com,
	nicolas.dechesne@linaro.org
Subject: Re: [PATCH RFC] gpiolib: ensure that fwnode is properly set
Date: Wed, 16 Nov 2022 06:14:01 -0500	[thread overview]
Message-ID: <Y3TF+VbE5yFlz+OZ@x1> (raw)
In-Reply-To: <Y3S5sZIVi2DPua0p@orome>

On Wed, Nov 16, 2022 at 11:21:37AM +0100, Thierry Reding wrote:
> On Mon, Nov 14, 2022 at 03:29:43PM -0500, Brian Masney wrote:
> > diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
> > index 11fb7ec883e9..8bec66008869 100644
> > --- a/drivers/gpio/gpiolib.c
> > +++ b/drivers/gpio/gpiolib.c
> > @@ -678,7 +678,7 @@ int gpiochip_add_data_with_key(struct gpio_chip *gc, void *data,
> >  	 * Assign fwnode depending on the result of the previous calls,
> >  	 * if none of them succeed, assign it to the parent's one.
> >  	 */
> > -	gdev->dev.fwnode = dev_fwnode(&gdev->dev) ?: fwnode;
> > +	gc->fwnode = gdev->dev.fwnode = dev_fwnode(&gdev->dev) ?: fwnode;
> 
> This doesn't look right to me. Looking at the documentation of
> gc->fwnode and how it is used, the purpose of this is to allow
> explicitly overriding the fwnode that the GPIO chip will use.
> 
> So really this should not be used beyond the initial registration
> in gpiochip_add_data_with_key(). If the above patch fixes anything,
> then I suspect somebody is using gc->fwnode outside of this
> registration.
> 
> Looking at gpiolib, the only remaining place that seems to do this is
> the gpio-reserved-ranges handling code, in which case, the below on top
> of my initial patch might fix that. That might explain why MSM is still
> seeing issues.

That is correct. The Thinkpad x13s laptop uses the driver
drivers/pinctrl/qcom/pinctrl-sc8280xp.c and
arch/arm64/boot/dts/qcom/sc8280xp-lenovo-thinkpad-x13s.dts defines a
gpio-reserved-ranges property. The SA8540p automotive board has the same
SoC, however the DTS we are using doesn't use the gpio-reserved-ranges
property, and why only your original patch fixed the issue for this
board.

I think my patch should be removed from the GPIO tree if Thierry's two
patches work for everyone.

Brian


      parent reply	other threads:[~2022-11-16 11:25 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-14 20:29 [PATCH RFC] gpiolib: ensure that fwnode is properly set Brian Masney
2022-11-14 21:02 ` Robert Marko
2022-11-14 21:16   ` Brian Masney
2022-11-15  8:18   ` Shazad Hussain
2022-11-15 11:08 ` Marijn Suijten
2022-11-15 11:53 ` Konrad Dybcio
2022-11-15 17:07 ` Bryan O'Donoghue
2022-11-15 22:02   ` Steev Klimaszewski
2022-11-16  9:19     ` Bartosz Golaszewski
2022-11-16 10:23     ` Thierry Reding
2022-11-16  9:09 ` Neil Armstrong
2022-11-16 10:21 ` Thierry Reding
2022-11-16 10:35   ` Thierry Reding
2022-11-16 11:14   ` Brian Masney [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=Y3TF+VbE5yFlz+OZ@x1 \
    --to=bmasney@redhat.com \
    --cc=ahalaney@redhat.com \
    --cc=brgl@bgdev.pl \
    --cc=echanude@redhat.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nicolas.dechesne@linaro.org \
    --cc=psodagud@quicinc.com \
    --cc=quic_ppareek@quicinc.com \
    --cc=quic_shazhuss@quicinc.com \
    --cc=thierry.reding@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).