mips: kvm: simplify kvm_mips_deliver_interrupts()
PATCH 1/1 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 <[email protected]>
--- arch/mips/kvm/interrupt.c | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-)
arch/mips/kvm/interrupt.c +2 -18
@@ -27,27 +27,11 @@ void kvm_mips_deliver_interrupts(struct kvm_vcpu *vcpu, u32 cause)unsigned long *pending_clr = &vcpu->arch.pending_exceptions_clr;unsigned int priority; -if (!(*pending) && !(*pending_clr)) -return ; - - priority =__ffs (*pending_clr); -while (priority <=MIPS_EXC_MAX ) { +for_each_set_bit (priority, pending_clr,MIPS_EXC_MAX +1 ) kvm_mips_callbacks->irq_clear (vcpu, priority, cause); - priority =find_next_bit (pending_clr, -BITS_PER_BYTE *sizeof (*pending_clr), - priority +1 ); - } - - priority =__ffs (*pending); -while (priority <=MIPS_EXC_MAX ) { +for_each_set_bit (priority, pending,MIPS_EXC_MAX +1 ) kvm_mips_callbacks->irq_deliver (vcpu, priority, cause); - - priority =find_next_bit (pending, -BITS_PER_BYTE *sizeof (*pending), - priority +1 ); - } - }int kvm_mips_pending_timer (struct kvm_vcpu *vcpu)
Signature · 1 line
2.43.0
Quoted 7 lines · Yury Norov
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 <[email protected]>--- arch/mips/kvm/interrupt.c | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-)
applied to mips-next.
Thomas.
Signature · 2 lines
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a good idea. [ RFC1925, 2.3 ]