[RFC v1 05/16] arm: plat-orion: introduce orion_{alloc,free}_cpu_win() functions

Thomas Petazzoni thomas.petazzoni at free-electrons.com
Sat Dec 8 07:15:50 EST 2012


Dear Andrew Lunn,

On Sat, 8 Dec 2012 12:53:06 +0100, Andrew Lunn wrote:

> > + * Free an address decoding window, given its base address.
> > + */
> > +int __init orion_free_cpu_win(const struct orion_addr_map_cfg *cfg,
> > +			      const u32 base)
> > +{
> > +	int win;
> > +
> > +	for (win = 0; win < cfg->num_wins; win++) {
> > +		void __iomem *addr = cfg->win_cfg_base(cfg, win);
> > +		u32 winbase = readl(addr + WIN_BASE_OFF);
> > +		u32 ctrl = readl(addr + WIN_CTRL_OFF);
> > +
> > +		if (!(ctrl & WIN_CTRL_ENABLE))
> > +			continue;
> > +
> > +		if (winbase == (base & 0xffff0000)) {
> > +			orion_disable_cpu_win(cfg, win);
> > +			return 0;
> > +		}
> > +	}
> > +
> > +	return -EINVAL;
> > +}
> 
> Not a big issue, but i would of put the test for WIN_CTRL_ENABLE
> inside the matched winbase if statement, also differing the readl for
> ctrl to only when its needed.

Ok, good idea, will do.

Thanks,

Thomas
-- 
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com



More information about the linux-arm-kernel mailing list