Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp1533087ybh; Mon, 13 Jul 2020 23:44:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx70FTMbLmSLwdvc/PiQ0ai9zQxwQzfZzW7++HICjJHN5KLyaKE7v4pARzVvcW/1G03slYQ X-Received: by 2002:a17:906:f202:: with SMTP id gt2mr3194125ejb.70.1594709055928; Mon, 13 Jul 2020 23:44:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594709055; cv=none; d=google.com; s=arc-20160816; b=LsgRphsAoowY7UyhA5lL/ewZ6ujboLSxXy8OGNsX66Pp9jrkqivIh5IETr1wzetVcc OqtSoRo3CbDCil9aGv6cnW8sRXQe3C06L81JHOWMfnwRkp6Lmd2CLRRqrgtvJpARrN+e ZM7QA394DYM+YzQTqli1wogiBx543jl942gKZhEs3Du5Lk9YgRLuLSxTLIq95Z9X5TD0 +awQuse8QLEw6ALkWFZcL/bHoJWjANbyoVxGa7LmdPHpmFxHZfSBg8PV9TOToMIhSyG3 lxdyZYb0o0L33gFjGJCooHzFdNwNIAL1BJ9mHwbk00GzAuhFWMbLG6XMqTidRu0XE8WZ ND+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=svRq6Iqlrn/tFxtJY/DjGrWoqYIhD74lfdweZy6zFV8=; b=dGBDbVm1AgniUhBkam6TfVG8H6Rcz8l7DjgSy8AvQWaR4guvqJOyfFwm6mQ8H633Wc NV0XAMyt+K3BkWKx4XWM0mZJSqiPlLNIVDazEPFpcieejVSVwc4G6KhQVFBOL5PWcsqw b0WQhYlqUXr2WsPiXLd58oPggZe7uesZq6Tupan5spDx1su7suCV3pnpHc93A09rkq5m coOouypISAGCmrnvTI0NyV04r6jGd3Ylfi9r8yQVXpxKvoc0DVqH/M4Sl3MaVlbHhKyd ipvFih6vBLf3TguHhPZXe4hY3WEhaHDg0YIGWVj5mS8j4Wn+ug1v/TtnVM9fFcLJVnUj WQsw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=kc+Jcvl3; 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 s6si10258187ejo.502.2020.07.13.23.43.53; Mon, 13 Jul 2020 23:44:15 -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=kc+Jcvl3; 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 S1726370AbgGNGna (ORCPT + 99 others); Tue, 14 Jul 2020 02:43:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38378 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725905AbgGNGna (ORCPT ); Tue, 14 Jul 2020 02:43:30 -0400 Received: from mail-pj1-x1043.google.com (mail-pj1-x1043.google.com [IPv6:2607:f8b0:4864:20::1043]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E77C8C061755 for ; Mon, 13 Jul 2020 23:43:29 -0700 (PDT) Received: by mail-pj1-x1043.google.com with SMTP id cm21so1111609pjb.3 for ; Mon, 13 Jul 2020 23:43:29 -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:user-agent; bh=svRq6Iqlrn/tFxtJY/DjGrWoqYIhD74lfdweZy6zFV8=; b=kc+Jcvl3OJXsMwC2pJGthFzMlIi4Z+p/EjQlp1fucAxYfP/P3JQyb1wmM+O36g8AbR Cn9GHBVqR0fXbfImOHjRSkvkMg6lR+FkkoKIYgfN2NzfvT9vwC8I+W2axg2Egl6gQ4DZ JgMQ0SpcaRot1GtHzP2/Ol/kuLQ/j71vDFBuMYg0l6riowcSLJW1dD/C3E55mU0/um/b KLulucPiDyoNTLMHEnssmvnmaT+/FGZ+mVq7Aan7R6gmFR8Z0qzXLYzoojREIumZ63Da 5UYIP0pq5NOBzNYroTLSlsYL6BTO5hd/LhoCFeoWW/DMu/nV8iLT9Ya5+UaWjiGjbup9 OrxA== 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:user-agent; bh=svRq6Iqlrn/tFxtJY/DjGrWoqYIhD74lfdweZy6zFV8=; b=EVz7vOvTu/vHwPuiSRCCCOGwvyXFNJoaXRip8S4KqgJO6VLwGdqYb/UlmQ77JDFJeR 7mvVgPoU6aWsscCAxSJIrCnU6RORw3aq+GGLlhpqt0NNTvb0uJ/2t7nYAafjxpc8IFEs zLL/vpCSsgP1OOJ22l5uEKjy7K5zg3tAeum6JbqrRrNwjFjXdVbG67skXJxC+bQCJhba CZuAo5TlVX7rplX+4aiVyWVowLzLgIsTsiuL+t7XUkXU/FD386WVPNm83DR8EfC3B8zV 6VuaBRadAJyERD25I58YZ1tH3b9vkkvh8Xum080qtecHp6F3usvsm7pFEzq6/K3hIKvK 5meA== X-Gm-Message-State: AOAM5309oZx1C8voL3aaAM+DlvtbQRuQcZ4TSPLyzuzeDEwO/mEChoM3 dWkkjOa1ACQNxdOKAAVRbAE= X-Received: by 2002:a17:90b:1b4e:: with SMTP id nv14mr3203899pjb.30.1594709009369; Mon, 13 Jul 2020 23:43:29 -0700 (PDT) Received: from blackclown ([103.88.82.220]) by smtp.gmail.com with ESMTPSA id q20sm16593653pfn.111.2020.07.13.23.43.26 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 13 Jul 2020 23:43:28 -0700 (PDT) Date: Tue, 14 Jul 2020 12:13:23 +0530 From: Suraj Upadhyay To: Benjamin Poirier , maarten.lankhorst@linux.intel.com, mripard@kernel.org, tzimmermann@suse.de, airlied@linux.ie, daniel@ffwll.ch Cc: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org Subject: Re: [PATCH 4/6] staging: qlge: qlge_main: Simplify while statements. Message-ID: <20200714064323.GB12651@blackclown> References: <1bb472c5595d832221fd142dddb68907feeeecbe.1594642213.git.usuraj35@gmail.com> <20200714054137.GA49448@f3> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="PmA2V3Z32TCmWXqI" Content-Disposition: inline In-Reply-To: <20200714054137.GA49448@f3> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --PmA2V3Z32TCmWXqI Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Jul 14, 2020 at 02:41:37PM +0900, Benjamin Poirier wrote: > On 2020-07-13 17:50 +0530, Suraj Upadhyay wrote: > > Simplify while loops into more readable and simple for loops. > >=20 > > Signed-off-by: Suraj Upadhyay > > --- > [...] > > @@ -1824,7 +1821,7 @@ static struct sk_buff *ql_build_rx_skb(struct ql_= adapter *qdev, > > sbq_desc->p.skb =3D NULL; > > skb_reserve(skb, NET_IP_ALIGN); > > } > > - do { > > + for (; length > 0; length -=3D size, i++) { > > lbq_desc =3D ql_get_curr_lchunk(qdev, rx_ring); > > size =3D min(length, qdev->lbq_buf_size); > > =20 > > @@ -1839,7 +1836,7 @@ static struct sk_buff *ql_build_rx_skb(struct ql_= adapter *qdev, > > skb->truesize +=3D size; > > length -=3D size; > > i++; > > - } while (length > 0); > > + } >=20 > Looks like length and i modification should be removed from here. But in > this instance, maybe the original was better anyways. =20 Thanks for pointing that out. It nearly slipped. > Agreed with Dan. At least some of those loops can be converted to "count > up" loops for a more familiar appearance. I mostly tried to convert the do-while loops, which I think are't that obvious than while and for loops. Thanks, Suraj Upadhyay. --PmA2V3Z32TCmWXqI Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEE7AbCa0kOsMJ4cx0j+gRsbIfe744FAl8NVAoACgkQ+gRsbIfe 747gZhAAqmjqDCHmzSP1HenEF63cKPYyve1oHdtZQYylYRaN2L9DFakZyAKZOAzG BuQss5guy5Na3tvPENwNQa/WUcBNkBsmoYdbdiaMfdCIIiCCaS738NCe3zX+iJDn XYjNutWTL1bPWgGUpODUfMbEB64FwZQO+fF2tXIF2EE+XbFHu9UXg4yvAmVOAuZ4 9TO+NYxOJZ4er23xW2QHw9Q2KN9L72h13BLRObkMqw/c0cVI1Q/Rs54/RpqnYC/H UYRgNOu5Y+H5B//QoWYdzRPJRyp0z/ITjWwSqcJ20nbN3oBP20QK4iyAjrl2PMaD ht6z5JjIAsS1hgLaMIKxEtnR23SzHrzWQyH6l6wbMIKLoWTxByZ4eZfivTtZCIqW 1fDv8jzsVfTY+RF18LaLcAAllncRYTwiEMA0wfdYQnDO7UcpoikOfTIyrZuizoDu AHX5UEza5v4T9yJKa1GnpAQlrXtN3Vle+/otwU3jAchin7OaAPa/J0AbWxRqjBZY 35jZ3nYFEj/uT3EDgOCHtHKuiAKbIDgTGHdMs/fmaeaQ9b7QcayRs7p97a3m/68f PTFfDce+NHxdpVS++epyhdCUdYY+RluazeTZTwOHHcMj5EgUkYcB9KXl/QBJLvR4 gcwAKr1h+FAzBq23aC+psURXYpznTvTG2u/vuTwjpuQrB8nPBS4= =St0d -----END PGP SIGNATURE----- --PmA2V3Z32TCmWXqI--