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

Andrew Lunn andrew at lunn.ch
Sat Dec 8 06:53:06 EST 2012


Hi Thomas

> + * 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.

     Andrew



More information about the linux-arm-kernel mailing list