Re: [PATCH v3 3/4] OMAP: McBSP: Introduce caching in register write operations

Jarkko Nikula
2009-12-03T07:48:10Z

On Tue, 1 Dec 2009 04:15:50 +0100
Janusz Krzysztofik <jkrzyszt@tis.icnet.pl> wrote:

> #define MCBSP_WRITE(mcbsp, reg, val) \
> - omap_mcbsp_write(mcbsp->io_base, OMAP_MCBSP_REG_##reg, val)
> + omap_mcbsp_write(mcbsp->io_base, OMAP_MCBSP_REG_##reg, \
> + mcbsp->reg_cache[OMAP_MCBSP_REG_##reg / OMAP_MCBSP_REG_DRR1] \
> + = val)
> +#define MCBSP_READ_CACHE(mcbsp, reg) \
> + (mcbsp->reg_cache[OMAP_MCBSP_REG_##reg / OMAP_MCBSP_REG_DRR1])
>
These divisions by DDR1 are confusing. Use rather sizeof:

reg_cache[OMAP_MCBSP_REG_##reg / sizeof(*mcbsp->reg_cache)]

--
Jarkko