gpiolib: unduplicate chip guard in set_config path
authorBartosz Golaszewski <bartosz.golaszewski@linaro.org>
Fri, 18 Oct 2024 09:10:10 +0000 (11:10 +0200)
committerBartosz Golaszewski <bartosz.golaszewski@linaro.org>
Tue, 22 Oct 2024 06:59:08 +0000 (08:59 +0200)
commitdd26ffaa4d278d6e538c4ea68fb508a69f567827
treef010a9ba4e8b76aec2706b35090b5cb94b054951
parent49182c87af377ec4ae0a5e116a9059e03b083574
gpiolib: unduplicate chip guard in set_config path

We don't need to guard the GPIO chip until its first dereference in
gpio_do_set_config().

First: change the prototype of gpio_do_set_config() to take the GPIO
line descriptor as argument, then move the gpio_chip protection into it
and drop it in two places where it's done too early.

This has the added benefit of making gpio_go_set_config() safe to use
from outside of this compilation unit without taking the gdev SRCU read
lock and will come in handy when we'll want to make it available to the
character device code.

Reviewed-by: Kent Gibson <warthog618@gmail.com>
Link: https://lore.kernel.org/r/20241018-gpio-notify-in-kernel-events-v5-2-c79135e58a1c@linaro.org
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
drivers/gpio/gpiolib.c