Commit 3747bdbb2bb83a3bb2e7bd823856de4f4908f711

Authored by Masahiro Yamada
Committed by Tom Rini
1 parent 9865543ae6

arch: types.h: factor out fixed width typedefs to int-ll64.h

All architectures have the same definition for s8/16/32/64
and u8/16/32/64.

Factor out the duplicated code into <asm-generic/int-ll64.h>.

BTW, Linux unified the kernel space definition into int-ll64.h
a few years ago as you see in Linux commit 0c79a8e29b5f
("asm/types.h: Remove include/asm-generic/int-l64.h").

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

Showing 14 changed files with 80 additions and 373 deletions Side-by-side Diff

arch/arc/include/asm/types.h
... ... @@ -6,41 +6,9 @@
6 6 #ifndef __ASM_ARC_TYPES_H
7 7 #define __ASM_ARC_TYPES_H
8 8  
9   -typedef unsigned short umode_t;
  9 +#include <asm-generic/int-ll64.h>
10 10  
11   -/*
12   - * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the
13   - * header files exported to user space
14   - */
15   -
16   -typedef __signed__ char __s8;
17   -typedef unsigned char __u8;
18   -
19   -typedef __signed__ short __s16;
20   -typedef unsigned short __u16;
21   -
22   -typedef __signed__ int __s32;
23   -typedef unsigned int __u32;
24   -
25   -#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
26   -typedef __signed__ long long __s64;
27   -typedef unsigned long long __u64;
28   -#endif
29   -
30   -/*
31   - * These aren't exported outside the kernel to avoid name space clashes
32   - */
33   -typedef signed char s8;
34   -typedef unsigned char u8;
35   -
36   -typedef signed short s16;
37   -typedef unsigned short u16;
38   -
39   -typedef signed int s32;
40   -typedef unsigned int u32;
41   -
42   -typedef signed long long s64;
43   -typedef unsigned long long u64;
  11 +typedef unsigned short umode_t;
44 12  
45 13 #define BITS_PER_LONG 32
46 14  
arch/arm/include/asm/types.h
1 1 #ifndef __ASM_ARM_TYPES_H
2 2 #define __ASM_ARM_TYPES_H
3 3  
  4 +#include <asm-generic/int-ll64.h>
  5 +
4 6 typedef unsigned short umode_t;
5 7  
6 8 /*
7   - * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the
8   - * header files exported to user space
9   - */
10   -
11   -typedef __signed__ char __s8;
12   -typedef unsigned char __u8;
13   -
14   -typedef __signed__ short __s16;
15   -typedef unsigned short __u16;
16   -
17   -typedef __signed__ int __s32;
18   -typedef unsigned int __u32;
19   -
20   -#if defined(__GNUC__)
21   -__extension__ typedef __signed__ long long __s64;
22   -__extension__ typedef unsigned long long __u64;
23   -#endif
24   -
25   -/*
26 9 * These aren't exported outside the kernel to avoid name space clashes
27 10 */
28 11 #ifdef __KERNEL__
29   -
30   -typedef signed char s8;
31   -typedef unsigned char u8;
32   -
33   -typedef signed short s16;
34   -typedef unsigned short u16;
35   -
36   -typedef signed int s32;
37   -typedef unsigned int u32;
38   -
39   -typedef signed long long s64;
40   -typedef unsigned long long u64;
41 12  
42 13 #ifdef CONFIG_ARM64
43 14 #define BITS_PER_LONG 64
arch/m68k/include/asm/types.h
1 1 #ifndef _M68K_TYPES_H
2 2 #define _M68K_TYPES_H
3 3  
  4 +#include <asm-generic/int-ll64.h>
  5 +
4 6 #ifndef __ASSEMBLY__
5 7  
6 8 typedef unsigned short umode_t;
7 9  
8   -typedef __signed__ char __s8;
9   -typedef unsigned char __u8;
10   -
11   -typedef __signed__ short __s16;
12   -typedef unsigned short __u16;
13   -
14   -typedef __signed__ int __s32;
15   -typedef unsigned int __u32;
16   -
17   -#if defined(__GNUC__)
18   -__extension__ typedef __signed__ long long __s64;
19   -__extension__ typedef unsigned long long __u64;
20   -#endif
21   -
22 10 typedef struct {
23 11 __u32 u[4];
24 12 } __attribute__((aligned(16))) vector128;
25 13  
26 14 #ifdef __KERNEL__
27   -/*
28   - * These aren't exported outside the kernel to avoid name space clashes
29   - */
30   -typedef signed char s8;
31   -typedef unsigned char u8;
32   -
33   -typedef signed short s16;
34   -typedef unsigned short u16;
35   -
36   -typedef signed int s32;
37   -typedef unsigned int u32;
38   -
39   -typedef signed long long s64;
40   -typedef unsigned long long u64;
41 15  
42 16 #define BITS_PER_LONG 32
43 17  
arch/microblaze/include/asm/types.h
1 1 #ifndef _ASM_TYPES_H
2 2 #define _ASM_TYPES_H
3 3  
  4 +#include <asm-generic/int-ll64.h>
  5 +
4 6 /*
5 7 * This file is never included by application software unless
6 8 * explicitly requested (e.g., via linux/types.h) in which case the
7 9  
... ... @@ -12,40 +14,9 @@
12 14 typedef unsigned short umode_t;
13 15  
14 16 /*
15   - * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the
16   - * header files exported to user space
17   - */
18   -
19   -typedef __signed__ char __s8;
20   -typedef unsigned char __u8;
21   -
22   -typedef __signed__ short __s16;
23   -typedef unsigned short __u16;
24   -
25   -typedef __signed__ int __s32;
26   -typedef unsigned int __u32;
27   -
28   -#if defined(__GNUC__)
29   -__extension__ typedef __signed__ long long __s64;
30   -__extension__ typedef unsigned long long __u64;
31   -#endif
32   -
33   -/*
34 17 * These aren't exported outside the kernel to avoid name space clashes
35 18 */
36 19 #ifdef __KERNEL__
37   -
38   -typedef signed char s8;
39   -typedef unsigned char u8;
40   -
41   -typedef signed short s16;
42   -typedef unsigned short u16;
43   -
44   -typedef signed int s32;
45   -typedef unsigned int u32;
46   -
47   -typedef signed long long s64;
48   -typedef unsigned long long u64;
49 20  
50 21 #define BITS_PER_LONG 32
51 22  
arch/mips/include/asm/types.h
... ... @@ -6,32 +6,12 @@
6 6 #ifndef _ASM_TYPES_H
7 7 #define _ASM_TYPES_H
8 8  
  9 +#include <asm-generic/int-ll64.h>
  10 +
9 11 #ifndef __ASSEMBLY__
10 12  
11 13 typedef unsigned short umode_t;
12 14  
13   -/*
14   - * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the
15   - * header files exported to user space
16   - */
17   -
18   -typedef __signed__ char __s8;
19   -typedef unsigned char __u8;
20   -
21   -typedef __signed__ short __s16;
22   -typedef unsigned short __u16;
23   -
24   -typedef __signed__ int __s32;
25   -typedef unsigned int __u32;
26   -
27   -#if defined(__GNUC__)
28   -__extension__ typedef __signed__ long long __s64;
29   -__extension__ typedef unsigned long long __u64;
30   -#else
31   -typedef __signed__ long long __s64;
32   -typedef unsigned long long __u64;
33   -#endif
34   -
35 15 #endif /* __ASSEMBLY__ */
36 16  
37 17 /*
... ... @@ -42,18 +22,6 @@
42 22 #define BITS_PER_LONG _MIPS_SZLONG
43 23  
44 24 #ifndef __ASSEMBLY__
45   -
46   -typedef __signed char s8;
47   -typedef unsigned char u8;
48   -
49   -typedef __signed short s16;
50   -typedef unsigned short u16;
51   -
52   -typedef __signed int s32;
53   -typedef unsigned int u32;
54   -
55   -typedef __signed__ long long s64;
56   -typedef unsigned long long u64;
57 25  
58 26 #if (defined(CONFIG_HIGHMEM) && defined(CONFIG_64BIT_PHYS_ADDR)) \
59 27 || defined(CONFIG_64BIT)
arch/nds32/include/asm/types.h
... ... @@ -11,43 +11,14 @@
11 11 #ifndef __ASM_NDS_TYPES_H
12 12 #define __ASM_NDS_TYPES_H
13 13  
  14 +#include <asm-generic/int-ll64.h>
  15 +
14 16 typedef unsigned short umode_t;
15 17  
16 18 /*
17   - * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the
18   - * header files exported to user space
19   - */
20   -
21   -typedef __signed__ char __s8;
22   -typedef unsigned char __u8;
23   -
24   -typedef __signed__ short __s16;
25   -typedef unsigned short __u16;
26   -
27   -typedef __signed__ int __s32;
28   -typedef unsigned int __u32;
29   -
30   -#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
31   -typedef __signed__ long long __s64;
32   -typedef unsigned long long __u64;
33   -#endif
34   -
35   -/*
36 19 * These aren't exported outside the kernel to avoid name space clashes
37 20 */
38 21 #ifdef __KERNEL__
39   -
40   -typedef signed char s8;
41   -typedef unsigned char u8;
42   -
43   -typedef signed short s16;
44   -typedef unsigned short u16;
45   -
46   -typedef signed int s32;
47   -typedef unsigned int u32;
48   -
49   -typedef signed long long s64;
50   -typedef unsigned long long u64;
51 22  
52 23 #define BITS_PER_LONG 32
53 24  
arch/powerpc/include/asm/types.h
1 1 #ifndef _PPC_TYPES_H
2 2 #define _PPC_TYPES_H
3 3  
  4 +#include <asm-generic/int-ll64.h>
  5 +
4 6 #ifndef __ASSEMBLY__
5 7  
6 8 typedef unsigned short umode_t;
7 9  
8   -typedef __signed__ char __s8;
9   -typedef unsigned char __u8;
10   -
11   -typedef __signed__ short __s16;
12   -typedef unsigned short __u16;
13   -
14   -typedef __signed__ int __s32;
15   -typedef unsigned int __u32;
16   -
17   -#if defined(__GNUC__)
18   -__extension__ typedef __signed__ long long __s64;
19   -__extension__ typedef unsigned long long __u64;
20   -#endif
21   -
22 10 typedef struct {
23 11 __u32 u[4];
24 12 } __attribute__((aligned(16))) vector128;
25 13  
26 14 #ifdef __KERNEL__
27   -/*
28   - * These aren't exported outside the kernel to avoid name space clashes
29   - */
30   -typedef signed char s8;
31   -typedef unsigned char u8;
32   -
33   -typedef signed short s16;
34   -typedef unsigned short u16;
35   -
36   -typedef signed int s32;
37   -typedef unsigned int u32;
38   -
39   -typedef signed long long s64;
40   -typedef unsigned long long u64;
41 15  
42 16 #define BITS_PER_LONG 32
43 17  
arch/riscv/include/asm/types.h
... ... @@ -12,43 +12,14 @@
12 12 #ifndef __ASM_RISCV_TYPES_H
13 13 #define __ASM_RISCV_TYPES_H
14 14  
  15 +#include <asm-generic/int-ll64.h>
  16 +
15 17 typedef unsigned short umode_t;
16 18  
17 19 /*
18   - * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the
19   - * header files exported to user space
20   - */
21   -
22   -typedef __signed__ char __s8;
23   -typedef unsigned char __u8;
24   -
25   -typedef __signed__ short __s16;
26   -typedef unsigned short __u16;
27   -
28   -typedef __signed__ int __s32;
29   -typedef unsigned int __u32;
30   -
31   -#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
32   -typedef __signed__ long long __s64;
33   -typedef unsigned long long __u64;
34   -#endif
35   -
36   -/*
37 20 * These aren't exported outside the kernel to avoid name space clashes
38 21 */
39 22 #ifdef __KERNEL__
40   -
41   -typedef signed char s8;
42   -typedef unsigned char u8;
43   -
44   -typedef signed short s16;
45   -typedef unsigned short u16;
46   -
47   -typedef signed int s32;
48   -typedef unsigned int u32;
49   -
50   -typedef signed long long s64;
51   -typedef unsigned long long u64;
52 23  
53 24 #define BITS_PER_LONG 32
54 25  
arch/sandbox/include/asm/types.h
... ... @@ -6,43 +6,14 @@
6 6 #ifndef __ASM_SANDBOX_TYPES_H
7 7 #define __ASM_SANDBOX_TYPES_H
8 8  
  9 +#include <asm-generic/int-ll64.h>
  10 +
9 11 typedef unsigned short umode_t;
10 12  
11 13 /*
12   - * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the
13   - * header files exported to user space
14   - */
15   -
16   -typedef __signed__ char __s8;
17   -typedef unsigned char __u8;
18   -
19   -typedef __signed__ short __s16;
20   -typedef unsigned short __u16;
21   -
22   -typedef __signed__ int __s32;
23   -typedef unsigned int __u32;
24   -
25   -#if defined(__GNUC__)
26   -__extension__ typedef __signed__ long long __s64;
27   -__extension__ typedef unsigned long long __u64;
28   -#endif
29   -
30   -/*
31 14 * These aren't exported outside the kernel to avoid name space clashes
32 15 */
33 16 #ifdef __KERNEL__
34   -
35   -typedef signed char s8;
36   -typedef unsigned char u8;
37   -
38   -typedef signed short s16;
39   -typedef unsigned short u16;
40   -
41   -typedef signed int s32;
42   -typedef unsigned int u32;
43   -
44   -typedef signed long long s64;
45   -typedef unsigned long long u64;
46 17  
47 18 /*
48 19 * Number of bits in a C 'long' on this architecture.
arch/sh/include/asm/types.h
1 1 #ifndef __ASM_SH_TYPES_H
2 2 #define __ASM_SH_TYPES_H
3 3  
  4 +#include <asm-generic/int-ll64.h>
  5 +
4 6 #ifndef __ASSEMBLY__
5 7  
6 8 typedef unsigned short umode_t;
7 9  
8   -/*
9   - * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the
10   - * header files exported to user space
11   - */
12   -
13   -typedef __signed__ char __s8;
14   -typedef unsigned char __u8;
15   -
16   -typedef __signed__ short __s16;
17   -typedef unsigned short __u16;
18   -
19   -typedef __signed__ int __s32;
20   -typedef unsigned int __u32;
21   -
22   -#if defined(__GNUC__)
23   -__extension__ typedef __signed__ long long __s64;
24   -__extension__ typedef unsigned long long __u64;
25   -#endif
26   -
27 10 #endif /* __ASSEMBLY__ */
28 11  
29 12 /*
... ... @@ -34,19 +17,6 @@
34 17 #define BITS_PER_LONG 32
35 18  
36 19 #ifndef __ASSEMBLY__
37   -
38   -
39   -typedef __signed__ char s8;
40   -typedef unsigned char u8;
41   -
42   -typedef __signed__ short s16;
43   -typedef unsigned short u16;
44   -
45   -typedef __signed__ int s32;
46   -typedef unsigned int u32;
47   -
48   -typedef __signed__ long long s64;
49   -typedef unsigned long long u64;
50 20  
51 21 /* Dma addresses are 32-bits wide. */
52 22  
arch/x86/include/asm/types.h
1 1 #ifndef __ASM_I386_TYPES_H
2 2 #define __ASM_I386_TYPES_H
3 3  
  4 +#include <asm-generic/int-ll64.h>
  5 +
4 6 typedef unsigned short umode_t;
5 7  
6 8 /*
7   - * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the
8   - * header files exported to user space
9   - */
10   -
11   -typedef __signed__ char __s8;
12   -typedef unsigned char __u8;
13   -
14   -typedef __signed__ short __s16;
15   -typedef unsigned short __u16;
16   -
17   -typedef __signed__ int __s32;
18   -typedef unsigned int __u32;
19   -
20   -#if defined(__GNUC__)
21   -__extension__ typedef __signed__ long long __s64;
22   -__extension__ typedef unsigned long long __u64;
23   -#endif
24   -
25   -/*
26 9 * These aren't exported outside the kernel to avoid name space clashes
27 10 */
28 11 #ifdef __KERNEL__
29   -
30   -typedef signed char s8;
31   -typedef unsigned char u8;
32   -
33   -typedef signed short s16;
34   -typedef unsigned short u16;
35   -
36   -typedef signed int s32;
37   -typedef unsigned int u32;
38   -
39   -typedef signed long long s64;
40   -typedef unsigned long long u64;
41 12  
42 13 #if CONFIG_IS_ENABLED(X86_64)
43 14 #define BITS_PER_LONG 64
arch/xtensa/include/asm/types.h
... ... @@ -6,43 +6,14 @@
6 6 #ifndef _XTENSA_TYPES_H
7 7 #define _XTENSA_TYPES_H
8 8  
  9 +#include <asm-generic/int-ll64.h>
  10 +
9 11 typedef unsigned short umode_t;
10 12  
11 13 /*
12   - * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the
13   - * header files exported to user space
14   - */
15   -
16   -typedef __signed__ char __s8;
17   -typedef unsigned char __u8;
18   -
19   -typedef __signed__ short __s16;
20   -typedef unsigned short __u16;
21   -
22   -typedef __signed__ int __s32;
23   -typedef unsigned int __u32;
24   -
25   -#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
26   -typedef __signed__ long long __s64;
27   -typedef unsigned long long __u64;
28   -#endif
29   -
30   -/*
31 14 * These aren't exported outside the kernel to avoid name space clashes
32 15 */
33 16 #ifdef __KERNEL__
34   -
35   -typedef signed char s8;
36   -typedef unsigned char u8;
37   -
38   -typedef signed short s16;
39   -typedef unsigned short u16;
40   -
41   -typedef signed int s32;
42   -typedef unsigned int u32;
43   -
44   -typedef signed long long s64;
45   -typedef unsigned long long u64;
46 17  
47 18 #define BITS_PER_LONG 32
48 19  
include/asm-generic/int-ll64.h
  1 +/* SPDX-License-Identifier: GPL-2.0 */
  2 +/*
  3 + * asm-generic/int-ll64.h
  4 + *
  5 + * Integer declarations for architectures which use "long long"
  6 + * for 64-bit types.
  7 + */
  8 +
  9 +#ifndef _ASM_GENERIC_INT_LL64_H
  10 +#define _ASM_GENERIC_INT_LL64_H
  11 +
  12 +#ifndef __ASSEMBLY__
  13 +/*
  14 + * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the
  15 + * header files exported to user space
  16 + */
  17 +
  18 +typedef __signed__ char __s8;
  19 +typedef unsigned char __u8;
  20 +
  21 +typedef __signed__ short __s16;
  22 +typedef unsigned short __u16;
  23 +
  24 +typedef __signed__ int __s32;
  25 +typedef unsigned int __u32;
  26 +
  27 +#ifdef __GNUC__
  28 +__extension__ typedef __signed__ long long __s64;
  29 +__extension__ typedef unsigned long long __u64;
  30 +#else
  31 +typedef __signed__ long long __s64;
  32 +typedef unsigned long long __u64;
  33 +#endif
  34 +
  35 +typedef __s8 s8;
  36 +typedef __u8 u8;
  37 +typedef __s16 s16;
  38 +typedef __u16 u16;
  39 +typedef __s32 s32;
  40 +typedef __u32 u32;
  41 +typedef __s64 s64;
  42 +typedef __u64 u64;
  43 +
  44 +#endif /* __ASSEMBLY__ */
  45 +
  46 +
  47 +#endif /* _ASM_GENERIC_INT_LL64_H */
include/asm-generic/types.h
  1 +/* SPDX-License-Identifier: GPL-2.0 */
  2 +#ifndef _ASM_GENERIC_TYPES_H
  3 +#define _ASM_GENERIC_TYPES_H
  4 +/*
  5 + * int-ll64 is used everywhere now.
  6 + */
  7 +#include <asm-generic/int-ll64.h>
  8 +
  9 +#endif /* _ASM_GENERIC_TYPES_H */