[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1386042188-12246-5-git-send-email-balbi@ti.com>
Date: Mon, 2 Dec 2013 21:42:58 -0600
From: Felipe Balbi <balbi@...com>
To: Linux OMAP Mailing List <linux-omap@...r.kernel.org>
CC: Aaro Koskinen <aaro.koskinen@....fi>, <sameo@...ux.intel.com>,
Tony Lindgren <tony@...mide.com>, <lee.jones@...aro.org>,
Linux ARM Kernel Mailing List
<linux-arm-kernel@...ts.infradead.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Felipe Balbi <balbi@...com>
Subject: [PATCH v2 05/15] mfd: menelaus: Use for_each_set_bit()
that macro just helps removing some extra
line of code and hides ffs() calls.
while at that, also fix a variable shadowing
bug where 'int irq' was being redeclared inside
inner loop while it was also argument to interrupt
handler.
Signed-off-by: Felipe Balbi <balbi@...com>
---
drivers/mfd/menelaus.c | 16 +++++++---------
1 file changed, 7 insertions(+), 9 deletions(-)
diff --git a/drivers/mfd/menelaus.c b/drivers/mfd/menelaus.c
index 11dc4d3..9ccbb79 100644
--- a/drivers/mfd/menelaus.c
+++ b/drivers/mfd/menelaus.c
@@ -795,24 +795,22 @@ static irqreturn_t menelaus_irq(int irq, void *_menelaus)
{
struct menelaus_chip *menelaus = _menelaus;
void (*handler)(struct menelaus_chip *menelaus);
- unsigned isr;
+ unsigned long isr;
+ unsigned long i;
isr = (menelaus_read_reg(MENELAUS_INT_STATUS2)
& ~menelaus->mask2) << 8;
isr |= menelaus_read_reg(MENELAUS_INT_STATUS1)
& ~menelaus->mask1;
- while (isr) {
- int irq = fls(isr) - 1;
- isr &= ~(1 << irq);
-
+ for_each_set_bit(i, &isr, 16) {
mutex_lock(&menelaus->lock);
- menelaus_disable_irq(irq);
- menelaus_ack_irq(irq);
- handler = menelaus->handlers[irq];
+ menelaus_disable_irq(i);
+ menelaus_ack_irq(i);
+ handler = menelaus->handlers[i];
if (handler)
handler(menelaus);
- menelaus_enable_irq(irq);
+ menelaus_enable_irq(i);
mutex_unlock(&menelaus->lock);
}
--
1.8.4.GIT
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists