Commit 39e5f096 authored by Thierry Reding's avatar Thierry Reding Committed by Linus Walleij

gpio: Move irq_chained_parent to struct gpio_irq_chip

In order to consolidate the multiple ways to associate an IRQ chip with
a GPIO chip, move more fields into the new struct gpio_irq_chip.
Signed-off-by: default avatarThierry Reding <treding@nvidia.com>
Acked-by: default avatarGrygorii Strashko <grygorii.strashko@ti.com>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent 3634eeb0
...@@ -1570,7 +1570,8 @@ static void gpiochip_set_cascaded_irqchip(struct gpio_chip *gpiochip, ...@@ -1570,7 +1570,8 @@ static void gpiochip_set_cascaded_irqchip(struct gpio_chip *gpiochip,
irq_set_chained_handler_and_data(parent_irq, parent_handler, irq_set_chained_handler_and_data(parent_irq, parent_handler,
gpiochip); gpiochip);
gpiochip->irq_chained_parent = parent_irq; gpiochip->irq.parents = &parent_irq;
gpiochip->irq.num_parents = 1;
} }
/* Set the parent IRQ for all affected IRQs */ /* Set the parent IRQ for all affected IRQs */
...@@ -1719,17 +1720,23 @@ static int gpiochip_to_irq(struct gpio_chip *chip, unsigned offset) ...@@ -1719,17 +1720,23 @@ static int gpiochip_to_irq(struct gpio_chip *chip, unsigned offset)
*/ */
static void gpiochip_irqchip_remove(struct gpio_chip *gpiochip) static void gpiochip_irqchip_remove(struct gpio_chip *gpiochip)
{ {
unsigned int offset, irq; unsigned int offset;
acpi_gpiochip_free_interrupts(gpiochip); acpi_gpiochip_free_interrupts(gpiochip);
if (gpiochip->irq_chained_parent) { if (gpiochip->irq.num_parents > 0) {
irq_set_chained_handler_and_data( struct gpio_irq_chip *irq = &gpiochip->irq;
gpiochip->irq_chained_parent, NULL, NULL); unsigned int i;
for (i = 0; i < irq->num_parents; i++)
irq_set_chained_handler_and_data(irq->parents[i],
NULL, NULL);
} }
/* Remove all IRQ mappings and delete the domain */ /* Remove all IRQ mappings and delete the domain */
if (gpiochip->irq.domain) { if (gpiochip->irq.domain) {
unsigned int irq;
for (offset = 0; offset < gpiochip->ngpio; offset++) { for (offset = 0; offset < gpiochip->ngpio; offset++) {
if (!gpiochip_irqchip_irq_valid(gpiochip, offset)) if (!gpiochip_irqchip_irq_valid(gpiochip, offset))
continue; continue;
......
...@@ -77,6 +77,21 @@ struct gpio_irq_chip { ...@@ -77,6 +77,21 @@ struct gpio_irq_chip {
* interrupt. * interrupt.
*/ */
void *parent_handler_data; void *parent_handler_data;
/**
* @num_parents:
*
* The number of interrupt parents of a GPIO chip.
*/
unsigned int num_parents;
/**
* @parents:
*
* A list of interrupt parents of a GPIO chip. This is owned by the
* driver, so the core will only reference this list, not modify it.
*/
unsigned int *parents;
}; };
static inline struct gpio_irq_chip *to_gpio_irq_chip(struct irq_chip *chip) static inline struct gpio_irq_chip *to_gpio_irq_chip(struct irq_chip *chip)
...@@ -148,9 +163,6 @@ static inline struct gpio_irq_chip *to_gpio_irq_chip(struct irq_chip *chip) ...@@ -148,9 +163,6 @@ static inline struct gpio_irq_chip *to_gpio_irq_chip(struct irq_chip *chip)
* safely. * safely.
* @bgpio_dir: shadowed direction register for generic GPIO to clear/set * @bgpio_dir: shadowed direction register for generic GPIO to clear/set
* direction safely. * direction safely.
* @irq_chained_parent: GPIO IRQ chip parent/bank linux irq number,
* provided by GPIO driver for chained interrupt (not for nested
* interrupts).
* @irq_nested: True if set the interrupt handling is nested. * @irq_nested: True if set the interrupt handling is nested.
* @irq_need_valid_mask: If set core allocates @irq_valid_mask with all * @irq_need_valid_mask: If set core allocates @irq_valid_mask with all
* bits set to one * bits set to one
...@@ -226,7 +238,6 @@ struct gpio_chip { ...@@ -226,7 +238,6 @@ struct gpio_chip {
* With CONFIG_GPIOLIB_IRQCHIP we get an irqchip inside the gpiolib * With CONFIG_GPIOLIB_IRQCHIP we get an irqchip inside the gpiolib
* to handle IRQs for most practical cases. * to handle IRQs for most practical cases.
*/ */
unsigned int irq_chained_parent;
bool irq_nested; bool irq_nested;
bool irq_need_valid_mask; bool irq_need_valid_mask;
unsigned long *irq_valid_mask; unsigned long *irq_valid_mask;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment