Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4477030pxj; Tue, 22 Jun 2021 00:47:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwKdpE23dHhZ83ISJbGOxtJy2vmtgY3QhLannirRkbFe29I3YnC1k+BsjJvTAM0NrKbJJc5 X-Received: by 2002:aa7:d60a:: with SMTP id c10mr3107323edr.369.1624348020148; Tue, 22 Jun 2021 00:47:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624348020; cv=none; d=google.com; s=arc-20160816; b=Oq6DNB3bmdY5bAfWZxNVZWDxxybapylGoI+lWr3AKiVp+CsD/G8XynyTvQnH5uBiiq GGWG7MECofKdr87yHR2WIyjcMWTzxDYwKW1nbzJ8D2V8mI0akXISdH5qXkp4mOKNlAMX zPZTPUg6aP7w9DjzD5uyRROM7k4JuSGiJ2C/us/9KaPlMq0pG4Mq3yWJyDobUsrrXJ2X W33121y6HfVO9qavvvx2u3qa8LdWake0N7+6nRnoxlthfo1rrIarE6kznjQJnaCqMeMt 8WulJNHCHavM4Y3pcTl5HhAeQz63BDbbYslJwymh33Igmb5Ug+dOaYYT9mrzkGiGX1Lw Za+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=rTA9Ge9ztWJg6qu4WnRUxoLw0dKUZdpAeQoMLnN27LI=; b=eu18Oom4rdPpVzm+muN7xnInG1z2Sf8U+wYnpbpnmA06DSLybwtm+EzlhAuHX3I+Uc 8pqS8JagsBztw6nf6t+MqOo9GKrK70GDbqCErUJRq7ULinSWJmshNttsg5T/4qiHiBsF VqlrvnuA9nwFGwT0wbt5eLNd2Yn14YB2OoqyeqFp+O4LtpW2P9f9zZr8h6mQpj0TMnza id9vXM6AqqaH91uJvQkpYBZSQM7glzG+MeX4XyF5MvkMDQvLr6TjQKKdg2Yg5hTAd9/Q g9YLfDAyBdyNmdN4g+s4JCUXwiLyFTPQxk4253X8Jnd2AH8SDamQwOnAIRDQzqMXcKgt tgmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=sO8Qr+cK; 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 d7si4828955ejo.175.2021.06.22.00.46.37; Tue, 22 Jun 2021 00:47:00 -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=sO8Qr+cK; 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 S230268AbhFVHrq (ORCPT + 99 others); Tue, 22 Jun 2021 03:47:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36772 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230076AbhFVHrp (ORCPT ); Tue, 22 Jun 2021 03:47:45 -0400 Received: from mail-pj1-x1033.google.com (mail-pj1-x1033.google.com [IPv6:2607:f8b0:4864:20::1033]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B4C8EC061574; Tue, 22 Jun 2021 00:45:28 -0700 (PDT) Received: by mail-pj1-x1033.google.com with SMTP id x21-20020a17090aa395b029016e25313bfcso1755495pjp.2; Tue, 22 Jun 2021 00:45:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=rTA9Ge9ztWJg6qu4WnRUxoLw0dKUZdpAeQoMLnN27LI=; b=sO8Qr+cKOoS9FFMwhHMmBRROUFXOc4mYXbSrj3q4I9aa/7WgaygubUaATqWccoO4Ew Szplz4/pkFp41LIoz//7GarOONmHu/e7bViZcLUdm6AzBVUw5baLNSA5pE5CjJ0ZAMSh X1A5FhBV6WqY/wv1ySo16Rm0rt9ENiTXGyAFElVbZEsRyng3TNRLqmASUDypQSmBB7Uv UNBA4SsU+L9w7HLzTJuOwLoH26y9YfMEqdJGXZOclR4x+nHw+p+sRh5JIA12fUJz68UQ +BVEMymQMH5X6dGY1vZeoxCm90cVBdIgQhHtQOUsmGMpeepu+3g5hrcTOzq+MpptMEEO MrQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=rTA9Ge9ztWJg6qu4WnRUxoLw0dKUZdpAeQoMLnN27LI=; b=MVREKz1Um0UvmMXUbjKjWOl6Yu2GGhUHk10WBJYCt6WhsIQ0IFwESN6d5BHXsX0Ili ejzCS1t2IMFYFSXyGHNjvZFEacUCIKZdOKDFxIf1BTH+zFt/JGZfSZjZ7ra3tqQ4uN/c WGwDMbSS6Cz2McjwHJQRn3c/iSvuUGDIcr6Tyhvz0wWNclm/+wY5pwaXud19i/K1RN+g JyW1OTKLCK+TTBN+U2yEqLsVNP+xwnnbPNY9wRytS6ZEdwoIH+9RPH4fwgYMQdyKeM52 kUiCb/TpfL04c/PRyZNBG5WgBCWrhpWI5LgOfK2eYeGfNNv48wS0QzfPPPRy2BeKWvdJ 43ow== X-Gm-Message-State: AOAM530MhnvnloVSf2UPEpRUWrhv/8lSTUhvQpHfAu3LX2iu8GDmXPxl hBMBW/OsQ5ZhFDAssewoOus= X-Received: by 2002:a17:902:ce86:b029:125:8c21:2ab9 with SMTP id f6-20020a170902ce86b02901258c212ab9mr6136618plg.45.1624347928208; Tue, 22 Jun 2021 00:45:28 -0700 (PDT) Received: from d3 ([2405:6580:97e0:3100:ae94:2ee7:59a:4846]) by smtp.gmail.com with ESMTPSA id f13sm3076941pfe.149.2021.06.22.00.45.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Jun 2021 00:45:27 -0700 (PDT) Date: Tue, 22 Jun 2021 16:45:22 +0900 From: Benjamin Poirier To: Coiby Xu Cc: linux-staging@lists.linux.dev, netdev@vger.kernel.org, Shung-Hsi Yu , Manish Chopra , "supporter:QLOGIC QLGE 10Gb ETHERNET DRIVER" , Greg Kroah-Hartman , open list Subject: Re: [RFC 12/19] staging: qlge: rewrite do while loops as for loops in qlge_start_rx_ring Message-ID: References: <20210621134902.83587-1-coiby.xu@gmail.com> <20210621134902.83587-13-coiby.xu@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210621134902.83587-13-coiby.xu@gmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > --- > 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 >