[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20210621134902.83587-15-coiby.xu@gmail.com>
Date: Mon, 21 Jun 2021 21:48:57 +0800
From: Coiby Xu <coiby.xu@...il.com>
To: linux-staging@...ts.linux.dev
Cc: netdev@...r.kernel.org,
Benjamin Poirier <benjamin.poirier@...il.com>,
Shung-Hsi Yu <shung-hsi.yu@...e.com>,
Manish Chopra <manishc@...vell.com>,
GR-Linux-NIC-Dev@...vell.com (supporter:QLOGIC QLGE 10Gb ETHERNET
DRIVER), Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
linux-kernel@...r.kernel.org (open list)
Subject: [RFC 14/19] staging: qlge: rewrite do while loop as for loop in qlge_refill_bq
Since refill_count > 0, the for loop is equivalent to do while
loop.
Signed-off-by: Coiby Xu <coiby.xu@...il.com>
---
drivers/staging/qlge/qlge_main.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/staging/qlge/qlge_main.c b/drivers/staging/qlge/qlge_main.c
index 2d2405be38f5..904dba7aaee5 100644
--- a/drivers/staging/qlge/qlge_main.c
+++ b/drivers/staging/qlge/qlge_main.c
@@ -1092,6 +1092,7 @@ static int qlge_refill_bq(struct qlge_bq *bq, gfp_t gfp)
struct qlge_bq_desc *bq_desc;
int refill_count;
int retval;
+ int count;
int i;
refill_count = QLGE_BQ_WRAP(QLGE_BQ_ALIGN(bq->next_to_clean - 1) -
@@ -1102,7 +1103,7 @@ static int qlge_refill_bq(struct qlge_bq *bq, gfp_t gfp)
i = bq->next_to_use;
bq_desc = &bq->queue[i];
i -= QLGE_BQ_LEN;
- do {
+ for (count = 0; count < refill_count; count++) {
netif_printk(qdev, rx_status, KERN_DEBUG, qdev->ndev,
"ring %u %s: try cleaning idx %d\n",
rx_ring->cq_id, bq_type_name[bq->type], i);
@@ -1124,8 +1125,7 @@ static int qlge_refill_bq(struct qlge_bq *bq, gfp_t gfp)
bq_desc = &bq->queue[0];
i -= QLGE_BQ_LEN;
}
- refill_count--;
- } while (refill_count);
+ }
i += QLGE_BQ_LEN;
if (bq->next_to_use != i) {
--
2.32.0
Powered by blists - more mailing lists