gpio: provide and use gpiod_get_label()
authorBartosz Golaszewski <bartosz.golaszewski@linaro.org>
Mon, 29 Jan 2024 09:11:41 +0000 (10:11 +0100)
committerBartosz Golaszewski <bartosz.golaszewski@linaro.org>
Mon, 12 Feb 2024 09:50:30 +0000 (10:50 +0100)
commitd23dc4a9a88f16d0327e7b4bb03e6f43c1a1b166
tree050643d3a7698c2f2cd0c4b769237fbed0952dcd
parent0857c39bfd09183792c680858b4416498ee1d1ca
gpio: provide and use gpiod_get_label()

We will soon serialize access to the descriptor label using SRCU. The
write-side of the protection will require calling synchronize_srcu()
which must not be called from atomic context. We have two irq helpers:
gpiochip_lock_as_irq() and gpiochip_unlock_as_irq() that set the label
if the GPIO is not requested but is being used as interrupt. They are
called with a spinlock held from the interrupt subsystem.

They must not do it if we are to use SRCU so instead let's move the
special corner case to a dedicated getter.

First: let's implement and use the getter where it's applicable.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
drivers/gpio/gpiolib-cdev.c
drivers/gpio/gpiolib.c
drivers/gpio/gpiolib.h