gpiolib: provide gpiod_to_gpio_device()
authorBartosz Golaszewski <bartosz.golaszewski@linaro.org>
Wed, 11 Oct 2023 13:02:03 +0000 (15:02 +0200)
committerBartosz Golaszewski <bartosz.golaszewski@linaro.org>
Fri, 13 Oct 2023 06:50:04 +0000 (08:50 +0200)
commit370232d096e3fe188e4596f77bc6560636bd40c1
treef4897b29c370cde5171981b11bb11aa571a2283c
parent1559d14977b694570f010854b8192e6de034bc27
gpiolib: provide gpiod_to_gpio_device()

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.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Reviewed-by: Peter Rosin <peda@axentia.se>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
drivers/gpio/gpiolib.c
include/linux/gpio/driver.h