[PATCH 2/9] arm64: Fix INVALID_HWID definition

Catalin Marinas catalin.marinas at arm.com
Wed Aug 27 01:21:39 PDT 2014


On Tue, Aug 26, 2014 at 07:18:00PM +0100, Geoff Levand wrote:
> On Tue, 2014-08-26 at 16:57 +0100, Catalin Marinas wrote:
> > On Fri, Aug 22, 2014 at 08:49:16PM +0100, Geoff Levand wrote:
> > > Change the preprocessor macro INVALID_HWID definition from ULONG_MAX to (~0)
> > > to allow INVALID_HWID to be used within assembly source files.
> > > 
> > > --- a/arch/arm64/include/asm/cputype.h
> > > +++ b/arch/arm64/include/asm/cputype.h
> > > @@ -16,7 +16,7 @@
> > >  #ifndef __ASM_CPUTYPE_H
> > >  #define __ASM_CPUTYPE_H
> > >  
> > > -#define INVALID_HWID		ULONG_MAX
> > > +#define INVALID_HWID		UL(~0)
> > 
> > Does it actually expand to ULONG_MAX? ~0 is an int.
> 
> It seems to be OK, in C:
> 
> volatile unsigned long secondary_holding_pen_release = INVALID_HWID;
> 
> Disassembly of section .data:
> 
> 0000000000000000 <secondary_holding_pen_release>:
>    0:   ffffffff        .word   0xffffffff
>    4:   ffffffff        .word   0xffffffff

OK, it looks like it's sign-extending from int to unsigned long (an
alternative would have been to write (~UL(0)) but the above should do as
well).

Anyway, the patch should come with the series that makes use of such
change.

-- 
Catalin



More information about the linux-arm-kernel mailing list