Commit 494a94e3 authored by Andy Shevchenko's avatar Andy Shevchenko Committed by Linus Walleij

gpio: dwapb: Call acpi_gpiochip_free_interrupts() on GPIO chip de-registration

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: e6cb3486 ("gpio: dwapb: add gpio-signaled acpi event support")
Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Tested-by: default avatarSerge Semin <fancer.lancer@gmail.com>
Acked-by: default avatarSerge Semin <fancer.lancer@gmail.com>
Link: https://lore.kernel.org/r/20200519131233.59032-1-andriy.shevchenko@linux.intel.comSigned-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent a0d50aa9
...@@ -505,26 +505,33 @@ static int dwapb_gpio_add_port(struct dwapb_gpio *gpio, ...@@ -505,26 +505,33 @@ static int dwapb_gpio_add_port(struct dwapb_gpio *gpio,
dwapb_configure_irqs(gpio, port, pp); dwapb_configure_irqs(gpio, port, pp);
err = gpiochip_add_data(&port->gc, port); err = gpiochip_add_data(&port->gc, port);
if (err) if (err) {
dev_err(gpio->dev, "failed to register gpiochip for port%d\n", dev_err(gpio->dev, "failed to register gpiochip for port%d\n",
port->idx); port->idx);
else return err;
port->is_registered = true; }
/* Add GPIO-signaled ACPI event support */ /* 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) static void dwapb_gpio_unregister(struct dwapb_gpio *gpio)
{ {
unsigned int m; unsigned int m;
for (m = 0; m < gpio->nr_ports; ++m) for (m = 0; m < gpio->nr_ports; ++m) {
if (gpio->ports[m].is_registered) struct dwapb_gpio_port *port = &gpio->ports[m];
gpiochip_remove(&gpio->ports[m].gc);
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, static void dwapb_get_irq(struct device *dev, struct fwnode_handle *fwnode,
......
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