diff options
author | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2022-12-28 12:20:43 +0300 |
---|---|---|
committer | Bartosz Golaszewski <bartosz.golaszewski@linaro.org> | 2023-01-30 17:55:29 +0300 |
commit | dc0989e3aa58dc424a18baf85639248ce9baf818 (patch) | |
tree | 3351172983eaa10f5f216840657b92d31c3dc3ca /drivers/gpio/gpiolib.h | |
parent | f2527d8f566a45fa00ee5abd04d1c9476d4d704f (diff) | |
download | linux-dc0989e3aa58dc424a18baf85639248ce9baf818.tar.xz |
gpiolib: Introduce gpio_device_get() and gpio_device_put()
Introduce gpio_device_get() and gpio_device_put() helpers
and convert existing users.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Diffstat (limited to 'drivers/gpio/gpiolib.h')
-rw-r--r-- | drivers/gpio/gpiolib.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/gpio/gpiolib.h b/drivers/gpio/gpiolib.h index b3c2db6eba80..cca81375f127 100644 --- a/drivers/gpio/gpiolib.h +++ b/drivers/gpio/gpiolib.h @@ -82,6 +82,16 @@ static inline struct gpio_device *to_gpio_device(struct device *dev) return container_of(dev, struct gpio_device, dev); } +static inline struct gpio_device *gpio_device_get(struct gpio_device *gdev) +{ + return to_gpio_device(get_device(&gdev->dev)); +} + +static inline void gpio_device_put(struct gpio_device *gdev) +{ + put_device(&gdev->dev); +} + /* gpio suffixes used for ACPI and device tree lookup */ static __maybe_unused const char * const gpio_suffixes[] = { "gpios", "gpio" }; |