* [PATCH -next] virt: acrn: using for_each_set_bit to simplify the code
@ 2022-07-04 12:50 Yang Yingliang
2022-07-06 7:32 ` Li Fei1
0 siblings, 1 reply; 2+ messages in thread
From: Yang Yingliang @ 2022-07-04 12:50 UTC (permalink / raw)
To: linux-kernel; +Cc: fei1.li, gregkh
It's more cleanly to use for_each_set_bit() instead of opencoding it.
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
drivers/virt/acrn/ioreq.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/drivers/virt/acrn/ioreq.c b/drivers/virt/acrn/ioreq.c
index 5ff1c53740c0..d75ab3f66da4 100644
--- a/drivers/virt/acrn/ioreq.c
+++ b/drivers/virt/acrn/ioreq.c
@@ -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);
--
2.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH -next] virt: acrn: using for_each_set_bit to simplify the code
2022-07-04 12:50 [PATCH -next] virt: acrn: using for_each_set_bit to simplify the code Yang Yingliang
@ 2022-07-06 7:32 ` Li Fei1
0 siblings, 0 replies; 2+ messages in thread
From: Li Fei1 @ 2022-07-06 7:32 UTC (permalink / raw)
To: Yang Yingliang; +Cc: linux-kernel, gregkh
On Mon, Jul 04, 2022 at 08:50:44PM +0800, Yang Yingliang wrote:
> It's more cleanly to use for_each_set_bit() instead of opencoding it.
>
> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Signed-off-by: Fei Li <fei1.li@intel.com>
Thanks.
> ---
> drivers/virt/acrn/ioreq.c | 6 +-----
> 1 file changed, 1 insertion(+), 5 deletions(-)
>
> diff --git a/drivers/virt/acrn/ioreq.c b/drivers/virt/acrn/ioreq.c
> index 5ff1c53740c0..d75ab3f66da4 100644
> --- a/drivers/virt/acrn/ioreq.c
> +++ b/drivers/virt/acrn/ioreq.c
> @@ -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);
>
> --
> 2.25.1
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-07-06 7:31 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-04 12:50 [PATCH -next] virt: acrn: using for_each_set_bit to simplify the code Yang Yingliang
2022-07-06 7:32 ` Li Fei1
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).