virt: acrn: using for_each_set_bit to simplify the code
PATCH 1/1 virt: acrn: using for_each_set_bit to simplify the code
It's more cleanly to use for_each_set_bit() instead of opencoding it.
Signed-off-by Yang Yingliang <[email protected]>
--- drivers/virt/acrn/ioreq.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
drivers/virt/acrn/ioreq.c +1 -5
@@ -246,12 +246,8 @@ void acrn_ioreq_request_clear(struct acrn_vm *vm)spin_lock_bh (&vm->ioreq_clients_lock); client = vm->default_client;if (client) { - vcpu =find_first_bit (client->ioreqs_map,ACRN_IO_REQUEST_MAX ); -while (vcpu <ACRN_IO_REQUEST_MAX ) { +for_each_set_bit (vcpu, client->ioreqs_map,ACRN_IO_REQUEST_MAX )acrn_ioreq_complete_request (client, vcpu,NULL ); - vcpu =find_next_bit (client->ioreqs_map, -ACRN_IO_REQUEST_MAX , vcpu +1 ); - } }spin_unlock_bh (&vm->ioreq_clients_lock);
Signature · 1 line
2.25.1
Li Fei1
maintainerQuoted 3 lines · Yang Yingliang
It's more cleanly to use
for_each_set_bit()instead of opencoding it.Signed-off-by Yang Yingliang <[email protected]>
Signed-off-by Fei Li <[email protected]>
Thanks.
Quoted 25 lines
--- drivers/virt/acrn/ioreq.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)drivers/virt/acrn/ioreq.c +1
-5@@ -246,12 +246,8 @@ void acrn_ioreq_request_clear(struct acrn_vm *vm)spin_lock_bh (&vm->ioreq_clients_lock); client = vm->default_client;if (client) { - vcpu =find_first_bit (client->ioreqs_map,ACRN_IO_REQUEST_MAX ); -while (vcpu <ACRN_IO_REQUEST_MAX ) { +for_each_set_bit (vcpu, client->ioreqs_map,ACRN_IO_REQUEST_MAX )acrn_ioreq_complete_request (client, vcpu,NULL ); - vcpu =find_next_bit (client->ioreqs_map, -ACRN_IO_REQUEST_MAX , vcpu +1 ); - } }spin_unlock_bh (&vm->ioreq_clients_lock);Signature · 1 line
2.25.1