[PATCH 3/6] Change type of VMALLOC_END to unsigned long.

Russell King - ARM Linux linux at arm.linux.org.uk
Sun Oct 4 08:21:12 EDT 2009


On Thu, Oct 01, 2009 at 12:48:58PM +0200, Andreas Fenkart wrote:
> diff --git a/arch/arm/include/asm/memory.h b/arch/arm/include/asm/memory.h
> index 38b6a78..0cc3c4b 100644
> --- a/arch/arm/include/asm/memory.h
> +++ b/arch/arm/include/asm/memory.h
> @@ -104,11 +104,11 @@
>  #endif
>  
>  #ifndef PHYS_OFFSET
> -#define PHYS_OFFSET 		(CONFIG_DRAM_BASE)
> +#define PHYS_OFFSET 		UL(CONFIG_DRAM_BASE)
>  #endif
>  
>  #ifndef END_MEM
> -#define END_MEM     		(CONFIG_DRAM_BASE + CONFIG_DRAM_SIZE)
> +#define END_MEM     		UL(CONFIG_DRAM_BASE + CONFIG_DRAM_SIZE)

This is still not correct usage of UL().  This becomes:

	CONFIG_DRAM_BASE + CONFIG_DRAM_SIZE##UL

or, in the case of these being defined as zero:

	0 + 0UL

That might end up ultimately being an unsigned long expression, but it
would be far better to explicitly cast the right thing - the base.

Basically, UL() should not be used with an expression argument.  UL()'s
purpose is to allow the numerical value enclosed to be used in both C
as an unsigned long constant, and also in assembly without the UL suffix
(which would cause the assembler to error out.)  It's not there as a
generic "cast to unsigned long" operator.

> diff --git a/arch/arm/mach-davinci/include/mach/hardware.h b/arch/arm/mach-davinci/include/mach/hardware.h
> index 41c8938..5fd3784 100644
> --- a/arch/arm/mach-davinci/include/mach/hardware.h
> +++ b/arch/arm/mach-davinci/include/mach/hardware.h
> @@ -30,7 +30,7 @@
>  #define IO_PHYS				0x01c00000
>  #define IO_OFFSET			0xfd000000 /* Virtual IO = 0xfec00000 */
>  #define IO_SIZE				0x00400000
> -#define IO_VIRT				(IO_PHYS + IO_OFFSET)
> +#define IO_VIRT				UL(IO_PHYS + IO_OFFSET)

Same thing.



More information about the linux-arm-kernel mailing list