Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3796625pxj; Mon, 21 Jun 2021 06:52:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwm36+6cCZ/TQEEVNLwlT6lN6iZbONtG4uwXjfcrE6lJU5JJSzo8WN64TSf00NRurPHuPN3 X-Received: by 2002:a92:d2d1:: with SMTP id w17mr10868779ilg.80.1624283521532; Mon, 21 Jun 2021 06:52:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624283521; cv=none; d=google.com; s=arc-20160816; b=XIKxocmd939vJ1OgmYjUgrxwzph1K2/RTqQftlrfO2Hg8CiEKoi6iVJd/LWjnEeMye 9gpWHzFiFKGq345jOZQrWY0j+/hm1y7S79g1xOyM9EYBCq8LCv9U1H1G0/SkHlOM14WT i/OcsG2iw5KU46mEBm2Hw3Cmsi4KO95bmDf9FPxcSiU+oARghYY2M4d9L76I7A+6x0qF OPHwG+lhdlmVs5+Lf740wdewO5xl2J9SKeQyXgdqPPnQXamVVumhPs5SHy6AAQmYDwdB xJJRaBkxm3OQ5F1eYBYrgELrzVs+zIUb01iAFi4rhFM5WCv2He/BWzktV55AJQVyK8mT yNiw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=TREWgCZWamyM+cAvFe+be+iyBQ2mM4FCIj8jAxnCWs0=; b=WVa4X8MS04tblwTWVIOMbsApYHqXyYuWmwb3RjSufI4SroPUqAYuJ7S3YZvBryX1LW 5zt8gwo4ref9zTWLcLgvYVXJPTzyje1FjDnnEKn2cYX/EKqLlMiKuzqT2c5t71nfl7z8 3mVqH32bcKoeiYMY6320NIkY9elk2EzMk6L9mOfnY8tVLsRz1WOCMpef/EywfvjXGITa RZ1/DnTnqoa+fh+AxewWOe8sz7qpcN2InsS25/chgGt4qxR7e9BIL7rBBdbA24yXKOZd AIUAG0NwvYWnEEaHvS2l30t5NkvdeUSjpQBaiar2TwC3UAEBfblsPIJEr/OCrmYmeBtY BUwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=fEpcFCM2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x19si19514999jat.6.2021.06.21.06.51.49; Mon, 21 Jun 2021 06:52:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=fEpcFCM2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230160AbhFUNxZ (ORCPT + 99 others); Mon, 21 Jun 2021 09:53:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49718 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229789AbhFUNxY (ORCPT ); Mon, 21 Jun 2021 09:53:24 -0400 Received: from mail-pl1-x62d.google.com (mail-pl1-x62d.google.com [IPv6:2607:f8b0:4864:20::62d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 08700C061574; Mon, 21 Jun 2021 06:51:08 -0700 (PDT) Received: by mail-pl1-x62d.google.com with SMTP id c15so8513297pls.13; Mon, 21 Jun 2021 06:51:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=TREWgCZWamyM+cAvFe+be+iyBQ2mM4FCIj8jAxnCWs0=; b=fEpcFCM2VjpxKDX6qBcqcW976jrBvNzdDnqeE7kkmCA54xvYA4tjne6uHuRPjecEbr JB9MtUDnrHIPae2hAflr8rrpbzIZwu5s8pvuWPRaVeAHzJDk1LtGQsAg6m0Uvv6waFVi IYqPOVWlKZlVSDTIDk0gj8bSXfzdIYB/avCm8m4wpaEn2vD/q9t+UWhFeXfrZF/ggsl8 nDAMEXJNPyGYM0f7+U32sdGdLo69dfwECtTNfintPs6QIW1gs3v48Po+50q7BbBtz8u9 5OrzIka2R+hFKvGmDHqgS+eKEfvhaXhb68CxDcOOK8JMq0xrwtATR5CHGmp6K1NMTDvq SKrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=TREWgCZWamyM+cAvFe+be+iyBQ2mM4FCIj8jAxnCWs0=; b=EsNfity4yVD3MmeySEzAm/BbrAJ9dyH2dMLmcJ0C1QnrwwnDodEg3/UdmF2+GQ4E9h 1Mv8N2slflLXU1ijYweDIsd4oT5tQ2pH93J1cREZfW0zLgE8X758DpIV/Z/Kq4njTA+B Vo6BJ2yqN7oydxLlnF2mrGg6CBZuo3K8CkCY9Le3mOc2VTJZqe/vc/9+nIWyWap9yF07 Bmnxr+NuDVh9DwgWwT7RdX9Qpca9YBM1QbvU7S9EPxotRQgBMRERxal9w/BEAHbK6GgF qDy1UrGD1k5Pb6+AH3od1QYOvuu4VCwYXGWYK+bCcNbv1OPzfc7+8HGYEn9CqyfvaZyx vWLg== X-Gm-Message-State: AOAM530OF5Ab1WOK22bRAnZhaCKJFfyyT9aAoY5L0QEHRXaXT2lOrFe8 hM7sxbw1aGPZR2HWMZFb6jw= X-Received: by 2002:a17:902:d4cb:b029:124:3333:9ded with SMTP id o11-20020a170902d4cbb029012433339dedmr6883227plg.22.1624283467638; Mon, 21 Jun 2021 06:51:07 -0700 (PDT) Received: from localhost ([209.132.188.80]) by smtp.gmail.com with ESMTPSA id k25sm15256121pfa.213.2021.06.21.06.51.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Jun 2021 06:51:07 -0700 (PDT) From: Coiby Xu To: linux-staging@lists.linux.dev Cc: netdev@vger.kernel.org, Benjamin Poirier , Shung-Hsi Yu , Manish Chopra , GR-Linux-NIC-Dev@marvell.com (supporter:QLOGIC QLGE 10Gb ETHERNET DRIVER), Greg Kroah-Hartman , linux-kernel@vger.kernel.org (open list) Subject: [RFC 12/19] staging: qlge: rewrite do while loops as for loops in qlge_start_rx_ring Date: Mon, 21 Jun 2021 21:48:55 +0800 Message-Id: <20210621134902.83587-13-coiby.xu@gmail.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210621134902.83587-1-coiby.xu@gmail.com> References: <20210621134902.83587-1-coiby.xu@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Since MAX_DB_PAGES_PER_BQ > 0, the for loop is equivalent to do while loop. Signed-off-by: Coiby Xu --- 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; - 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