public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Suraj Upadhyay <usuraj35@gmail.com>
To: Benjamin Poirier <benjamin.poirier@gmail.com>,
	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.
Date: Tue, 14 Jul 2020 12:13:23 +0530	[thread overview]
Message-ID: <20200714064323.GB12651@blackclown> (raw)
In-Reply-To: <20200714054137.GA49448@f3>

[-- Attachment #1: Type: text/plain, Size: 1271 bytes --]

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.
> > 
> > Signed-off-by: Suraj Upadhyay <usuraj35@gmail.com>
> > ---
> [...]
> > @@ -1824,7 +1821,7 @@ static struct sk_buff *ql_build_rx_skb(struct ql_adapter *qdev,
> >  			sbq_desc->p.skb = NULL;
> >  			skb_reserve(skb, NET_IP_ALIGN);
> >  		}
> > -		do {
> > +		for (; length > 0; length -= size, i++) {
> >  			lbq_desc = ql_get_curr_lchunk(qdev, rx_ring);
> >  			size = min(length, qdev->lbq_buf_size);
> >  
> > @@ -1839,7 +1836,7 @@ static struct sk_buff *ql_build_rx_skb(struct ql_adapter *qdev,
> >  			skb->truesize += size;
> >  			length -= size;
> >  			i++;
> > -		} while (length > 0);
> > +		}
> 
> Looks like length and i modification should be removed from here. But in
> this instance, maybe the original was better anyways.
 
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.


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2020-07-14  6:43 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-13 12:14 [PATCH 0/6] staging: qlge: General cleanup and refactor Suraj Upadhyay
2020-07-13 12:15 ` [PATCH 1/6] staging: qlge: qlge.h: Function definition arguments should have names Suraj Upadhyay
2020-07-13 12:15 ` [PATCH 2/6] staging: qlge: qlge.h: Insert line after declaration Suraj Upadhyay
2020-07-13 12:16 ` [PATCH 3/6] staging: qlge: qlge_dbg: Simplify while statements Suraj Upadhyay
2020-07-13 12:20 ` [PATCH 4/6] staging: qlge: qlge_main: " Suraj Upadhyay
2020-07-13 13:38   ` Greg KH
2020-07-13 14:12   ` Dan Carpenter
2020-07-14  6:40     ` Suraj Upadhyay
2020-07-14  8:28       ` Dan Carpenter
2020-07-14  5:41   ` Benjamin Poirier
2020-07-14  6:43     ` Suraj Upadhyay [this message]
2020-07-13 12:21 ` [PATCH 5/6] staging: qlge: qlge_mpi: " Suraj Upadhyay
2020-07-13 12:22 ` [PATCH 6/6] staging: qlge: qlge_ethtool: Remove one byte memset Suraj Upadhyay
2020-07-13 14:17   ` Dan Carpenter
2020-07-14 18:57     ` Joe Perches
2020-07-14 19:06       ` Suraj Upadhyay
2020-07-14 19:22         ` Joe Perches
2020-07-14 19:54           ` Suraj Upadhyay

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200714064323.GB12651@blackclown \
    --to=usuraj35@gmail.com \
    --cc=airlied@linux.ie \
    --cc=benjamin.poirier@gmail.com \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    --cc=tzimmermann@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox