Re: [RFC/RFT PATCH] gpiolib: reverse-assign the fwnode to struct gpio_chip

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Oct 06, 2023 at 01:51:47PM +0200, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <bartosz.golaszewski@xxxxxxxxxx>
> 
> struct gpio_chip is not only used to carry the information needed to
> set-up a GPIO device but is also used in all GPIOLIB callbacks and is
> passed to the matching functions of lookup helpers.
> 
> In that last case, it is currently impossible to match a GPIO device by
> fwnode unless it was explicitly assigned to the chip in the provider
> code.

That's expected behaviour.

> If the fwnode is taken from the parent device, the pointer in
> struct gpio_chip will remain NULL.

> If we have a parent device but gc->fwnode was not assigned by the
> provider, let's assign it ourselves so that lookup by fwnode can work in
> all cases.

I don't think this is a good change. We paper over the real issue where
we and callers need to understand what they are looking for.

...

> This is something that Dipen reported with one of the tegra drivers where
> a GPIO lookup by fwnode does not work because the fwnode pointer in struct
> gpio_chip is NULL. This patch addresses this use-case.

I am not sure I understand the problem here. All these should have been
addressed already, no?

So, the GPIOLIB should use dev_fwnode(&gdev->dev) inside it, outside it
the GPIO drivers are free to use gc->fwnode as long as they understand
the lifetime of the respective object.


-- 
With Best Regards,
Andy Shevchenko





[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux