[PATCH V4 06/62] ST SPEAr13XX: Adding machine specific header files

viresh kumar viresh.kumar at st.com
Tue Jan 18 23:38:21 EST 2011


On 01/18/2011 09:30 PM, Russell King - ARM Linux wrote:
> On Tue, Jan 18, 2011 at 12:41:34PM +0530, Viresh Kumar wrote:
>> +#define MISC_BASE		VA_SPEAR13XX_MISC_BASE
>> +
>> +/* General Configuration */
>> +#define SOC_CFG			((unsigned int *)(MISC_BASE + 0x000))
>> +#define BOOTSTRAP_CFG		((unsigned int *)(MISC_BASE + 0x004))
> 
> You could really do with an IOMEM() macro, thus:
> 
> #ifndef __ASSEMBLY__
> #define IOMEM(x)	((void __iomem __force *)(x))
> #else
> #define IOMEM(x)	(x)
> #endif
> 
> You can then use that for stuff like VA_SPEAR13XX_MISC_BASE, and all
> these definitions then become:
> 
> #define SOC_CFG			(MISC_BASE + 0x000)
> 
> because GCC allows void pointer arithmetic (treats it as char).
> 

Yes. I agree with this solution.
Actually the VA* macros are like:
#define VA_SPEAR13XX_MISC_BASE		IO_ADDRESS(SPEAR13XX_MISC_BASE)

Adding IOMEM() over IO_ADDRESS(SPEAR13XX_MISC_BASE) will make it too long.
And might cross 80 columns. Can we modify IO_ADDRESS() to use IOMEM()?

-- 
viresh



More information about the linux-arm-kernel mailing list