Skip to content

Commit 77336b9

Browse files
YuryNorovchenhuacai
authored andcommitted
LoongArch: KVM: Rework pch_pic_update_batch_irqs()
Use proper bitmap API and drop all the housekeeping code. Reviewed-by: Bibo Mao <[email protected]> Signed-off-by: Yury Norov (NVIDIA) <[email protected]> Signed-off-by: Huacai Chen <[email protected]>
1 parent f851fdd commit 77336b9

1 file changed

Lines changed: 3 additions & 8 deletions

File tree

arch/loongarch/kvm/intc/pch_pic.c

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,11 @@ static void pch_pic_update_irq(struct loongarch_pch_pic *s, int irq, int level)
3535
/* update batch irqs, the irq_mask is a bitmap of irqs */
3636
static void pch_pic_update_batch_irqs(struct loongarch_pch_pic *s, u64 irq_mask, int level)
3737
{
38-
int irq, bits;
38+
unsigned int irq;
39+
DECLARE_BITMAP(irqs, 64) = { BITMAP_FROM_U64(irq_mask) };
3940

40-
/* find each irq by irqs bitmap and update each irq */
41-
bits = sizeof(irq_mask) * 8;
42-
irq = find_first_bit((void *)&irq_mask, bits);
43-
while (irq < bits) {
41+
for_each_set_bit(irq, irqs, 64)
4442
pch_pic_update_irq(s, irq, level);
45-
bitmap_clear((void *)&irq_mask, irq, 1);
46-
irq = find_first_bit((void *)&irq_mask, bits);
47-
}
4843
}
4944

5045
/* called when a irq is triggered in pch pic */

0 commit comments

Comments
 (0)