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 |
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 --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);
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(-)