Skip to content

Commit 263e954

Browse files
YuryNorovtsbogend
authored andcommitted
mips: kvm: simplify kvm_mips_deliver_interrupts()
The function opencodes for_each_set_bit() macro, which makes it bulky. Using the proper API makes all the housekeeping code go away. Signed-off-by: Yury Norov <yury.norov@gmail.com> Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
1 parent 4ebb6c9 commit 263e954

1 file changed

Lines changed: 2 additions & 18 deletions

File tree

arch/mips/kvm/interrupt.c

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -27,27 +27,11 @@ void kvm_mips_deliver_interrupts(struct kvm_vcpu *vcpu, u32 cause)
2727
unsigned long *pending_clr = &vcpu->arch.pending_exceptions_clr;
2828
unsigned int priority;
2929

30-
if (!(*pending) && !(*pending_clr))
31-
return;
32-
33-
priority = __ffs(*pending_clr);
34-
while (priority <= MIPS_EXC_MAX) {
30+
for_each_set_bit(priority, pending_clr, MIPS_EXC_MAX + 1)
3531
kvm_mips_callbacks->irq_clear(vcpu, priority, cause);
3632

37-
priority = find_next_bit(pending_clr,
38-
BITS_PER_BYTE * sizeof(*pending_clr),
39-
priority + 1);
40-
}
41-
42-
priority = __ffs(*pending);
43-
while (priority <= MIPS_EXC_MAX) {
33+
for_each_set_bit(priority, pending, MIPS_EXC_MAX + 1)
4434
kvm_mips_callbacks->irq_deliver(vcpu, priority, cause);
45-
46-
priority = find_next_bit(pending,
47-
BITS_PER_BYTE * sizeof(*pending),
48-
priority + 1);
49-
}
50-
5135
}
5236

5337
int kvm_mips_pending_timer(struct kvm_vcpu *vcpu)

0 commit comments

Comments
 (0)