* [PATCH] irqchip: mips-gic: Use for_each_set_bit to iterate over IRQs
@ 2016-08-19 17:11 Paul Burton
2016-08-23 1:13 ` Jason Cooper
0 siblings, 1 reply; 2+ messages in thread
From: Paul Burton @ 2016-08-19 17:11 UTC (permalink / raw)
To: Thomas Gleixner, Jason Cooper, Marc Zyngier, linux-kernel
Cc: linux-mips, Paul Burton
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 clearer.
Signed-off-by: Paul Burton <paul.burton@imgtec.com>
---
drivers/irqchip/irq-mips-gic.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/drivers/irqchip/irq-mips-gic.c b/drivers/irqchip/irq-mips-gic.c
index d3ef0fc..e9e5022 100644
--- a/drivers/irqchip/irq-mips-gic.c
+++ b/drivers/irqchip/irq-mips-gic.c
@@ -371,18 +371,13 @@ static void gic_handle_shared_int(bool chained)
bitmap_and(pending, pending, intrmask, gic_shared_intrs);
bitmap_and(pending, pending, pcpu_mask, gic_shared_intrs);
- intr = find_first_bit(pending, gic_shared_intrs);
- while (intr != gic_shared_intrs) {
+ for_each_set_bit(intr, pending, gic_shared_intrs) {
virq = irq_linear_revmap(gic_irq_domain,
GIC_SHARED_TO_HWIRQ(intr));
if (chained)
generic_handle_irq(virq);
else
do_IRQ(virq);
-
- /* go to next pending bit */
- bitmap_clear(pending, intr, 1);
- intr = find_first_bit(pending, gic_shared_intrs);
}
}
--
2.9.3
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] irqchip: mips-gic: Use for_each_set_bit to iterate over IRQs
2016-08-19 17:11 [PATCH] irqchip: mips-gic: Use for_each_set_bit to iterate over IRQs Paul Burton
@ 2016-08-23 1:13 ` Jason Cooper
0 siblings, 0 replies; 2+ messages in thread
From: Jason Cooper @ 2016-08-23 1:13 UTC (permalink / raw)
To: Paul Burton; +Cc: Thomas Gleixner, Marc Zyngier, linux-kernel, linux-mips
Hi Paul,
On Fri, Aug 19, 2016 at 06:11:19PM +0100, Paul Burton wrote:
> 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 clearer.
>
> Signed-off-by: Paul Burton <paul.burton@imgtec.com>
> ---
> drivers/irqchip/irq-mips-gic.c | 7 +------
> 1 file changed, 1 insertion(+), 6 deletions(-)
Applied to irqchip/core.
thx,
Jason.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-08-23 1:14 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-19 17:11 [PATCH] irqchip: mips-gic: Use for_each_set_bit to iterate over IRQs Paul Burton
2016-08-23 1:13 ` Jason Cooper
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome