summaryrefslogtreecommitdiff
path: root/drivers/gpio/gpio-ep93xx.c
diff options
context:
space:
mode:
authorLinus Walleij <linus.walleij@linaro.org>2018-08-22 22:41:09 +0200
committerLinus Walleij <linus.walleij@linaro.org>2018-08-29 09:09:02 +0200
commit68491b075db2e905d7df1594cf127da9bcd05cab (patch)
tree9e0e30802f92ab93f62825c9d8da168281a52f4a /drivers/gpio/gpio-ep93xx.c
parent51ba88e32ff5b3caee39862c862a7a1fbae78b2b (diff)
gpio: ep93xx: Use for_each_set_bit() in IRQ handler
This simplifies and standardizes the AB IRQ handler by using the for_each_set_bit() library function. Acked-by: Alexander Sverdlin <alexander.sverdlin@gmail.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/gpio/gpio-ep93xx.c')
-rw-r--r--drivers/gpio/gpio-ep93xx.c24
1 files changed, 10 insertions, 14 deletions
diff --git a/drivers/gpio/gpio-ep93xx.c b/drivers/gpio/gpio-ep93xx.c
index b2139ec43ce2..1248d83f860b 100644
--- a/drivers/gpio/gpio-ep93xx.c
+++ b/drivers/gpio/gpio-ep93xx.c
@@ -105,25 +105,21 @@ static void ep93xx_gpio_ab_irq_handler(struct irq_desc *desc)
struct gpio_chip *gc = irq_desc_get_handler_data(desc);
struct ep93xx_gpio *epg = gpiochip_get_data(gc);
struct irq_chip *irqchip = irq_desc_get_chip(desc);
- unsigned char status;
- int i;
+ unsigned long stat;
+ int offset;
chained_irq_enter(irqchip, desc);
- status = readb(epg->base + EP93XX_GPIO_A_INT_STATUS);
- for (i = 0; i < 8; i++) {
- if (status & (1 << i)) {
- int gpio_irq = gpio_to_irq(0) + i;
- generic_handle_irq(gpio_irq);
- }
+ stat = readb(epg->base + EP93XX_GPIO_A_INT_STATUS);
+ for_each_set_bit(offset, &stat, 8) {
+ int gpio_irq = gpio_to_irq(0) + offset;
+ generic_handle_irq(gpio_irq);
}
- status = readb(epg->base + EP93XX_GPIO_B_INT_STATUS);
- for (i = 0; i < 8; i++) {
- if (status & (1 << i)) {
- int gpio_irq = gpio_to_irq(8) + i;
- generic_handle_irq(gpio_irq);
- }
+ stat = readb(epg->base + EP93XX_GPIO_B_INT_STATUS);
+ for_each_set_bit(offset, &stat, 8) {
+ int gpio_irq = gpio_to_irq(8) + offset;
+ generic_handle_irq(gpio_irq);
}
chained_irq_exit(irqchip, desc);