All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bartosz Golaszewski <brgl@bgdev.pl>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Kent Gibson <warthog618@gmail.com>,
	Linus Walleij <linus.walleij@linaro.org>,
	Shuah Khan <shuah@kernel.org>,
	Geert Uytterhoeven <geert@linux-m68k.org>,
	Viresh Kumar <viresh.kumar@linaro.org>,
	"open list:GPIO SUBSYSTEM" <linux-gpio@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	linux-kselftest@vger.kernel.org
Subject: Re: [PATCH v12 3/7] gpiolib: of: make fwnode take precedence in struct gpio_chip
Date: Fri, 3 Dec 2021 20:28:34 +0100	[thread overview]
Message-ID: <CAMRc=MeWfKHWFKwRjaqczrfwhAodpDLgrWKF-zqXCsjd=gMv3g@mail.gmail.com> (raw)
In-Reply-To: <Yapp4vakFxH7JV5B@smile.fi.intel.com>

On Fri, Dec 3, 2021 at 8:04 PM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
>
> On Fri, Dec 03, 2021 at 08:56:27PM +0200, Andy Shevchenko wrote:
> > On Fri, Dec 03, 2021 at 08:51:56PM +0200, Andy Shevchenko wrote:
> > > On Fri, Dec 03, 2021 at 02:29:59PM +0100, Bartosz Golaszewski wrote:
> >
> > ...
> >
> > > >   if (gc->parent)
> > > >           gdev->dev.of_node = gc->parent->of_node;
> > > >
> > > > + if (gc->fwnode)
> > > > +         gc->of_node = to_of_node(gc->fwnode);
> > > > +
> > > >   /* If the gpiochip has an assigned OF node this takes precedence */
> > > >   if (gc->of_node)
> > > >           gdev->dev.of_node = gc->of_node;
> > >
> > > Similar should be done in acpi_gpio_dev_init():
> > >
> > >     if (gc->fwnode)
> > >             device_set_node(&gdev->dev, gc->fwnode);
> >
> > Hmm... On the second though this should be rather
> >
> >       if (gc->fwnode)
> >               set_secondary_fwnode(&gdev->dev, gc->fwnode);
> >
> > So the logic will be that:
> >  - if we have parent, set primary fwnode to it
> >  - if we have fwnode, set secondary one to it
> >  - otherwise do nothing
>
> Heck, it's Friday...
>
> If we have parent device for several GPIO devices, this won't work right now
> due to limitations of fwnode regarding to the sturct device.
>
> So, it means we may not have shared primary with different secondary fwnodes.
>
> So, come back to the initial suggestion (overwrite it for now):
>
>         /*
>          * If custom fwnode provided, use it. Currently we may not
>          * handle the case where shared primary node has different
>          * secondary ones. Ideally we have to use
>          * set_secondary_fwnode() here.
>          */
>         if (gc->fwnode)
>                 device_set_node(&gdev->dev, gc->fwnode);
>

Other parts of gpiolib-of depend on the of_node being there.
Converting it to fwnode is a whole other task so for now I suggest we
just convert the fwnode to of_node in struct gpio_chip as per my
patch.

Bart

  reply	other threads:[~2021-12-03 19:28 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-03 13:29 [PATCH v12 0/7] gpio-sim: configfs-based GPIO simulator Bartosz Golaszewski
2021-12-03 13:29 ` [PATCH v12 1/7] gpiolib: provide gpiod_remove_hogs() Bartosz Golaszewski
2021-12-03 13:29 ` [PATCH v12 2/7] gpiolib: allow to specify the firmware node in struct gpio_chip Bartosz Golaszewski
2021-12-03 13:29 ` [PATCH v12 3/7] gpiolib: of: make fwnode take precedence " Bartosz Golaszewski
2021-12-03 18:51   ` Andy Shevchenko
2021-12-03 18:56     ` Andy Shevchenko
2021-12-03 19:02       ` Andy Shevchenko
2021-12-03 19:28         ` Bartosz Golaszewski [this message]
2021-12-03 20:09           ` Andy Shevchenko
2021-12-06  8:41             ` Bartosz Golaszewski
2021-12-06 13:33               ` Andy Shevchenko
2021-12-06 13:40                 ` Bartosz Golaszewski
2021-12-06 13:48                   ` Andy Shevchenko
2021-12-06 13:52                     ` Andy Shevchenko
2021-12-06 13:54   ` Andy Shevchenko
2021-12-06 14:03     ` Bartosz Golaszewski
2021-12-06 14:36       ` Andy Shevchenko
2021-12-06 14:08     ` Andy Shevchenko
2021-12-03 13:30 ` [PATCH v12 4/7] gpio: sim: new testing module Bartosz Golaszewski
2021-12-03 20:07   ` Andy Shevchenko
2021-12-06  9:48     ` Bartosz Golaszewski
2021-12-06 13:32       ` Andy Shevchenko
2021-12-06 15:38         ` Bartosz Golaszewski
2021-12-06 17:00           ` Andy Shevchenko
2021-12-03 13:30 ` [PATCH v12 5/7] selftests: gpio: provide a helper for reading chip info Bartosz Golaszewski
2021-12-03 13:30 ` [PATCH v12 6/7] selftests: gpio: add a helper for reading GPIO line names Bartosz Golaszewski
2021-12-03 13:30 ` [PATCH v12 7/7] selftests: gpio: add test cases for gpio-sim Bartosz Golaszewski
2021-12-03 20:10 ` [PATCH v12 0/7] gpio-sim: configfs-based GPIO simulator Andy Shevchenko

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='CAMRc=MeWfKHWFKwRjaqczrfwhAodpDLgrWKF-zqXCsjd=gMv3g@mail.gmail.com' \
    --to=brgl@bgdev.pl \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=geert@linux-m68k.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=shuah@kernel.org \
    --cc=viresh.kumar@linaro.org \
    --cc=warthog618@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.