[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YNGVEiS8mITXQ5sS@d3>
Date: Tue, 22 Jun 2021 16:45:22 +0900
From: Benjamin Poirier <benjamin.poirier@...il.com>
To: Coiby Xu <coiby.xu@...il.com>
Cc: linux-staging@...ts.linux.dev, netdev@...r.kernel.org,
Shung-Hsi Yu <shung-hsi.yu@...e.com>,
Manish Chopra <manishc@...vell.com>,
"supporter:QLOGIC QLGE 10Gb ETHERNET DRIVER"
<GR-Linux-NIC-Dev@...vell.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
open list <linux-kernel@...r.kernel.org>
Subject: Re: [RFC 12/19] staging: qlge: rewrite do while loops as for loops
in qlge_start_rx_ring
On 2021-06-21 21:48 +0800, Coiby Xu wrote:
> Since MAX_DB_PAGES_PER_BQ > 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 | 10 ++++------
> 1 file changed, 4 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/staging/qlge/qlge_main.c b/drivers/staging/qlge/qlge_main.c
> index 7aee9e904097..c5e161595b1f 100644
> --- a/drivers/staging/qlge/qlge_main.c
> +++ b/drivers/staging/qlge/qlge_main.c
> @@ -3029,12 +3029,11 @@ static int qlge_start_cq(struct qlge_adapter *qdev, struct qlge_cq *cq)
> tmp = (u64)rx_ring->lbq.base_dma;
> base_indirect_ptr = rx_ring->lbq.base_indirect;
> page_entries = 0;
This initialization can be removed now. Same thing below.
> - do {
> + for (page_entries = 0; page_entries < MAX_DB_PAGES_PER_BQ; page_entries++) {
> *base_indirect_ptr = cpu_to_le64(tmp);
> tmp += DB_PAGE_SIZE;
> base_indirect_ptr++;
> - page_entries++;
> - } while (page_entries < MAX_DB_PAGES_PER_BQ);
> + }
> cqicb->lbq_addr = cpu_to_le64(rx_ring->lbq.base_indirect_dma);
> cqicb->lbq_buf_size =
> cpu_to_le16(QLGE_FIT16(qdev->lbq_buf_size));
> @@ -3046,12 +3045,11 @@ static int qlge_start_cq(struct qlge_adapter *qdev, struct qlge_cq *cq)
> tmp = (u64)rx_ring->sbq.base_dma;
> base_indirect_ptr = rx_ring->sbq.base_indirect;
> page_entries = 0;
> - do {
> + for (page_entries = 0; page_entries < MAX_DB_PAGES_PER_BQ; page_entries++) {
> *base_indirect_ptr = cpu_to_le64(tmp);
> tmp += DB_PAGE_SIZE;
> base_indirect_ptr++;
> - page_entries++;
> - } while (page_entries < MAX_DB_PAGES_PER_BQ);
> + }
> cqicb->sbq_addr = cpu_to_le64(rx_ring->sbq.base_indirect_dma);
> cqicb->sbq_buf_size = cpu_to_le16(QLGE_SMALL_BUFFER_SIZE);
> cqicb->sbq_len = cpu_to_le16(QLGE_FIT16(QLGE_BQ_LEN));
> --
> 2.32.0
>
Powered by blists - more mailing lists