[PATCH v4 10/12] ARM: OMAP1: board files: deduplicate and clean some NAND-related code

Arnd Bergmann arnd at arndb.de
Wed Apr 11 05:12:00 EDT 2012


On Wednesday 11 April 2012, Paul Walmsley wrote:
> +void omap1_nand_cmd_ctl(struct mtd_info *mtd, int cmd, unsigned int ctrl)
> +{
> +       struct nand_chip *this = mtd->priv;
> +       unsigned long mask;
> +
> +       if (cmd == NAND_CMD_NONE)
> +               return;
> +
> +       mask = (ctrl & NAND_CLE) ? 0x02 : 0;
> +       if (ctrl & NAND_ALE)
> +               mask |= 0x04;
> +
> +       mask |= (unsigned long)this->IO_ADDR_W;
> +
> +       writeb(cmd, (void __iomem *)mask);
> +}

IO_ADDR_W is always a page aligned pointer AFAICT, so you can actually
remove both casts and make it more readable at the same time by writing
the last two lines as

	writeb(cmd, this->IO_ADDR_W + mask);


	Arnd



More information about the linux-arm-kernel mailing list