OSDN Git Service

soc: fsl: qe: Avoid using gpio_to_desc()
authorLinus Walleij <linus.walleij@linaro.org>
Thu, 27 Oct 2022 08:11:08 +0000 (10:11 +0200)
committerArnd Bergmann <arnd@arndb.de>
Tue, 1 Nov 2022 11:29:09 +0000 (12:29 +0100)
commit84582f9ed090e6a6ce9841d0309c99427c12022a
tree59fd2b5a3bfb0cf2831cb2a9a13ca399366e1a27
parent247f34f7b80357943234f93f247a1ae6b6c3a740
soc: fsl: qe: Avoid using gpio_to_desc()

The qe gpio driver is a custom API combined GPIO and pin control
driver that exist outside of the pin control subsystem for historical
reasons.

We want to get rid of the old GPIO numberspace, so instead of
calling gpio_to_desc() we get the gpio descriptor for the requested
line from the device tree directly without passing through the
GPIO numberspace, and then we get the gpiochip from the descriptor.

Using the reference counting inside the gpio descriptor we can drop
the reference counting code in this driver. A second gpiod_get()
will not succeed.

To obtain the local hardware offset of the GPIO line, the driver
need to include the header from the gpiolib internals. This isn't
pretty but it is the lesser evil compared to keeping the code
as a roadblock to gpiolib refactoring. A proper solution would be
to rewrite the driver as a real pin control driver with a
built-in gpio_chip.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Cc: Bartosz Golaszewski <brgl@bgdev.pl>
Cc: linux-gpio@vger.kernel.org
Link: https://lore.kernel.org/r/20221027081108.174662-1-linus.walleij@linaro.org'
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
drivers/soc/fsl/qe/gpio.c