Skip to content

Commit

Permalink
gpiolib: cleanup chained handler and data
Browse files Browse the repository at this point in the history
Clean up chained handler and handler data if they were set by
gpiochip_set_chained_irqchip().

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
  • Loading branch information
Dmitry Eremin-Solenikov authored and Linus Walleij committed May 13, 2015
1 parent 845c877 commit 25e4fe9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
7 changes: 7 additions & 0 deletions drivers/gpio/gpiolib.c
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,8 @@ void gpiochip_set_chained_irqchip(struct gpio_chip *gpiochip,
*/
irq_set_handler_data(parent_irq, gpiochip);
irq_set_chained_handler(parent_irq, parent_handler);

gpiochip->irq_parent = parent_irq;
}

/* Set the parent IRQ for all affected IRQs */
Expand Down Expand Up @@ -551,6 +553,11 @@ static void gpiochip_irqchip_remove(struct gpio_chip *gpiochip)

acpi_gpiochip_free_interrupts(gpiochip);

if (gpiochip->irq_parent) {
irq_set_chained_handler(gpiochip->irq_parent, NULL);
irq_set_handler_data(gpiochip->irq_parent, NULL);
}

/* Remove all IRQ mappings and delete the domain */
if (gpiochip->irqdomain) {
for (offset = 0; offset < gpiochip->ngpio; offset++)
Expand Down
1 change: 1 addition & 0 deletions include/linux/gpio/driver.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ struct gpio_chip {
unsigned int irq_base;
irq_flow_handler_t irq_handler;
unsigned int irq_default_type;
int irq_parent;
#endif

#if defined(CONFIG_OF_GPIO)
Expand Down

0 comments on commit 25e4fe9

Please sign in to comment.