diff options
author | Lars-Peter Clausen <lars@metafoo.de> | 2014-08-18 05:54:55 -0400 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2014-08-29 02:31:57 -0400 |
commit | 5a2533a7478334593c50284fd414c70b3b9217c0 (patch) | |
tree | a14c0439a5193c28f7779e9ff2421336e1db7491 /drivers/gpio | |
parent | a879891ee80413f6999905db43ad0d6852dfa6ca (diff) |
gpio: zynq: Reduce level of indention in zynq_gpio_irqhandler()
zynq_gpio_irqhandler() uses up to 7 tabs of indention in some parts. Refactor
things to use a helper function for the inner loop to reduce the indention to a
sane level.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/gpio')
-rw-r--r-- | drivers/gpio/gpio-zynq.c | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/drivers/gpio/gpio-zynq.c b/drivers/gpio/gpio-zynq.c index 6e5146c8e254..36034b6811bb 100644 --- a/drivers/gpio/gpio-zynq.c +++ b/drivers/gpio/gpio-zynq.c | |||
@@ -457,6 +457,24 @@ static struct irq_chip zynq_gpio_edge_irqchip = { | |||
457 | .irq_set_wake = zynq_gpio_set_wake, | 457 | .irq_set_wake = zynq_gpio_set_wake, |
458 | }; | 458 | }; |
459 | 459 | ||
460 | static void zynq_gpio_handle_bank_irq(struct zynq_gpio *gpio, | ||
461 | unsigned int bank_num, | ||
462 | unsigned long pending) | ||
463 | { | ||
464 | struct irq_domain *irqdomain = gpio->chip.irqdomain; | ||
465 | int offset; | ||
466 | |||
467 | if (!pending) | ||
468 | return; | ||
469 | |||
470 | for_each_set_bit(offset, &pending, 32) { | ||
471 | unsigned int gpio_irq; | ||
472 | |||
473 | gpio_irq = irq_find_mapping(irqdomain, offset); | ||
474 | generic_handle_irq(gpio_irq); | ||
475 | } | ||
476 | } | ||
477 | |||
460 | /** | 478 | /** |
461 | * zynq_gpio_irqhandler - IRQ handler for the gpio banks of a gpio device | 479 | * zynq_gpio_irqhandler - IRQ handler for the gpio banks of a gpio device |
462 | * @irq: irq number of the gpio bank where interrupt has occurred | 480 | * @irq: irq number of the gpio bank where interrupt has occurred |
@@ -482,18 +500,7 @@ static void zynq_gpio_irqhandler(unsigned int irq, struct irq_desc *desc) | |||
482 | ZYNQ_GPIO_INTSTS_OFFSET(bank_num)); | 500 | ZYNQ_GPIO_INTSTS_OFFSET(bank_num)); |
483 | int_enb = readl_relaxed(gpio->base_addr + | 501 | int_enb = readl_relaxed(gpio->base_addr + |
484 | ZYNQ_GPIO_INTMASK_OFFSET(bank_num)); | 502 | ZYNQ_GPIO_INTMASK_OFFSET(bank_num)); |
485 | int_sts &= ~int_enb; | 503 | zynq_gpio_handle_bank_irq(gpio, bank_num, int_sts & ~int_enb); |
486 | if (int_sts) { | ||
487 | int offset; | ||
488 | unsigned long pending = int_sts; | ||
489 | |||
490 | for_each_set_bit(offset, &pending, 32) { | ||
491 | unsigned int gpio_irq = | ||
492 | irq_find_mapping(gpio->chip.irqdomain, | ||
493 | offset); | ||
494 | generic_handle_irq(gpio_irq); | ||
495 | } | ||
496 | } | ||
497 | } | 504 | } |
498 | 505 | ||
499 | chained_irq_exit(irqchip, desc); | 506 | chained_irq_exit(irqchip, desc); |