LoongArch: KVM: rework pch_pic_update_batch_irqs()
Subsystems (3)
PATCH 1/1 LoongArch: KVM: rework pch_pic_update_batch_irqs()
Use proper bitmap API and drop all the housekeeping code.
Signed-off-by Yury Norov (NVIDIA) <[email protected]>
--- arch/loongarch/kvm/intc/pch_pic.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-)
arch/loongarch/kvm/intc/pch_pic.c +3 -8
@@ -35,16 +35,11 @@ static void pch_pic_update_irq(struct loongarch_pch_pic *s, int irq, int level)/* update batch irqs, the irq_mask is a bitmap of irqs */ static void pch_pic_update_batch_irqs (struct loongarch_pch_pic *s,u64 irq_mask,int level) { -int irq, bits; + DECLARE_BITMAP(irqs, 64) = { BITMAP_FROM_U64(irq_mask) }; +unsigned int irq; -/* find each irq by irqs bitmap and update each irq */ - bits =sizeof (irq_mask) *8 ; - irq =find_first_bit ((void *)&irq_mask, bits); -while (irq < bits) { +for_each_set_bit (irq, irqs,64 )pch_pic_update_irq (s, irq, level); -bitmap_clear ((void *)&irq_mask, irq,1 ); - irq =find_first_bit ((void *)&irq_mask, bits); - } }/* called when a irq is triggered in pch pic */
Signature · 1 line
2.43.0
Quoted 22 lines · Yury Norov (NVIDIA)
Use proper bitmap API and drop all the housekeeping code.
Signed-off-by Yury Norov (NVIDIA) <[email protected]>--- arch/loongarch/kvm/intc/pch_pic.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-)arch/loongarch/kvm/intc/pch_pic.c +2
-3@@ -35,16 +35,11 @@ static void pch_pic_update_irq(struct loongarch_pch_pic *s, int irq, int level)/* update batch irqs, the irq_mask is a bitmap of irqs */ static void pch_pic_update_batch_irqs (struct loongarch_pch_pic *s,u64 irq_mask,int level) { -int irq, bits; + DECLARE_BITMAP(irqs, 64) = { BITMAP_FROM_U64(irq_mask) }; +unsigned int irq; -/* find each irq by irqs bitmap and update each irq */ - bits =sizeof (irq_mask) *8 ;
arch/loongarch/kvm/intc/pch_pic.c static void pch_pic_update_irq(struct loongarch_pch_pic *s, int irq, int level) · line 45
Quoted 10 lines
arch/loongarch/kvm/intc/pch_pic.c +1
-5- irq =find_first_bit ((void *)&irq_mask, bits); -while (irq < bits) { +for_each_set_bit (irq, irqs,64 )pch_pic_update_irq (s, irq, level); -bitmap_clear ((void *)&irq_mask, irq,1 ); - irq =find_first_bit ((void *)&irq_mask, bits); - } }/* called when a irq is triggered in pch pic */
Thanks for doing this.
Reviewed-by Bibo Mao <[email protected]>
Quoted 34 lines · Bibo Mao
Quoted 30 lines · Yury Norov (NVIDIA)
Use proper bitmap API and drop all the housekeeping code.
Signed-off-by Yury Norov (NVIDIA) <[email protected]>--- arch/loongarch/kvm/intc/pch_pic.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-)arch/loongarch/kvm/intc/pch_pic.c +3
-8@@ -35,16 +35,11 @@ static void pch_pic_update_irq(struct loongarch_pch_pic *s, int irq, int level)/* update batch irqs, the irq_mask is a bitmap of irqs */ static void pch_pic_update_batch_irqs (struct loongarch_pch_pic *s,u64 irq_mask,int level) { -int irq, bits; + DECLARE_BITMAP(irqs, 64) = { BITMAP_FROM_U64(irq_mask) }; +unsigned int irq; -/* find each irq by irqs bitmap and update each irq */ - bits =sizeof (irq_mask) *8 ; - irq =find_first_bit ((void *)&irq_mask, bits); -while (irq < bits) { +for_each_set_bit (irq, irqs,64 )pch_pic_update_irq (s, irq, level); -bitmap_clear ((void *)&irq_mask, irq,1 ); - irq =find_first_bit ((void *)&irq_mask, bits); - } }
Quoted 5 lines
arch/loongarch/kvm/intc/pch_pic.c static void pch_pic_update_irq(struct loongarch_pch_pic *s, int irq, int level) · line 45
Quoted 2 lines
arch/loongarch/kvm/intc/pch_pic.c +0
-0/* called when a irq is triggered in pch pic */ Thanks for doing this.
Reviewed-by Bibo Mao <[email protected]>
Queued, thanks.
Huacai