diff mbox

[05/24] ARM64:UAPI: Set the correct __BITS_PER_LONG for ILP32.

Message ID 1400914939-9708-6-git-send-email-apinski@cavium.com
State New
Headers show

Commit Message

Andrew Pinski May 24, 2014, 7:02 a.m. UTC
We need to say to the userland API that bits per long is 32bits for ILP32.

Thanks,
Andrew Pinski

Signed-off-by: Andrew Pinski <apinski@cavium.com>
---
 arch/arm64/include/uapi/asm/bitsperlong.h |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

Comments

Catalin Marinas June 17, 2014, 3:22 p.m. UTC | #1
On Sat, May 24, 2014 at 12:02:00AM -0700, Andrew Pinski wrote:
> diff --git a/arch/arm64/include/uapi/asm/bitsperlong.h b/arch/arm64/include/uapi/asm/bitsperlong.h
> index fce9c29..5e06c59 100644
> --- a/arch/arm64/include/uapi/asm/bitsperlong.h
> +++ b/arch/arm64/include/uapi/asm/bitsperlong.h
> @@ -16,7 +16,12 @@
>  #ifndef __ASM_BITSPERLONG_H
>  #define __ASM_BITSPERLONG_H
>  
> -#define __BITS_PER_LONG 64
> +/* Assuming __LP64__ will be defined for native ELF64's and not for ILP32. */
> +#ifdef __LP64__
> +# define __BITS_PER_LONG 64
> +#else
> +# define __BITS_PER_LONG 32
> +#endif

I think it's enough to just define it for the __LP64__ case.

>  #include <asm-generic/bitsperlong.h>

The asm-generic definition if 32 by default.
Arnd Bergmann June 17, 2014, 3:29 p.m. UTC | #2
On Tuesday 17 June 2014 16:22:50 Catalin Marinas wrote:
> On Sat, May 24, 2014 at 12:02:00AM -0700, Andrew Pinski wrote:
> > diff --git a/arch/arm64/include/uapi/asm/bitsperlong.h b/arch/arm64/include/uapi/asm/bitsperlong.h
> > index fce9c29..5e06c59 100644
> > --- a/arch/arm64/include/uapi/asm/bitsperlong.h
> > +++ b/arch/arm64/include/uapi/asm/bitsperlong.h
> > @@ -16,7 +16,12 @@
> >  #ifndef __ASM_BITSPERLONG_H
> >  #define __ASM_BITSPERLONG_H
> >  
> > -#define __BITS_PER_LONG 64
> > +/* Assuming __LP64__ will be defined for native ELF64's and not for ILP32. */
> > +#ifdef __LP64__
> > +# define __BITS_PER_LONG 64
> > +#else
> > +# define __BITS_PER_LONG 32
> > +#endif
> 
> I think it's enough to just define it for the __LP64__ case.
> 
> >  #include <asm-generic/bitsperlong.h>
> 
> The asm-generic definition if 32 by default.

Andrew's version does seem more readable though, and is obviously correct.

	Arnd
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/
diff mbox

Patch

diff --git a/arch/arm64/include/uapi/asm/bitsperlong.h b/arch/arm64/include/uapi/asm/bitsperlong.h
index fce9c29..5e06c59 100644
--- a/arch/arm64/include/uapi/asm/bitsperlong.h
+++ b/arch/arm64/include/uapi/asm/bitsperlong.h
@@ -16,7 +16,12 @@ 
 #ifndef __ASM_BITSPERLONG_H
 #define __ASM_BITSPERLONG_H
 
-#define __BITS_PER_LONG 64
+/* Assuming __LP64__ will be defined for native ELF64's and not for ILP32. */
+#ifdef __LP64__
+# define __BITS_PER_LONG 64
+#else
+# define __BITS_PER_LONG 32
+#endif
 
 #include <asm-generic/bitsperlong.h>