[PATCH 1/3] KVM: PPC: simplify kvmppc_core_prepare_to_enter()
From: Yury Norov
Date: Thu Jul 17 2025 - 15:24:50 EST
From: Yury Norov (NVIDIA) <yury.norov@xxxxxxxxx>
The function opencodes for_each_set_bit() macro.
Signed-off-by: Yury Norov (NVIDIA) <yury.norov@xxxxxxxxx>
---
arch/powerpc/kvm/book3s.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/arch/powerpc/kvm/book3s.c b/arch/powerpc/kvm/book3s.c
index d79c5d1098c0..dc05ea496aad 100644
--- a/arch/powerpc/kvm/book3s.c
+++ b/arch/powerpc/kvm/book3s.c
@@ -401,17 +401,12 @@ int kvmppc_core_prepare_to_enter(struct kvm_vcpu *vcpu)
if (vcpu->arch.pending_exceptions)
printk(KERN_EMERG "KVM: Check pending: %lx\n", vcpu->arch.pending_exceptions);
#endif
- priority = __ffs(*pending);
- while (priority < BOOK3S_IRQPRIO_MAX) {
+ for_each_set_bit(priority, pending, BOOK3S_IRQPRIO_MAX) {
if (kvmppc_book3s_irqprio_deliver(vcpu, priority) &&
clear_irqprio(vcpu, priority)) {
clear_bit(priority, &vcpu->arch.pending_exceptions);
break;
}
-
- priority = find_next_bit(pending,
- BITS_PER_BYTE * sizeof(*pending),
- priority + 1);
}
/* Tell the guest about our interrupt status */
--
2.43.0