[U-Boot] [PATCH v2 1/3] net: Adds Fast Ethernet Controller driver for Armada100
Ajay Bhargav
ajay.bhargav at einfochips.com
Thu Aug 25 14:12:59 CEST 2011
----- "Marek Vasut" <marek.vasut at gmail.com> wrote:
> On Thursday, August 25, 2011 01:07:32 PM Ajay Bhargav wrote:
> > ----- "Marek Vasut" <marek.vasut at 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, ®s->sdma_cmd);
> > > > + udelay(100);
> > > > +
> > > > + delay = 10;
> > > > + while ((readl(®s->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, ®s->sdma_cmd);
> > udelay(100);
> >
> > delay = 10;
> > while ((readl(®s->sdma_cmd) & (SDMA_CMD_AR | SDMA_CMD_AT))
> > && delay--)
> > udelay(10);
> > if(delay)
> > break;
>
> delay = 10;
> while (--delay) {
> tmp = readl(®s->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
More information about the U-Boot
mailing list