Skip to content

Commit

Permalink
gpiolib: Export gpiochip_irqchip_irq_valid() to drivers
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Stephen Boyd authored and Linus Walleij committed Jan 10, 2018
1 parent 9961dbc commit 64ff2c8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
5 changes: 3 additions & 2 deletions drivers/gpio/gpiolib.c
Original file line number Diff line number Diff line change
Expand Up @@ -1501,14 +1501,15 @@ static void gpiochip_irqchip_free_valid_mask(struct gpio_chip *gpiochip)
gpiochip->irq.valid_mask = NULL;
}

static bool gpiochip_irqchip_irq_valid(const struct gpio_chip *gpiochip,
unsigned int offset)
bool gpiochip_irqchip_irq_valid(const struct gpio_chip *gpiochip,
unsigned int offset)
{
/* No mask means all valid */
if (likely(!gpiochip->irq.valid_mask))
return true;
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
Expand Down
3 changes: 3 additions & 0 deletions include/linux/gpio/driver.h
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,9 @@ int gpiochip_irqchip_add_key(struct gpio_chip *gpiochip,
bool threaded,
struct lock_class_key *lock_key);

bool gpiochip_irqchip_irq_valid(const struct gpio_chip *gpiochip,
unsigned int offset);

#ifdef CONFIG_LOCKDEP

/*
Expand Down

0 comments on commit 64ff2c8

Please sign in to comment.