[U-Boot] [PATCH v2 1/3] net: Adds Fast Ethernet Controller driver for Armada100

Ajay Bhargav ajay.bhargav at einfochips.com
Thu Aug 25 13:07:32 CEST 2011


----- "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, &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;
}

Regards,
Ajay Bhargav


More information about the U-Boot mailing list