Skip to content

Commit c31ae4b

Browse files
arndbArnd Bergmann
authored andcommitted
asm-generic: introduce asm/bitsperlong.h
This provides a reliable way for asm-generic/types.h and other files to find out if it is running on a 32 or 64 bit platform. We cannot use CONFIG_64BIT for this in headers that are included from user space because CONFIG symbols are not available there. We also cannot do it inside of asm/types.h because some headers need the word size but cannot include types.h. The solution is to introduce a new header <asm/bitsperlong.h> that defines both __BITS_PER_LONG for user space and BITS_PER_LONG for usage in the kernel. The asm-generic version falls back to 32 bit unless the architecture overrides it, which I did for all 64 bit platforms. Signed-off-by: Remis Lima Baima <remis.developer@googlemail.com> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
1 parent 63b852a commit c31ae4b

33 files changed

Lines changed: 145 additions & 46 deletions

File tree

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#ifndef __ASM_ALPHA_BITSPERLONG_H
2+
#define __ASM_ALPHA_BITSPERLONG_H
3+
4+
#define __BITS_PER_LONG 64
5+
6+
#include <asm-generic/bitsperlong.h>
7+
8+
#endif /* __ASM_ALPHA_BITSPERLONG_H */

‎arch/alpha/include/asm/types.h‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,6 @@ typedef unsigned int umode_t;
2525
* These aren't exported outside the kernel to avoid name space clashes
2626
*/
2727
#ifdef __KERNEL__
28-
29-
#define BITS_PER_LONG 64
30-
3128
#ifndef __ASSEMBLY__
3229

3330
typedef u64 dma_addr_t;

‎arch/arm/include/asm/bitsperlong.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#include <asm-generic/bitsperlong.h>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#include <asm-generic/bitsperlong.h>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#include <asm-generic/bitsperlong.h>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#include <asm-generic/bitsperlong.h>

‎arch/frv/include/asm/bitsperlong.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#include <asm-generic/bitsperlong.h>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#include <asm-generic/bitsperlong.h>
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#ifndef __ASM_IA64_BITSPERLONG_H
2+
#define __ASM_IA64_BITSPERLONG_H
3+
4+
#define __BITS_PER_LONG 64
5+
6+
#include <asm-generic/bitsperlong.h>
7+
8+
#endif /* __ASM_IA64_BITSPERLONG_H */

‎arch/ia64/include/asm/types.h‎

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,6 @@
1919
# define __IA64_UL(x) (x)
2020
# define __IA64_UL_CONST(x) x
2121

22-
# ifdef __KERNEL__
23-
# define BITS_PER_LONG 64
24-
# endif
25-
2622
#else
2723
# define __IA64_UL(x) ((unsigned long)(x))
2824
# define __IA64_UL_CONST(x) x##UL
@@ -34,10 +30,7 @@ typedef unsigned int umode_t;
3430
*/
3531
# ifdef __KERNEL__
3632

37-
#define BITS_PER_LONG 64
38-
3933
/* DMA addresses are 64-bits wide, in general. */
40-
4134
typedef u64 dma_addr_t;
4235

4336
# endif /* __KERNEL__ */

0 commit comments

Comments
 (0)