diff options
author | Alexandre Courbot <acourbot@nvidia.com> | 2014-02-09 17:43:54 +0900 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2014-02-12 17:11:35 +0100 |
commit | bb1e88ccb771492ac908ac295ec135efa1d53093 (patch) | |
tree | b8848e3943167f59db95516a0626020f4efbbe71 /include/linux/gpio/consumer.h | |
parent | 90df4fe07f9794984bd2dafd1d28acd45318d37f (diff) |
gpiolib: add gpiochip_get_desc() driver function
Some drivers dealing with a gpio_chip might need to act on its
descriptors directly; one example is pinctrl drivers that need to lock a
GPIO for being used as IRQ using gpiod_lock_as_irq().
This patch exports a gpiochip_get_desc() function that returns the
GPIO descriptor at the requested index. It also sweeps the
gpio_to_chip() function out of the consumer interface since any holder
of a gpio_chip reference can manipulate its GPIOs way beyond what a
consumer should be allowed to do.
As a result, gpio_chip is not visible anymore to simple GPIO consumers.
Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Reviewed-by: Jean-Jacques Hiblot <jjhiblot@traphandler.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'include/linux/gpio/consumer.h')
-rw-r--r-- | include/linux/gpio/consumer.h | 8 |
1 files changed, 0 insertions, 8 deletions
diff --git a/include/linux/gpio/consumer.h b/include/linux/gpio/consumer.h index 387994325122..dccda505ba7c 100644 --- a/include/linux/gpio/consumer.h +++ b/include/linux/gpio/consumer.h @@ -7,7 +7,6 @@ #ifdef CONFIG_GPIOLIB struct device; -struct gpio_chip; /** * Opaque descriptor for a GPIO. These are obtained using gpiod_get() and are @@ -60,7 +59,6 @@ int gpiod_to_irq(const struct gpio_desc *desc); /* Convert between the old gpio_ and new gpiod_ interfaces */ struct gpio_desc *gpio_to_desc(unsigned gpio); int desc_to_gpio(const struct gpio_desc *desc); -struct gpio_chip *gpiod_to_chip(const struct gpio_desc *desc); #else /* CONFIG_GPIOLIB */ @@ -214,12 +212,6 @@ static inline int desc_to_gpio(const struct gpio_desc *desc) WARN_ON(1); return -EINVAL; } -static inline struct gpio_chip *gpiod_to_chip(const struct gpio_desc *desc) -{ - /* GPIO can never have been requested */ - WARN_ON(1); - return ERR_PTR(-ENODEV); -} #endif /* CONFIG_GPIOLIB */ |