[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CACMJSetxih3kwAVDpQNm_fApgdkOv-XfErqC8+hi7Nac4J+ZOg@mail.gmail.com>
Date: Wed, 11 Oct 2023 17:39:29 +0200
From: Bartosz Golaszewski <bartosz.golaszewski@...aro.org>
To: Andy Shevchenko <andy.shevchenko@...il.com>
Cc: Bartosz Golaszewski <brgl@...ev.pl>,
Linus Walleij <linus.walleij@...aro.org>,
Andy Shevchenko <andy@...nel.org>,
Peter Korsgaard <peter.korsgaard@...co.com>,
Peter Rosin <peda@...ntia.se>, linux-gpio@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-i2c@...r.kernel.org
Subject: Re: [PATCH 2/3] gpiolib: provide gpiod_to_gpio_device()
On Wed, 11 Oct 2023 at 17:23, Andy Shevchenko <andy.shevchenko@...il.com> wrote:
>
> On Wed, Oct 11, 2023 at 4:02 PM Bartosz Golaszewski <brgl@...ev.pl> wrote:
> >
> > From: Bartosz Golaszewski <bartosz.golaszewski@...aro.org>
> >
> > Accessing struct gpio_chip backing a GPIO device is only allowed for the
> > actual providers of that chip.
> >
> > Similarly to how we introduced gpio_device_find() in order to replace
> > the abused gpiochip_find(), let's introduce a counterpart to
> > gpiod_to_chip() that returns a reference to the GPIO device owning the
> > descriptor. This is done in order to later remove gpiod_to_chip()
> > entirely.
>
> My concern with this API is the following scenario:
> 1. One driver requests the GPIO descriptor.
> 2. Another driver does take an arbitrary number, converts to a
> descriptor and calls for this API.
>
> Is there any (potential) problem?
YES! And I have it already on my TODO list! But it's great to know I'm
not the only one seeing it.
Basically we need to
The end-goal should be to make gpio_to_desc() an internal GPIOLIB
symbol. There are still around 10 users outside drivers/gpio/ that
will need to be addressed in one way or another. Preferably by being
converted to using descriptors.
Bart
>
> --
> With Best Regards,
> Andy Shevchenko
Powered by blists - more mailing lists