mfd: Micro-optimization on twl4030 IRQ handler
authorFelipe Balbi <balbi@ti.com>
Wed, 22 Feb 2012 12:53:59 +0000 (14:53 +0200)
committerSamuel Ortiz <sameo@linux.intel.com>
Thu, 22 Mar 2012 12:05:11 +0000 (13:05 +0100)
__ffs() will be far faster than the for loop used.

Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
drivers/mfd/twl4030-irq.c

index d6f3a5e9f7bd67a18aa38781c624271ce57f77a0..3b748b71c0f35167ae87f91f3cd86b5a477caa9f 100644 (file)
@@ -293,7 +293,6 @@ static unsigned twl4030_irq_base;
  */
 static irqreturn_t handle_twl4030_pih(int irq, void *devid)
 {
-       int             module_irq;
        irqreturn_t     ret;
        u8              pih_isr;
 
@@ -304,12 +303,13 @@ static irqreturn_t handle_twl4030_pih(int irq, void *devid)
                return IRQ_NONE;
        }
 
-       /* these handlers deal with the relevant SIH irq status */
-       for (module_irq = twl4030_irq_base;
-                       pih_isr;
-                       pih_isr >>= 1, module_irq++) {
-               if (pih_isr & 0x1)
-                       handle_nested_irq(module_irq);
+       while (pih_isr) {
+               unsigned long   pending = __ffs(pih_isr);
+               unsigned int    irq;
+
+               pih_isr &= ~BIT(pending);
+               irq = pending + twl4030_irq_base;
+               handle_nested_irq(irq);
        }
 
        return IRQ_HANDLED;