Skip to content

Commit cae750b

Browse files
paulburtonJason Cooper
authored andcommitted
irqchip/mips-gic: Use for_each_set_bit to iterate over IRQs
The MIPS GIC driver has previously iterated over bits set in a bitmap representing pending 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 more clear. Signed-off-by: Paul Burton <paul.burton@imgtec.com> Link: https://lkml.kernel.org/r/20160819171119.28121-1-paul.burton@imgtec.com Signed-off-by: Jason Cooper <jason@lakedaemon.net>
1 parent 29b4817 commit cae750b

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
@@ -371,18 +371,13 @@ static void gic_handle_shared_int(bool chained)
371371
bitmap_and(pending, pending, intrmask, gic_shared_intrs);
372372
bitmap_and(pending, pending, pcpu_mask, gic_shared_intrs);
373373

374-
intr = find_first_bit(pending, gic_shared_intrs);
375-
while (intr != gic_shared_intrs) {
374+
for_each_set_bit(intr, pending, gic_shared_intrs) {
376375
virq = irq_linear_revmap(gic_irq_domain,
377376
GIC_SHARED_TO_HWIRQ(intr));
378377
if (chained)
379378
generic_handle_irq(virq);
380379
else
381380
do_IRQ(virq);
382-
383-
/* go to next pending bit */
384-
bitmap_clear(pending, intr, 1);
385-
intr = find_first_bit(pending, gic_shared_intrs);
386381
}
387382
}
388383

0 commit comments

Comments
 (0)