aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/include/linux/gpio
diff options
context:
space:
mode:
authorBartosz Golaszewski <bartosz.golaszewski@linaro.org>2023-09-27 16:29:25 +0200
committerBartosz Golaszewski <bartosz.golaszewski@linaro.org>2023-10-04 13:29:56 +0200
commit93548f8bbbbf5b62dbd37c8f61a037a06666787b (patch)
treec34338852cee00c40de2e10d8d1d41d306de374f /include/linux/gpio
parentgpiolib: provide gpio_device_find_by_label() (diff)
downloadwireguard-linux-93548f8bbbbf5b62dbd37c8f61a037a06666787b.tar.xz
wireguard-linux-93548f8bbbbf5b62dbd37c8f61a037a06666787b.zip
gpiolib: provide gpio_device_get_desc()
Getting the GPIO descriptor directly from the gpio_chip struct is dangerous as we don't take the reference to the underlying GPIO device. In order to start working towards removing gpiochip_get_desc(), let's provide a safer variant that works with an existing reference to struct gpio_device. Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org> Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'include/linux/gpio')
-rw-r--r--include/linux/gpio/driver.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/include/linux/gpio/driver.h b/include/linux/gpio/driver.h
index 24996cba6465..3fdf3f14bb13 100644
--- a/include/linux/gpio/driver.h
+++ b/include/linux/gpio/driver.h
@@ -770,6 +770,8 @@ struct gpio_desc *gpiochip_request_own_desc(struct gpio_chip *gc,
void gpiochip_free_own_desc(struct gpio_desc *desc);
struct gpio_desc *gpiochip_get_desc(struct gpio_chip *gc, unsigned int hwnum);
+struct gpio_desc *
+gpio_device_get_desc(struct gpio_device *gdev, unsigned int hwnum);
#ifdef CONFIG_GPIOLIB