gpiolib: Export gpiochip_irqchip_irq_valid() to drivers

Some pinctrl drivers can use the gpiochip irq valid information
to figure out if certain gpios are exposed to the kernel for
usage or not. Expose this API so we can use it in the
pinmux_ops::request ops.

Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
Acked-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
This commit is contained in:
Stephen Boyd 2018-01-09 17:58:46 -08:00 committed by Linus Walleij
parent 9961dbcd22
commit 64ff2c8e46
2 changed files with 6 additions and 2 deletions

View File

@ -1501,14 +1501,15 @@ static void gpiochip_irqchip_free_valid_mask(struct gpio_chip *gpiochip)
gpiochip->irq.valid_mask = NULL; gpiochip->irq.valid_mask = NULL;
} }
static bool gpiochip_irqchip_irq_valid(const struct gpio_chip *gpiochip, bool gpiochip_irqchip_irq_valid(const struct gpio_chip *gpiochip,
unsigned int offset) unsigned int offset)
{ {
/* No mask means all valid */ /* No mask means all valid */
if (likely(!gpiochip->irq.valid_mask)) if (likely(!gpiochip->irq.valid_mask))
return true; return true;
return test_bit(offset, gpiochip->irq.valid_mask); return test_bit(offset, gpiochip->irq.valid_mask);
} }
EXPORT_SYMBOL_GPL(gpiochip_irqchip_irq_valid);
/** /**
* gpiochip_set_cascaded_irqchip() - connects a cascaded irqchip to a gpiochip * gpiochip_set_cascaded_irqchip() - connects a cascaded irqchip to a gpiochip

View File

@ -431,6 +431,9 @@ int gpiochip_irqchip_add_key(struct gpio_chip *gpiochip,
bool threaded, bool threaded,
struct lock_class_key *lock_key); struct lock_class_key *lock_key);
bool gpiochip_irqchip_irq_valid(const struct gpio_chip *gpiochip,
unsigned int offset);
#ifdef CONFIG_LOCKDEP #ifdef CONFIG_LOCKDEP
/* /*