aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpio/gpio-lynxpoint.c
diff options
context:
space:
mode:
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>2018-11-06 14:38:55 +0200
committerAndy Shevchenko <andriy.shevchenko@linux.intel.com>2018-12-03 13:29:56 +0200
commit502ae42ca600760cf32c4de320a91cc37dd5ac89 (patch)
tree223f1a1b00a42a2cdc5067e86bc7a8dea5e10e77 /drivers/gpio/gpio-lynxpoint.c
parentgpio: pch: Convert to dev_pm_ops (diff)
downloadlinux-dev-502ae42ca600760cf32c4de320a91cc37dd5ac89.tar.xz
linux-dev-502ae42ca600760cf32c4de320a91cc37dd5ac89.zip
gpio: lynxpoint: 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. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Diffstat (limited to 'drivers/gpio/gpio-lynxpoint.c')
-rw-r--r--drivers/gpio/gpio-lynxpoint.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/drivers/gpio/gpio-lynxpoint.c b/drivers/gpio/gpio-lynxpoint.c
index b5b5e500e72c..46560d5913a9 100644
--- a/drivers/gpio/gpio-lynxpoint.c
+++ b/drivers/gpio/gpio-lynxpoint.c
@@ -240,21 +240,23 @@ static void lp_gpio_irq_handler(struct irq_desc *desc)
struct gpio_chip *gc = irq_desc_get_handler_data(desc);
struct lp_gpio *lg = gpiochip_get_data(gc);
struct irq_chip *chip = irq_data_get_irq_chip(data);
- u32 base, pin, mask;
unsigned long reg, ena, pending;
+ u32 base, pin;
/* check from GPIO controller which pin triggered the interrupt */
for (base = 0; base < lg->chip.ngpio; base += 32) {
reg = lp_gpio_reg(&lg->chip, base, LP_INT_STAT);
ena = lp_gpio_reg(&lg->chip, base, LP_INT_ENABLE);
- while ((pending = (inl(reg) & inl(ena)))) {
+ /* Only interrupts that are enabled */
+ pending = inl(reg) & inl(ena);
+
+ for_each_set_bit(pin, &pending, 32) {
unsigned irq;
- pin = __ffs(pending);
- mask = BIT(pin);
/* Clear before handling so we don't lose an edge */
- outl(mask, reg);
+ outl(BIT(pin), reg);
+
irq = irq_find_mapping(lg->chip.irq.domain, base + pin);
generic_handle_irq(irq);
}