Skip to content

Commit 0f4ed15

Browse files
paulburtonKAGA-KOKO
authored andcommitted
irqchip/mips-gic: Use for_each_set_bit to iterate over local IRQs
The MIPS GIC driver has previously iterated over bits set in a bitmap representing pending local IRQs by calling find_first_bit, clearing that bit then calling find_first_bit again until all bits are clear. If multiple interrupts are pending then this is wasteful, as find_first_bit will have to loop over the whole bitmap from the start. Use the for_each_set_bit macro which performs exactly what we need here instead. It will use find_next_bit and thus only scan over the relevant part of the bitmap, and it makes the intent of the code clearer. This makes the same change for local interrupts that commit cae750b ("irqchip: mips-gic: Use for_each_set_bit to iterate over IRQs") made for shared interrupts. Signed-off-by: Paul Burton <paul.burton@imgtec.com> Cc: Marc Zyngier <marc.zyngier@arm.com> Cc: linux-mips@linux-mips.org Cc: Jason Cooper <jason@lakedaemon.net> Link: http://lkml.kernel.org/r/20160913165427.31686-1-paul.burton@imgtec.com Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
1 parent 464b584 commit 0f4ed15

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

drivers/irqchip/irq-mips-gic.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -518,18 +518,13 @@ static void gic_handle_local_int(bool chained)
518518

519519
bitmap_and(&pending, &pending, &masked, GIC_NUM_LOCAL_INTRS);
520520

521-
intr = find_first_bit(&pending, GIC_NUM_LOCAL_INTRS);
522-
while (intr != GIC_NUM_LOCAL_INTRS) {
521+
for_each_set_bit(intr, &pending, GIC_NUM_LOCAL_INTRS) {
523522
virq = irq_linear_revmap(gic_irq_domain,
524523
GIC_LOCAL_TO_HWIRQ(intr));
525524
if (chained)
526525
generic_handle_irq(virq);
527526
else
528527
do_IRQ(virq);
529-
530-
/* go to next pending bit */
531-
bitmap_clear(&pending, intr, 1);
532-
intr = find_first_bit(&pending, GIC_NUM_LOCAL_INTRS);
533528
}
534529
}
535530

0 commit comments

Comments
 (0)