Skip to content

Commit

Permalink
gpio: dwapb: Call acpi_gpiochip_free_interrupts() on GPIO chip de-reg…
Browse files Browse the repository at this point in the history
…istration

Add missed acpi_gpiochip_free_interrupts() call when unregistering ports.

While at it, drop extra check to call acpi_gpiochip_request_interrupts().
There is no need to have an additional check to call
acpi_gpiochip_request_interrupts(). Even without any interrupts available
the registered ACPI Event handlers can be useful for debugging purposes.

Fixes: e6cb348 ("gpio: dwapb: add gpio-signaled acpi event support")
Signed-off-by: Andy Shevchenko <[email protected]>
Tested-by: Serge Semin <[email protected]>
Acked-by: Serge Semin <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Linus Walleij <[email protected]>
  • Loading branch information
andy-shev authored and linusw committed May 25, 2020
1 parent a0d50aa commit 494a94e
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions drivers/gpio/gpio-dwapb.c
Original file line number Diff line number Diff line change
Expand Up @@ -505,26 +505,33 @@ static int dwapb_gpio_add_port(struct dwapb_gpio *gpio,
dwapb_configure_irqs(gpio, port, pp);

err = gpiochip_add_data(&port->gc, port);
if (err)
if (err) {
dev_err(gpio->dev, "failed to register gpiochip for port%d\n",
port->idx);
else
port->is_registered = true;
return err;
}

/* Add GPIO-signaled ACPI event support */
if (pp->has_irq)
acpi_gpiochip_request_interrupts(&port->gc);
acpi_gpiochip_request_interrupts(&port->gc);

return err;
port->is_registered = true;

return 0;
}

static void dwapb_gpio_unregister(struct dwapb_gpio *gpio)
{
unsigned int m;

for (m = 0; m < gpio->nr_ports; ++m)
if (gpio->ports[m].is_registered)
gpiochip_remove(&gpio->ports[m].gc);
for (m = 0; m < gpio->nr_ports; ++m) {
struct dwapb_gpio_port *port = &gpio->ports[m];

if (!port->is_registered)
continue;

acpi_gpiochip_free_interrupts(&port->gc);
gpiochip_remove(&port->gc);
}
}

static void dwapb_get_irq(struct device *dev, struct fwnode_handle *fwnode,
Expand Down

0 comments on commit 494a94e

Please sign in to comment.