All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ajay Bhargav <ajay.bhargav@einfochips.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2 1/3] net: Adds Fast Ethernet Controller driver for Armada100
Date: Thu, 25 Aug 2011 17:42:59 +0530 (IST)	[thread overview]
Message-ID: <1244952847.3268.1314274379412.JavaMail.root@ahm.einfochips.com> (raw)
In-Reply-To: <201108251419.41030.marek.vasut@gmail.com>


----- "Marek Vasut" <marek.vasut@gmail.com> wrote:

> On Thursday, August 25, 2011 01:07:32 PM Ajay Bhargav wrote:
> > ----- "Marek Vasut" <marek.vasut@gmail.com> wrote:
> > 
> > [...]
> > 
> > > > +static void abortdma(struct eth_device *dev)
> > > > +{
> > > > +	struct armdfec_device *darmdfec = to_darmdfec(dev);
> > > > +	struct armdfec_reg *regs = darmdfec->regs;
> > > > +	int delay;
> > > > +	int maxretries = 40;
> > > > +
> > > > +	do {
> > > > +		writel(SDMA_CMD_AR | SDMA_CMD_AT, &regs->sdma_cmd);
> > > > +		udelay(100);
> > > > +
> > > > +		delay = 10;
> > > > +		while ((readl(&regs->sdma_cmd) &
> > > > +			(SDMA_CMD_AR | SDMA_CMD_AT))
> > > > +			&& delay-- > 0) {
> > > > +			udelay(10);
> > > > +		}
> > > > +	} while (maxretries-- > 0 && delay <= 0);
> > > 
> > > Didn't I comment on this one in V1?
> > 
> > I modified it as follows... Is it more readable now? :)
> > 
> > while (maxretries--) {
> > 	writel(SDMA_CMD_AR | SDMA_CMD_AT, &regs->sdma_cmd);
> > 	udelay(100);
> > 
> > 	delay = 10;
> > 	while ((readl(&regs->sdma_cmd) & (SDMA_CMD_AR | SDMA_CMD_AT))
> > 			&& delay--)
> > 		udelay(10);
> > 	if(delay)
> > 		break;
> 
>  	delay = 10;
>  	while (--delay) {
> 		tmp = readl(&regs->sdma_cmd);
> 		if (!(tmp & (SDMA_CMD_AR | SDMA_CMD_AT))
> 			break;
>  		udelay(10);
> 	}
>  	if (delay)
>  		break;
> 
> It makes the code horizontally shorter. What do you think? Btw there's
> a rule in 
> U-Boot that multi-line statements must have braces.
> 

Thanks Marek, Yes it looks much better :) see the plus point on working with experts rather
running away? :D

Regards,
Ajay Bhargav

  reply	other threads:[~2011-08-25 12:12 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <583672539.2717.1314270415380.JavaMail.root@ahm.einfochips.com>
2011-08-25 11:07 ` [U-Boot] [PATCH v2 1/3] net: Adds Fast Ethernet Controller driver for Armada100 Ajay Bhargav
2011-08-25 12:19   ` Marek Vasut
2011-08-25 12:12     ` Ajay Bhargav [this message]
     [not found] <1826454834.6634.1314336622428.JavaMail.root@ahm.einfochips.com>
2011-08-26  5:33 ` Ajay Bhargav
     [not found] <569776325.496.1314249408394.JavaMail.root@ahm.einfochips.com>
2011-08-25  5:21 ` Ajay Bhargav
2011-08-25 12:15   ` Marek Vasut
2011-08-24 13:07 Ajay Bhargav
2011-08-24 15:42 ` Mike Frysinger
2011-08-24 16:38   ` Marek Vasut
2011-08-25  5:24     ` Ajay Bhargav
2011-08-25 12:14       ` Marek Vasut
2011-08-25  5:10   ` Ajay Bhargav
2011-08-25 14:13     ` Mike Frysinger
2011-08-24 16:36 ` Marek Vasut

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=1244952847.3268.1314274379412.JavaMail.root@ahm.einfochips.com \
    --to=ajay.bhargav@einfochips.com \
    --cc=u-boot@lists.denx.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.