linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bjorn Andersson <bjorn.andersson@linaro.org>
To: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Cc: Linus Walleij <linus.walleij@linaro.org>,
	linux-gpio <linux-gpio@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	linux-arm-msm@vger.kernel.org
Subject: Re: [PATCH] gpiolib: Allow name duplicates of "" and "NC"
Date: Tue, 15 Dec 2020 11:59:29 -0600	[thread overview]
Message-ID: <X9j5gdx1/WaCq54m@builder.lan> (raw)
In-Reply-To: <CAMpxmJU0XWxiYr716MNGnORJJJ-czuBGWNnFTa5oBTUK4uVheQ@mail.gmail.com>

On Tue 15 Dec 11:42 CST 2020, Bartosz Golaszewski wrote:

> On Tue, Dec 15, 2020 at 6:02 PM Bjorn Andersson
> <bjorn.andersson@linaro.org> wrote:
> >
> > Not all GPIO pins are exposed to the world and this is typically
> > described by not giving these lines particular names, commonly "" or
> > "NC".
> >
> > With the recent introduction of '2cd64ae98f35 ("gpiolib: Disallow
> > identical line names in the same chip")' any gpiochip with multiple such
> > pins will refuse to probe.
> >
> > Fix this by treating "" and "NC" as "no name specified" in
> > gpio_name_to_desc()
> >
> > Fixes: 2cd64ae98f35 ("gpiolib: Disallow identical line names in the same chip")
> > Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
> > ---
> >
> > The introduction of 2cd64ae98f35 breaks pretty much all Qualcomm boards and
> > grepping the DT tree indicates that other vendors will have the same problem.
> >
> > In addition to this the am335x-* boards will also needs "[NC]", "[ethernet]",
> > "[emmc"], "[i2c0]", "[SYSBOOT]" and "[JTAG]" added to this list to allow
> > booting v5.11 with the past and present dtb/dts files.
> >
> >  drivers/gpio/gpiolib.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
> > index b3340ba68471..407ba79ae571 100644
> > --- a/drivers/gpio/gpiolib.c
> > +++ b/drivers/gpio/gpiolib.c
> > @@ -302,7 +302,7 @@ static struct gpio_desc *gpio_name_to_desc(const char * const name)
> >         struct gpio_device *gdev;
> >         unsigned long flags;
> >
> > -       if (!name)
> > +       if (!name || !strcmp(name, "") || !strcmp(name, "NC"))
> >                 return NULL;
> >
> >         spin_lock_irqsave(&gpio_lock, flags);
> > --
> > 2.29.2
> >
> 
> I have a bad feeling about this. This opens the door for all kinds of
> exceptions: "N/A", "none" etc. Depending on whose boards are getting
> broken.
> 
> If non-uniqueness of names is needed then let's better revert 2cd64ae98f35.
> 

I like the intent of 2cd64ae98f35, but even if we decide what the
"unconnected" name should be we have a slew of boards that won't boot
v5.11-rc1 (or with any pre-v5.11 DTBs).

As such I think we need to revert the "return -EEXIST" part of the
patch.


Looking forward perhaps we should define "" to be the "not a gpio"-name,
revise my patch and fix up the DTs accordingly? And keep the dev_err()
as it currently is?

Regards,
Bjorn

  reply	other threads:[~2020-12-15 18:00 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-15 17:03 [PATCH] gpiolib: Allow name duplicates of "" and "NC" Bjorn Andersson
2020-12-15 17:42 ` Bartosz Golaszewski
2020-12-15 17:59   ` Bjorn Andersson [this message]
2020-12-16 12:46 ` Linus Walleij
2020-12-16 18:40   ` Bjorn Andersson
2020-12-16 20:50     ` Linus Walleij
2020-12-16 19:53 ` Drew Fustini
2020-12-16 20:38   ` Bjorn Andersson

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=X9j5gdx1/WaCq54m@builder.lan \
    --to=bjorn.andersson@linaro.org \
    --cc=bgolaszewski@baylibre.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 \
    /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).