All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 1/4] gpio: dwapb: Call acpi_gpiochip_free_interrupts() on GPIO chip de-registration
@ 2020-05-18 17:41 Andy Shevchenko
  2020-05-18 17:41 ` [PATCH v2 2/4] gpio: dwapb: avoid error message for optional IRQ Andy Shevchenko
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Andy Shevchenko @ 2020-05-18 17:41 UTC (permalink / raw)
  To: Linus Walleij, Bartosz Golaszewski, linux-gpio
  Cc: Andy Shevchenko, Serge Semin

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: e6cb3486f5a1 ("gpio: dwapb: add gpio-signaled acpi event support")
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Serge Semin <fancer.lancer@gmail.com>
---
v2: made it 1st in the series, add Fixes (Serge)
 drivers/gpio/gpio-dwapb.c | 25 ++++++++++++++++---------
 1 file changed, 16 insertions(+), 9 deletions(-)

diff --git a/drivers/gpio/gpio-dwapb.c b/drivers/gpio/gpio-dwapb.c
index 8639c4a7f469..e5d844304f8d 100644
--- a/drivers/gpio/gpio-dwapb.c
+++ b/drivers/gpio/gpio-dwapb.c
@@ -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,
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2020-05-19 11:49 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-18 17:41 [PATCH v2 1/4] gpio: dwapb: Call acpi_gpiochip_free_interrupts() on GPIO chip de-registration Andy Shevchenko
2020-05-18 17:41 ` [PATCH v2 2/4] gpio: dwapb: avoid error message for optional IRQ Andy Shevchenko
2020-05-18 17:41 ` [PATCH v2 3/4] gpio: dwapb: Don't use 0 as valid Linux interrupt number Andy Shevchenko
2020-05-18 18:10   ` Andy Shevchenko
2020-05-18 17:41 ` [PATCH v2 4/4] gpio: dwapb: Remove unneeded has_irq member in struct dwapb_port_property Andy Shevchenko
2020-05-18 18:08   ` Andy Shevchenko
2020-05-19  6:33   ` Lee Jones
2020-05-19 11:49 ` [PATCH v2 1/4] gpio: dwapb: Call acpi_gpiochip_free_interrupts() on GPIO chip de-registration Serge Semin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.