Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Yury Norov and committed by
Thomas Bogendoerfer
263e954a 4ebb6c95

+2 -18
+2 -18
arch/mips/kvm/interrupt.c
··· 27 27 unsigned long *pending_clr = &vcpu->arch.pending_exceptions_clr; 28 28 unsigned int priority; 29 29 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) 35 31 kvm_mips_callbacks->irq_clear(vcpu, priority, cause); 36 32 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) 44 34 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 - 51 35 } 52 36 53 37 int kvm_mips_pending_timer(struct kvm_vcpu *vcpu)