From patchwork Fri Jul 8 16:47:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 12911486 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 334C5C433EF for ; Fri, 8 Jul 2022 16:47:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238745AbiGHQrn (ORCPT ); Fri, 8 Jul 2022 12:47:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59968 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238135AbiGHQrl (ORCPT ); Fri, 8 Jul 2022 12:47:41 -0400 Received: from smtp.smtpout.orange.fr (smtp06.smtpout.orange.fr [80.12.242.128]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0DD31735B5 for ; Fri, 8 Jul 2022 09:47:41 -0700 (PDT) Received: from pop-os.home ([90.11.190.129]) by smtp.orange.fr with ESMTPA id 9r8kojI1ym7vs9r8loGHRC; Fri, 08 Jul 2022 18:47:39 +0200 X-ME-Helo: pop-os.home X-ME-Auth: YWZlNiIxYWMyZDliZWIzOTcwYTEyYzlhMmU3ZiQ1M2U2MzfzZDfyZTMxZTBkMTYyNDBjNDJlZmQ3ZQ== X-ME-Date: Fri, 08 Jul 2022 18:47:39 +0200 X-ME-IP: 90.11.190.129 From: Christophe JAILLET To: "Md. Haris Iqbal" , Jack Wang , Jason Gunthorpe , Leon Romanovsky Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET , linux-rdma@vger.kernel.org Subject: [PATCH 2/2] RDMA/rtrs-clt: Use bitmap_empty() Date: Fri, 8 Jul 2022 18:47:37 +0200 Message-Id: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org Use bitmap_empty() instead of hand-writing them. Signed-off-by: Christophe JAILLET Acked-by: Jack Wang --- 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);