[PATCH] gpio: mvebu: Slightly optimize mvebu_gpio_irq_handler()

Christophe JAILLET posted 1 patch 3 months, 3 weeks ago
drivers/gpio/gpio-mvebu.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
[PATCH] gpio: mvebu: Slightly optimize mvebu_gpio_irq_handler()
Posted by Christophe JAILLET 3 months, 3 weeks ago
In the main loop of mvebu_gpio_irq_handler() some calls to
irq_find_mapping() can be saved.

There is no point to find an irq number before checking if this something
has to be done.
By testing first, some calls can be saved.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
Compile tested only.
---
 drivers/gpio/gpio-mvebu.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/gpio/gpio-mvebu.c b/drivers/gpio/gpio-mvebu.c
index ac799fced950..22c36b79e249 100644
--- a/drivers/gpio/gpio-mvebu.c
+++ b/drivers/gpio/gpio-mvebu.c
@@ -573,11 +573,10 @@ static void mvebu_gpio_irq_handler(struct irq_desc *desc)
 	for (i = 0; i < mvchip->chip.ngpio; i++) {
 		int irq;
 
-		irq = irq_find_mapping(mvchip->domain, i);
-
 		if (!(cause & BIT(i)))
 			continue;
 
+		irq = irq_find_mapping(mvchip->domain, i);
 		type = irq_get_trigger_type(irq);
 		if ((type & IRQ_TYPE_SENSE_MASK) == IRQ_TYPE_EDGE_BOTH) {
 			/* Swap polarity (race with GPIO line) */
-- 
2.51.0
Re: [PATCH] gpio: mvebu: Slightly optimize mvebu_gpio_irq_handler()
Posted by Bartosz Golaszewski 3 months, 3 weeks ago
From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>


On Sun, 19 Oct 2025 10:31:38 +0200, Christophe JAILLET wrote:
> In the main loop of mvebu_gpio_irq_handler() some calls to
> irq_find_mapping() can be saved.
> 
> There is no point to find an irq number before checking if this something
> has to be done.
> By testing first, some calls can be saved.
> 
> [...]

Applied, thanks!

[1/1] gpio: mvebu: Slightly optimize mvebu_gpio_irq_handler()
      https://git.kernel.org/brgl/linux/c/eb7f1c8415bbbb81f8674a490a5da7c22599a012

Best regards,
-- 
Bartosz Golaszewski <bartosz.golaszewski@linaro.org>