diff mbox series

[2/2] RDMA/rtrs-clt: Use bitmap_empty()

Message ID b71ccfaf4a47dee8e1ad373604c861479d499b6b.1657298747.git.christophe.jaillet@wanadoo.fr (mailing list archive)
State Accepted
Headers show
Series [1/2] RDMA/rtrs-clt: Use the bitmap API to allocate bitmaps | expand

Commit Message

Christophe JAILLET July 8, 2022, 4:47 p.m. UTC
Use bitmap_empty() instead of hand-writing them.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
 drivers/infiniband/ulp/rtrs/rtrs-clt.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

Comments

Jinpu Wang July 11, 2022, 12:51 p.m. UTC | #1
On Fri, Jul 8, 2022 at 6:47 PM Christophe JAILLET
<christophe.jaillet@wanadoo.fr> wrote:
>
> Use bitmap_empty() instead of hand-writing them.
>
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Acked-by: Jack Wang <jinpu.wang@ionos.com>
Thx!
> ---
>  drivers/infiniband/ulp/rtrs/rtrs-clt.c | 8 +++-----
>  1 file changed, 3 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/infiniband/ulp/rtrs/rtrs-clt.c b/drivers/infiniband/ulp/rtrs/rtrs-clt.c
> index 06c27a3d83f5..8441f0965b56 100644
> --- a/drivers/infiniband/ulp/rtrs/rtrs-clt.c
> +++ b/drivers/infiniband/ulp/rtrs/rtrs-clt.c
> @@ -1433,12 +1433,10 @@ static int alloc_permits(struct rtrs_clt_sess *clt)
>
>  static void free_permits(struct rtrs_clt_sess *clt)
>  {
> -       if (clt->permits_map) {
> -               size_t sz = clt->queue_depth;
> -
> +       if (clt->permits_map)
>                 wait_event(clt->permits_wait,
> -                          find_first_bit(clt->permits_map, sz) >= sz);
> -       }
> +                          bitmap_empty(clt->permits_map, clt->queue_depth));
> +
>         bitmap_free(clt->permits_map);
>         clt->permits_map = NULL;
>         kfree(clt->permits);
> --
> 2.34.1
>
diff mbox series

Patch

diff --git a/drivers/infiniband/ulp/rtrs/rtrs-clt.c b/drivers/infiniband/ulp/rtrs/rtrs-clt.c
index 06c27a3d83f5..8441f0965b56 100644
--- a/drivers/infiniband/ulp/rtrs/rtrs-clt.c
+++ b/drivers/infiniband/ulp/rtrs/rtrs-clt.c
@@ -1433,12 +1433,10 @@  static int alloc_permits(struct rtrs_clt_sess *clt)
 
 static void free_permits(struct rtrs_clt_sess *clt)
 {
-	if (clt->permits_map) {
-		size_t sz = clt->queue_depth;
-
+	if (clt->permits_map)
 		wait_event(clt->permits_wait,
-			   find_first_bit(clt->permits_map, sz) >= sz);
-	}
+			   bitmap_empty(clt->permits_map, clt->queue_depth));
+
 	bitmap_free(clt->permits_map);
 	clt->permits_map = NULL;
 	kfree(clt->permits);