Received: by 2002:a5d:925a:0:0:0:0:0 with SMTP id e26csp619993iol; Thu, 9 Jun 2022 10:12:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyzPh+bgQTxWJ3IK21Wea6+kY2rEK0YMzoZ81gq3tBpzgW6f8Pge1FvYhUWyU92Au/MqJD5 X-Received: by 2002:a17:90b:4d11:b0:1e8:436b:a9cc with SMTP id mw17-20020a17090b4d1100b001e8436ba9ccmr4392650pjb.40.1654794764738; Thu, 09 Jun 2022 10:12:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654794764; cv=none; d=google.com; s=arc-20160816; b=mpxg4bSCIjnqlM6Tcml9blgTg+djmI3+VR7kVVw0h2fSJjh77TZ8S3vWIferae4eZM E9A03uhknx37LVMU9wi8ZlcLflzWTX1AFTfnGV1NkTMJksIpiN0NhiVGdqH7R0pkxKXj hnywike+2lI4tawWKnfNFmO7B46+YioQ4N5LBhATEflo1I0AwEk0gfGhJOU2ghAPZQTt QVprn3y+2c0ie9spPUV4slTLsb5t1nS0kUxYJ+iDIV5LvhI+I6JSXdtMbTBf84JOz36l McXI3NBu5v+f7KWz3WsLm/U1BtEaeHh+auhClDexzsiGLUHepU86BpusIxNlrjlwwjBu C8CQ== 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=jnwjuzj3MrO/cwr2OIkDIAaSQBe3BajVFxJznUYian0=; b=ngKIrIIxzvwERXZSsR23hN0IB8FJVu509/OI2iEr2b9Ps1yPJyJb2RrRS5NNRKzoso 3lgq/k+q4cqdnfFRDp+odgctYrrC5DewkLIk+5miKeXUYhmTuHdGe7IhGRE/7pKw1X9n dv2V92fa/zxFzM0yQVbwWHw7VEhMb1LdheJgnyY+5MhX9/w7hyL5wH0dVxTE1R7U3mmW qGfSMbtNpfe3bSI9peNdWc4HnZfdBrWI5+1es9nW139yp9flaPb6pqN03I8RfPq61zye Vbw3n4MEk6TueUQDR/PO3S6540rfXpGmfQypNFRmhtd5mJSl9CE1D3t/p4fnIg4c5ows TpLg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=KXqRhtXy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e17-20020a637451000000b003c637ec7ce2si29996413pgn.840.2022.06.09.10.12.30; Thu, 09 Jun 2022 10:12:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=KXqRhtXy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S244679AbiFIRBf (ORCPT + 99 others); Thu, 9 Jun 2022 13:01:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41560 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230107AbiFIRBc (ORCPT ); Thu, 9 Jun 2022 13:01:32 -0400 Received: from mail-qt1-x82f.google.com (mail-qt1-x82f.google.com [IPv6:2607:f8b0:4864:20::82f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4D1C9B490; Thu, 9 Jun 2022 10:01:31 -0700 (PDT) Received: by mail-qt1-x82f.google.com with SMTP id c8so17609633qtj.1; Thu, 09 Jun 2022 10:01:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=jnwjuzj3MrO/cwr2OIkDIAaSQBe3BajVFxJznUYian0=; b=KXqRhtXyWnfMMh67/l7UqFNSak6iRPazY7CXKZ8kXMQ28xL6ZgU/jokUz5eYFK4Fmf RSP4C1zwYfySDnFihTA+aG73lcyhQC2oUpja4Q0z5PZNdMPTSBVEYPXBzvrR3kLqDuUg ER3zClQ+6tt0BFGJmHXW9WWL6C/D68LHpXXhtEzC4d0A960OviV85LsphNuoMihi4fFT YicoSQdctm46hGSz4YgrEhYfyp1IhVjilwY7hZWzC9CLWNXUqD5eVMJb2GoUnLVzr3b2 DRSDlDXTuIhIt3SoJuqetEdNDvg+rkRNVFpE574dSoUVTyyg9zOKm2gnPxvyT2p3csIP iHXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=jnwjuzj3MrO/cwr2OIkDIAaSQBe3BajVFxJznUYian0=; b=BMNFADqC2KJFEuzd7enq9kZLdIXCqPiqc2NMIsk7DOe5moLPgPsNkvAhcOYt4D1iiD 8qKSotbixVh1q62x1llRKLY4sP3/UllogRQ/R/7G0qMhf2MdX3o7lIQf+YXs0wfGDwAb uetnjp6pMMHdB+1N4Dhr1LnghzzfQmVhXqTtJOBzZ30EeFgxPOXvYdmbnkkai+zXFAwK 3khxGcl5G2eP7HntsigCNyseqmforT0TptiTkhXE72+Wr8GTn37CZw/saj7Mxx1poAti aLcurJpAevC2JMrbMuwmeM0WNv7h89Q5Qc960e8vDQJ3a11qKfPrPNdfPD4NxTsCzQja mGbA== X-Gm-Message-State: AOAM533T4ObLrQErw3264v5boVJdrk+Lf8m/2xfThzK1ay2uxLWTG1DS /p7NFE9SUbFTN+bSyfPrAYz6XLwRrYSCKmD3 X-Received: by 2002:ac8:5a11:0:b0:304:bab8:66f3 with SMTP id n17-20020ac85a11000000b00304bab866f3mr32399696qta.388.1654794089992; Thu, 09 Jun 2022 10:01:29 -0700 (PDT) Received: from Sassy (bras-base-oshwon9563w-grc-26-142-113-132-114.dsl.bell.ca. [142.113.132.114]) by smtp.gmail.com with ESMTPSA id w17-20020a05620a445100b006a7137330e2sm4046161qkp.132.2022.06.09.10.01.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Jun 2022 10:01:29 -0700 (PDT) Date: Thu, 9 Jun 2022 13:01:27 -0400 From: Srivathsan Sivakumar To: Dan Carpenter Cc: Manish Chopra , GR-Linux-NIC-Dev@marvell.com, Coiby Xu , Greg Kroah-Hartman , netdev@vger.kernel.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH] staging: qlge: qlge_main.c: convert do-while loops to for loops Message-ID: References: <20220609152653.GZ2146@kadam> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220609152653.GZ2146@kadam> X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jun 09, 2022 at 06:26:53PM +0300, Dan Carpenter wrote: > On Thu, Jun 09, 2022 at 11:15:51AM -0400, Srivathsan Sivakumar wrote: > > diff --git a/drivers/staging/qlge/qlge_main.c b/drivers/staging/qlge/qlge_main.c > > index 8c35d4c4b851..308e8b621185 100644 > > --- a/drivers/staging/qlge/qlge_main.c > > +++ b/drivers/staging/qlge/qlge_main.c > > @@ -3006,13 +3006,13 @@ static int qlge_start_rx_ring(struct qlge_adapter *qdev, struct rx_ring *rx_ring > > cqicb->flags |= FLAGS_LL; /* Load lbq values */ > > tmp = (u64)rx_ring->lbq.base_dma; > > base_indirect_ptr = rx_ring->lbq.base_indirect; > > - page_entries = 0; > > - do { > > - *base_indirect_ptr = cpu_to_le64(tmp); > > - tmp += DB_PAGE_SIZE; > > - base_indirect_ptr++; > > - page_entries++; > > - } while (page_entries < MAX_DB_PAGES_PER_BQ(QLGE_BQ_LEN)); > > + > > + for (page_entries = 0; page_entries < > > + MAX_DB_PAGES_PER_BQ(QLGE_BQ_LEN); page_entries++) { > > + *base_indirect_ptr = cpu_to_le64(tmp); > > + tmp += DB_PAGE_SIZE; > > + base_indirect_ptr++; > > + } > > It's better than the original, but wouldn't it be better yet to write > something like this (untested): > > for (i = 0; i < MAX_DB_PAGES_PER_BQ(QLGE_BQ_LEN); i++) > base_indirect_ptr[i] = cpu_to_le64(tmp + (i * DB_PAGE_SIZE)); > > Same with the other as well, obviously. > > regards, > dan carpenter > Hello Dan, Thanks for your input wouldn't base_indirect_ptr point at a different endian value if tmp is added with (i * DB_PAGE_SIZE)? Thanks, Srivathsan