From d13ff31cfeedbf2fefc7ba13cb753775648eac0c Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Thu, 24 Apr 2008 12:56:52 -0700 Subject: types: create This creates two generic files with common integer definitions; one where 64 bits is "long" (most 64-bit architectures) and one where 64 bits is "long long" (all 32-bit architectures and x86-64.) Signed-off-by: H. Peter Anvin Cc: Anton Blanchard Cc: Ben Dooks Cc: Bryan Wu Cc: Chris Zankel Cc: David Howells Cc: David S. Miller Cc: Geert Uytterhoeven Cc: Grant Grundler Cc: H. Peter Anvin Cc: Haavard Skinnemoen Cc: Heiko Carstens Cc: Hirokazu Takata Cc: Ingo Molnar Cc: Ivan Kokshaysky Cc: Jesper Nilsson Cc: Koichi Yasutake Cc: Kyle McMartin Cc: Lennert Buytenhek Cc: Martin Schwidefsky Cc: Matthew Wilcox Cc: Mikael Starvik Cc: Paul Mackerras Cc: Paul Mundt Cc: Ralf Baechle Cc: Richard Henderson Cc: Roman Zippel Cc: Russell King Cc: Thomas Gleixner Cc: Tony Luck Cc: William L. Irwin Cc: Yoshinori Sato --- include/asm-generic/Kbuild | 2 ++ include/asm-generic/int-l64.h | 51 ++++++++++++++++++++++++++++++++++++++ include/asm-generic/int-ll64.h | 56 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 109 insertions(+) create mode 100644 include/asm-generic/int-l64.h create mode 100644 include/asm-generic/int-ll64.h diff --git a/include/asm-generic/Kbuild b/include/asm-generic/Kbuild index c18110ee30f..4c9932a2503 100644 --- a/include/asm-generic/Kbuild +++ b/include/asm-generic/Kbuild @@ -7,5 +7,7 @@ header-y += poll.h header-y += signal.h header-y += statfs.h +unifdef-y += int-l64.h +unifdef-y += int-ll64.h unifdef-y += resource.h unifdef-y += siginfo.h diff --git a/include/asm-generic/int-l64.h b/include/asm-generic/int-l64.h new file mode 100644 index 00000000000..629b5a43f0b --- /dev/null +++ b/include/asm-generic/int-l64.h @@ -0,0 +1,51 @@ +/* + * asm-generic/int-l64.h + * + * Integer declarations for architectures which use "long" + * for 64-bit types. + */ + +#ifndef _ASM_GENERIC_INT_L64_H +#define _ASM_GENERIC_INT_L64_H + +#ifndef __ASSEMBLY__ +/* + * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the + * header files exported to user space + */ + +typedef __signed__ char __s8; +typedef unsigned char __u8; + +typedef __signed__ short __s16; +typedef unsigned short __u16; + +typedef __signed__ int __s32; +typedef unsigned int __u32; + +typedef __signed__ long __s64; +typedef unsigned long __u64; + +#endif /* __ASSEMBLY__ */ + +#ifdef __KERNEL__ + +#ifndef __ASSEMBLY__ + +typedef signed char s8; +typedef unsigned char u8; + +typedef signed short s16; +typedef unsigned short u16; + +typedef signed int s32; +typedef unsigned int u32; + +typedef signed long s64; +typedef unsigned long u64; + +#endif /* __ASSEMBLY__ */ + +#endif /* __KERNEL__ */ + +#endif /* _ASM_GENERIC_INT_L64_H */ diff --git a/include/asm-generic/int-ll64.h b/include/asm-generic/int-ll64.h new file mode 100644 index 00000000000..1e5ffec0575 --- /dev/null +++ b/include/asm-generic/int-ll64.h @@ -0,0 +1,56 @@ +/* + * asm-generic/int-ll64.h + * + * Integer declarations for architectures which use "long long" + * for 64-bit types. + */ + +#ifndef _ASM_GENERIC_INT_LL64_H +#define _ASM_GENERIC_INT_LL64_H + +#ifndef __ASSEMBLY__ +/* + * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the + * header files exported to user space + */ + +typedef __signed__ char __s8; +typedef unsigned char __u8; + +typedef __signed__ short __s16; +typedef unsigned short __u16; + +typedef __signed__ int __s32; +typedef unsigned int __u32; + +#ifdef __GNUC__ +__extension__ typedef __signed__ long long __s64; +__extension__ typedef unsigned long long __u64; +#elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L +typedef __signed__ long long __s64; +typedef unsigned long long __u64; +#endif + +#endif /* __ASSEMBLY__ */ + +#ifdef __KERNEL__ + +#ifndef __ASSEMBLY__ + +typedef signed char s8; +typedef unsigned char u8; + +typedef signed short s16; +typedef unsigned short u16; + +typedef signed int s32; +typedef unsigned int u32; + +typedef signed long long s64; +typedef unsigned long long u64; + +#endif /* __ASSEMBLY__ */ + +#endif /* __KERNEL__ */ + +#endif /* _ASM_GENERIC_INT_LL64_H */ -- cgit v1.2.3 From 3726c23df8e4d95b6f2b335dfa90e3f4850a8a00 Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Sun, 6 Apr 2008 10:35:00 -0700 Subject: alpha: types: use for the alpha architecture This modifies to use the generic include files. Signed-off-by: H. Peter Anvin Cc: Richard Henderson Cc: Ivan Kokshaysky --- include/asm-alpha/types.h | 36 +----------------------------------- 1 file changed, 1 insertion(+), 35 deletions(-) diff --git a/include/asm-alpha/types.h b/include/asm-alpha/types.h index f5716139ec8..a9e34ca4d46 100644 --- a/include/asm-alpha/types.h +++ b/include/asm-alpha/types.h @@ -8,28 +8,12 @@ * not a major issue. However, for interoperability, libraries still * need to be careful to avoid a name clashes. */ +#include #ifndef __ASSEMBLY__ typedef unsigned int umode_t; -/* - * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the - * header files exported to user space - */ - -typedef __signed__ char __s8; -typedef unsigned char __u8; - -typedef __signed__ short __s16; -typedef unsigned short __u16; - -typedef __signed__ int __s32; -typedef unsigned int __u32; - -typedef __signed__ long __s64; -typedef unsigned long __u64; - #endif /* __ASSEMBLY__ */ /* @@ -39,23 +23,5 @@ typedef unsigned long __u64; #define BITS_PER_LONG 64 -#ifndef __ASSEMBLY__ - -typedef signed char s8; -typedef unsigned char u8; - -typedef signed short s16; -typedef unsigned short u16; - -typedef signed int s32; -typedef unsigned int u32; - -typedef signed long s64; -typedef unsigned long u64; - -typedef u64 dma_addr_t; -typedef u64 dma64_addr_t; - -#endif /* __ASSEMBLY__ */ #endif /* __KERNEL__ */ #endif /* _ALPHA_TYPES_H */ -- cgit v1.2.3 From 4cc1a102b049ff2890e3a97c23ca88e7205b42fd Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Sun, 6 Apr 2008 10:35:00 -0700 Subject: arm: types: use for the arm architecture This modifies to use the generic include files. Signed-off-by: H. Peter Anvin Cc: Russell King Cc: Lennert Buytenhek Cc: Ben Dooks --- include/asm-arm/types.h | 33 ++------------------------------- 1 file changed, 2 insertions(+), 31 deletions(-) diff --git a/include/asm-arm/types.h b/include/asm-arm/types.h index 3141451a9bd..345df01534a 100644 --- a/include/asm-arm/types.h +++ b/include/asm-arm/types.h @@ -1,29 +1,12 @@ #ifndef __ASM_ARM_TYPES_H #define __ASM_ARM_TYPES_H +#include + #ifndef __ASSEMBLY__ typedef unsigned short umode_t; -/* - * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the - * header files exported to user space - */ - -typedef __signed__ char __s8; -typedef unsigned char __u8; - -typedef __signed__ short __s16; -typedef unsigned short __u16; - -typedef __signed__ int __s32; -typedef unsigned int __u32; - -#if defined(__GNUC__) -__extension__ typedef __signed__ long long __s64; -__extension__ typedef unsigned long long __u64; -#endif - #endif /* __ASSEMBLY__ */ /* @@ -35,18 +18,6 @@ __extension__ typedef unsigned long long __u64; #ifndef __ASSEMBLY__ -typedef signed char s8; -typedef unsigned char u8; - -typedef signed short s16; -typedef unsigned short u16; - -typedef signed int s32; -typedef unsigned int u32; - -typedef signed long long s64; -typedef unsigned long long u64; - /* Dma addresses are 32-bits wide. */ typedef u32 dma_addr_t; -- cgit v1.2.3 From 63eae0ccacd67fd5ee238c6ba68f83f0ab91a1df Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Sun, 6 Apr 2008 10:35:01 -0700 Subject: avr32: types: use for the avr32 architecture This modifies to use the generic include files. Signed-off-by: H. Peter Anvin Cc: Haavard Skinnemoen --- include/asm-avr32/types.h | 32 ++------------------------------ 1 file changed, 2 insertions(+), 30 deletions(-) diff --git a/include/asm-avr32/types.h b/include/asm-avr32/types.h index 8999a381940..9cefda6f534 100644 --- a/include/asm-avr32/types.h +++ b/include/asm-avr32/types.h @@ -8,28 +8,12 @@ #ifndef __ASM_AVR32_TYPES_H #define __ASM_AVR32_TYPES_H +#include + #ifndef __ASSEMBLY__ typedef unsigned short umode_t; -/* - * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the - * header files exported to user space - */ -typedef __signed__ char __s8; -typedef unsigned char __u8; - -typedef __signed__ short __s16; -typedef unsigned short __u16; - -typedef __signed__ int __s32; -typedef unsigned int __u32; - -#if defined(__GNUC__) -__extension__ typedef __signed__ long long __s64; -__extension__ typedef unsigned long long __u64; -#endif - #endif /* __ASSEMBLY__ */ /* @@ -41,18 +25,6 @@ __extension__ typedef unsigned long long __u64; #ifndef __ASSEMBLY__ -typedef signed char s8; -typedef unsigned char u8; - -typedef signed short s16; -typedef unsigned short u16; - -typedef signed int s32; -typedef unsigned int u32; - -typedef signed long long s64; -typedef unsigned long long u64; - /* Dma addresses are 32-bits wide. */ typedef u32 dma_addr_t; -- cgit v1.2.3 From 5424a328d281f54bbc62bf9b5118c45f8113a8b8 Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Sun, 6 Apr 2008 10:35:02 -0700 Subject: blackfin: types: use for the blackfin architecture This modifies to use the generic include files. Signed-off-by: H. Peter Anvin Cc: Bryan Wu --- include/asm-blackfin/types.h | 34 ++-------------------------------- 1 file changed, 2 insertions(+), 32 deletions(-) diff --git a/include/asm-blackfin/types.h b/include/asm-blackfin/types.h index 9785a6d531c..8441cbc2bf9 100644 --- a/include/asm-blackfin/types.h +++ b/include/asm-blackfin/types.h @@ -8,30 +8,12 @@ * not a major issue. However, for interoperability, libraries still * need to be careful to avoid a name clashes. */ +#include + #ifndef __ASSEMBLY__ typedef unsigned short umode_t; -/* - * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the - * header files exported to user space - */ - -typedef __signed__ char __s8; -typedef unsigned char __u8; - -typedef __signed__ short __s16; -typedef unsigned short __u16; - -typedef __signed__ int __s32; -typedef unsigned int __u32; - -/* HK0617 -- Changes to unsigned long temporarily */ -#if defined(__GNUC__) -__extension__ typedef __signed__ long long __s64; -__extension__ typedef unsigned long long __u64; -#endif - #endif /* __ASSEMBLY__ */ /* * These aren't exported outside the kernel to avoid name space clashes @@ -42,18 +24,6 @@ __extension__ typedef unsigned long long __u64; #ifndef __ASSEMBLY__ -typedef signed char s8; -typedef unsigned char u8; - -typedef signed short s16; -typedef unsigned short u16; - -typedef signed int s32; -typedef unsigned int u32; - -typedef signed long long s64; -typedef unsigned long long u64; - /* Dma addresses are 32-bits wide. */ typedef u32 dma_addr_t; -- cgit v1.2.3 From e3b8cf047eb2702178b8cc16f03f8194af840732 Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Sun, 6 Apr 2008 10:35:02 -0700 Subject: cris: types: use for the cris architecture This modifies to use the generic include files. Signed-off-by: H. Peter Anvin Cc: Mikael Starvik Cc: Jesper Nilsson --- include/asm-cris/types.h | 33 ++------------------------------- 1 file changed, 2 insertions(+), 31 deletions(-) diff --git a/include/asm-cris/types.h b/include/asm-cris/types.h index 5a21c42bc6c..5790262cbe8 100644 --- a/include/asm-cris/types.h +++ b/include/asm-cris/types.h @@ -1,29 +1,12 @@ #ifndef _ETRAX_TYPES_H #define _ETRAX_TYPES_H +#include + #ifndef __ASSEMBLY__ typedef unsigned short umode_t; -/* - * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the - * header files exported to user space - */ - -typedef __signed__ char __s8; -typedef unsigned char __u8; - -typedef __signed__ short __s16; -typedef unsigned short __u16; - -typedef __signed__ int __s32; -typedef unsigned int __u32; - -#if defined(__GNUC__) -__extension__ typedef __signed__ long long __s64; -__extension__ typedef unsigned long long __u64; -#endif - #endif /* __ASSEMBLY__ */ /* @@ -35,18 +18,6 @@ __extension__ typedef unsigned long long __u64; #ifndef __ASSEMBLY__ -typedef signed char s8; -typedef unsigned char u8; - -typedef signed short s16; -typedef unsigned short u16; - -typedef signed int s32; -typedef unsigned int u32; - -typedef signed long long s64; -typedef unsigned long long u64; - /* Dma addresses are 32-bits wide, just like our other addresses. */ typedef u32 dma_addr_t; -- cgit v1.2.3 From 8f337b5399302e41ed44e999e0cc518f92d0a509 Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Sun, 6 Apr 2008 10:35:03 -0700 Subject: frv: types: use for the frv architecture This modifies to use the generic include files. Signed-off-by: H. Peter Anvin Cc: David Howells --- include/asm-frv/types.h | 34 ++-------------------------------- 1 file changed, 2 insertions(+), 32 deletions(-) diff --git a/include/asm-frv/types.h b/include/asm-frv/types.h index 767e5ed71c4..613bf1e962f 100644 --- a/include/asm-frv/types.h +++ b/include/asm-frv/types.h @@ -12,29 +12,12 @@ #ifndef _ASM_TYPES_H #define _ASM_TYPES_H +#include + #ifndef __ASSEMBLY__ typedef unsigned short umode_t; -/* - * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the - * header files exported to user space - */ - -typedef __signed__ char __s8; -typedef unsigned char __u8; - -typedef __signed__ short __s16; -typedef unsigned short __u16; - -typedef __signed__ int __s32; -typedef unsigned int __u32; - -#if defined(__GNUC__) -__extension__ typedef __signed__ long long __s64; -__extension__ typedef unsigned long long __u64; -#endif - #endif /* __ASSEMBLY__ */ /* @@ -46,19 +29,6 @@ __extension__ typedef unsigned long long __u64; #ifndef __ASSEMBLY__ - -typedef signed char s8; -typedef unsigned char u8; - -typedef signed short s16; -typedef unsigned short u16; - -typedef signed int s32; -typedef unsigned int u32; - -typedef signed long long s64; -typedef unsigned long long u64; - /* Dma addresses are 32-bits wide. */ typedef u32 dma_addr_t; -- cgit v1.2.3 From 861531555dfac342c1c40668af8ac2f88af26e71 Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Sun, 6 Apr 2008 10:35:04 -0700 Subject: h8300: types: use for the h8300 architecture This modifies to use the generic include files. Signed-off-by: H. Peter Anvin Cc: Yoshinori Sato --- include/asm-h8300/types.h | 33 ++------------------------------- 1 file changed, 2 insertions(+), 31 deletions(-) diff --git a/include/asm-h8300/types.h b/include/asm-h8300/types.h index 56566e2a09f..12875190b15 100644 --- a/include/asm-h8300/types.h +++ b/include/asm-h8300/types.h @@ -1,6 +1,8 @@ #ifndef _H8300_TYPES_H #define _H8300_TYPES_H +#include + #if !defined(__ASSEMBLY__) /* @@ -13,42 +15,11 @@ typedef unsigned short umode_t; -/* - * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the - * header files exported to user space - */ - -typedef __signed__ char __s8; -typedef unsigned char __u8; - -typedef __signed__ short __s16; -typedef unsigned short __u16; - -typedef __signed__ int __s32; -typedef unsigned int __u32; - -#if defined(__GNUC__) -__extension__ typedef __signed__ long long __s64; -__extension__ typedef unsigned long long __u64; -#endif - /* * These aren't exported outside the kernel to avoid name space clashes */ #ifdef __KERNEL__ -typedef signed char s8; -typedef unsigned char u8; - -typedef signed short s16; -typedef unsigned short u16; - -typedef signed int s32; -typedef unsigned int u32; - -typedef signed long long s64; -typedef unsigned long long u64; - #define BITS_PER_LONG 32 /* Dma addresses are 32-bits wide. */ -- cgit v1.2.3 From 4a4bb4cee14905dd8b2b471b6998d62eeae8199c Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Sun, 6 Apr 2008 10:35:04 -0700 Subject: ia64: types: use for the ia64 architecture This modifies to use the generic include files. Signed-off-by: H. Peter Anvin Acked-by: Tony Luck --- include/asm-ia64/types.h | 31 ++----------------------------- 1 file changed, 2 insertions(+), 29 deletions(-) diff --git a/include/asm-ia64/types.h b/include/asm-ia64/types.h index 902850d1242..e36b3716e71 100644 --- a/include/asm-ia64/types.h +++ b/include/asm-ia64/types.h @@ -13,6 +13,8 @@ * David Mosberger-Tang , Hewlett-Packard Co */ +#include + #ifdef __ASSEMBLY__ # define __IA64_UL(x) (x) # define __IA64_UL_CONST(x) x @@ -27,40 +29,11 @@ typedef unsigned int umode_t; -/* - * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the - * header files exported to user space - */ - -typedef __signed__ char __s8; -typedef unsigned char __u8; - -typedef __signed__ short __s16; -typedef unsigned short __u16; - -typedef __signed__ int __s32; -typedef unsigned int __u32; - -typedef __signed__ long __s64; -typedef unsigned long __u64; - /* * These aren't exported outside the kernel to avoid name space clashes */ # ifdef __KERNEL__ -typedef __s8 s8; -typedef __u8 u8; - -typedef __s16 s16; -typedef __u16 u16; - -typedef __s32 s32; -typedef __u32 u32; - -typedef __s64 s64; -typedef __u64 u64; - #define BITS_PER_LONG 64 /* DMA addresses are 64-bits wide, in general. */ -- cgit v1.2.3 From ff704db3d4d9354712df2683b62f89dc0611632a Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Sun, 6 Apr 2008 10:35:05 -0700 Subject: m32r: types: use for the m32r architecture This modifies to use the generic include files. Signed-off-by: H. Peter Anvin Cc: Hirokazu Takata --- include/asm-m32r/types.h | 32 ++------------------------------ 1 file changed, 2 insertions(+), 30 deletions(-) diff --git a/include/asm-m32r/types.h b/include/asm-m32r/types.h index b64c16639a7..bc9f7fff0ac 100644 --- a/include/asm-m32r/types.h +++ b/include/asm-m32r/types.h @@ -1,28 +1,12 @@ #ifndef _ASM_M32R_TYPES_H #define _ASM_M32R_TYPES_H +#include + #ifndef __ASSEMBLY__ typedef unsigned short umode_t; -/* - * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the - * header files exported to user space - */ - -typedef __signed__ char __s8; -typedef unsigned char __u8; - -typedef __signed__ short __s16; -typedef unsigned short __u16; - -typedef __signed__ int __s32; -typedef unsigned int __u32; - -#if defined(__GNUC__) -__extension__ typedef __signed__ long long __s64; -__extension__ typedef unsigned long long __u64; -#endif #endif /* __ASSEMBLY__ */ /* @@ -34,18 +18,6 @@ __extension__ typedef unsigned long long __u64; #ifndef __ASSEMBLY__ -typedef signed char s8; -typedef unsigned char u8; - -typedef signed short s16; -typedef unsigned short u16; - -typedef signed int s32; -typedef unsigned int u32; - -typedef signed long long s64; -typedef unsigned long long u64; - /* DMA addresses are 32-bits wide. */ typedef u32 dma_addr_t; -- cgit v1.2.3 From ad55ed6161c113cc03c04df266e75d484bce8247 Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Sun, 6 Apr 2008 10:35:06 -0700 Subject: m68k: types: use for the m68k architecture This modifies to use the generic include files. Signed-off-by: H. Peter Anvin Cc: Geert Uytterhoeven Cc: Roman Zippel --- include/asm-m68k/types.h | 32 +------------------------------- 1 file changed, 1 insertion(+), 31 deletions(-) diff --git a/include/asm-m68k/types.h b/include/asm-m68k/types.h index c35c09d93b6..6441cb5f8e7 100644 --- a/include/asm-m68k/types.h +++ b/include/asm-m68k/types.h @@ -8,30 +8,12 @@ * not a major issue. However, for interoperability, libraries still * need to be careful to avoid a name clashes. */ +#include #ifndef __ASSEMBLY__ typedef unsigned short umode_t; -/* - * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the - * header files exported to user space - */ - -typedef __signed__ char __s8; -typedef unsigned char __u8; - -typedef __signed__ short __s16; -typedef unsigned short __u16; - -typedef __signed__ int __s32; -typedef unsigned int __u32; - -#if defined(__GNUC__) -__extension__ typedef __signed__ long long __s64; -__extension__ typedef unsigned long long __u64; -#endif - #endif /* __ASSEMBLY__ */ /* @@ -43,18 +25,6 @@ __extension__ typedef unsigned long long __u64; #ifndef __ASSEMBLY__ -typedef signed char s8; -typedef unsigned char u8; - -typedef signed short s16; -typedef unsigned short u16; - -typedef signed int s32; -typedef unsigned int u32; - -typedef signed long long s64; -typedef unsigned long long u64; - /* DMA addresses are always 32-bits wide */ typedef u32 dma_addr_t; -- cgit v1.2.3 From 23cf11ddb5099f8c7f7cb3eb154bff0faf31cae9 Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Sun, 6 Apr 2008 10:35:06 -0700 Subject: mips: types: use for the mips architecture This modifies to use the generic include files. Signed-off-by: H. Peter Anvin Cc: Ralf Baechle --- include/asm-mips/types.h | 56 ++++++------------------------------------------ 1 file changed, 6 insertions(+), 50 deletions(-) diff --git a/include/asm-mips/types.h b/include/asm-mips/types.h index 2dd147f519d..7a2ee4f4013 100644 --- a/include/asm-mips/types.h +++ b/include/asm-mips/types.h @@ -9,36 +9,16 @@ #ifndef _ASM_TYPES_H #define _ASM_TYPES_H +#if _MIPS_SZLONG == 64 +# include +#else +# include +#endif + #ifndef __ASSEMBLY__ typedef unsigned short umode_t; -/* - * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the - * header files exported to user space - */ - -typedef __signed__ char __s8; -typedef unsigned char __u8; - -typedef __signed__ short __s16; -typedef unsigned short __u16; - -typedef __signed__ int __s32; -typedef unsigned int __u32; - -#if (_MIPS_SZLONG == 64) - -typedef __signed__ long __s64; -typedef unsigned long __u64; - -#else - -#if defined(__GNUC__) -__extension__ typedef __signed__ long long __s64; -__extension__ typedef unsigned long long __u64; -#endif - #endif #endif /* __ASSEMBLY__ */ @@ -52,30 +32,6 @@ __extension__ typedef unsigned long long __u64; #ifndef __ASSEMBLY__ - -typedef __signed char s8; -typedef unsigned char u8; - -typedef __signed short s16; -typedef unsigned short u16; - -typedef __signed int s32; -typedef unsigned int u32; - -#if (_MIPS_SZLONG == 64) - -typedef __signed__ long s64; -typedef unsigned long u64; - -#else - -#if defined(__GNUC__) && !defined(__STRICT_ANSI__) -typedef __signed__ long long s64; -typedef unsigned long long u64; -#endif - -#endif - #if (defined(CONFIG_HIGHMEM) && defined(CONFIG_64BIT_PHYS_ADDR)) \ || defined(CONFIG_64BIT) typedef u64 dma_addr_t; -- cgit v1.2.3 From 8523437b4c664cfc0f11998c4274846b95182000 Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Sun, 6 Apr 2008 10:35:07 -0700 Subject: mn10300: types: use for the mn10300 architecture This modifies to use the generic include files. Signed-off-by: H. Peter Anvin Cc: David Howells Cc: Koichi Yasutake --- include/asm-mn10300/types.h | 33 ++------------------------------- 1 file changed, 2 insertions(+), 31 deletions(-) diff --git a/include/asm-mn10300/types.h b/include/asm-mn10300/types.h index d40ea7628bf..7b9f01042fd 100644 --- a/include/asm-mn10300/types.h +++ b/include/asm-mn10300/types.h @@ -11,29 +11,12 @@ #ifndef _ASM_TYPES_H #define _ASM_TYPES_H +#include + #ifndef __ASSEMBLY__ typedef unsigned short umode_t; -/* - * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the - * header files exported to user space - */ - -typedef __signed__ char __s8; -typedef unsigned char __u8; - -typedef __signed__ short __s16; -typedef unsigned short __u16; - -typedef __signed__ int __s32; -typedef unsigned int __u32; - -#if defined(__GNUC__) && !defined(__STRICT_ANSI__) -typedef __signed__ long long __s64; -typedef unsigned long long __u64; -#endif - #endif /* __ASSEMBLY__ */ /* @@ -45,18 +28,6 @@ typedef unsigned long long __u64; #ifndef __ASSEMBLY__ -typedef signed char s8; -typedef unsigned char u8; - -typedef signed short s16; -typedef unsigned short u16; - -typedef signed int s32; -typedef unsigned int u32; - -typedef signed long long s64; -typedef unsigned long long u64; - /* Dma addresses are 32-bits wide. */ typedef u32 dma_addr_t; -- cgit v1.2.3 From 849bf3a09fdcf9dbbe060da0f5bce90231b14625 Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Sun, 6 Apr 2008 10:35:09 -0700 Subject: parisc: types: use for the parisc architecture This modifies to use the generic include files. Signed-off-by: H. Peter Anvin Cc: Kyle McMartin Cc: Matthew Wilcox Cc: Grant Grundler --- include/asm-parisc/types.h | 33 ++------------------------------- 1 file changed, 2 insertions(+), 31 deletions(-) diff --git a/include/asm-parisc/types.h b/include/asm-parisc/types.h index 56c84802da5..7f5a39bfb4c 100644 --- a/include/asm-parisc/types.h +++ b/include/asm-parisc/types.h @@ -1,29 +1,12 @@ #ifndef _PARISC_TYPES_H #define _PARISC_TYPES_H +#include + #ifndef __ASSEMBLY__ typedef unsigned short umode_t; -/* - * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the - * header files exported to user space - */ - -typedef __signed__ char __s8; -typedef unsigned char __u8; - -typedef __signed__ short __s16; -typedef unsigned short __u16; - -typedef __signed__ int __s32; -typedef unsigned int __u32; - -#if defined(__GNUC__) -__extension__ typedef __signed__ long long __s64; -__extension__ typedef unsigned long long __u64; -#endif - #endif /* __ASSEMBLY__ */ /* @@ -41,18 +24,6 @@ __extension__ typedef unsigned long long __u64; #ifndef __ASSEMBLY__ -typedef signed char s8; -typedef unsigned char u8; - -typedef signed short s16; -typedef unsigned short u16; - -typedef signed int s32; -typedef unsigned int u32; - -typedef signed long long s64; -typedef unsigned long long u64; - /* Dma addresses are 32-bits wide. */ typedef u32 dma_addr_t; -- cgit v1.2.3 From 3f02c4e0e5d20884677a0259de42e553514534f9 Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Sun, 6 Apr 2008 10:35:09 -0700 Subject: powerpc: types: use for the powerpc architecture This modifies to use the generic include files. Signed-off-by: H. Peter Anvin Cc: Paul Mackerras Cc: Anton Blanchard --- include/asm-powerpc/types.h | 48 ++++++--------------------------------------- 1 file changed, 6 insertions(+), 42 deletions(-) diff --git a/include/asm-powerpc/types.h b/include/asm-powerpc/types.h index c243a6ac60e..d3374bc865b 100644 --- a/include/asm-powerpc/types.h +++ b/include/asm-powerpc/types.h @@ -1,6 +1,12 @@ #ifndef _ASM_POWERPC_TYPES_H #define _ASM_POWERPC_TYPES_H +#ifdef __powerpc64__ +# include +#else +# include +#endif + #ifndef __ASSEMBLY__ /* @@ -22,30 +28,6 @@ typedef unsigned int umode_t; typedef unsigned short umode_t; #endif -/* - * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the - * header files exported to user space - */ - -typedef __signed__ char __s8; -typedef unsigned char __u8; - -typedef __signed__ short __s16; -typedef unsigned short __u16; - -typedef __signed__ int __s32; -typedef unsigned int __u32; - -#ifdef __powerpc64__ -typedef __signed__ long __s64; -typedef unsigned long __u64; -#else -#if defined(__GNUC__) -__extension__ typedef __signed__ long long __s64; -__extension__ typedef unsigned long long __u64; -#endif -#endif /* __powerpc64__ */ - typedef struct { __u32 u[4]; } __attribute__((aligned(16))) __vector128; @@ -64,24 +46,6 @@ typedef struct { #ifndef __ASSEMBLY__ - -typedef signed char s8; -typedef unsigned char u8; - -typedef signed short s16; -typedef unsigned short u16; - -typedef signed int s32; -typedef unsigned int u32; - -#ifdef __powerpc64__ -typedef signed long s64; -typedef unsigned long u64; -#else -typedef signed long long s64; -typedef unsigned long long u64; -#endif - typedef __vector128 vector128; /* Physical address used by some IO functions */ -- cgit v1.2.3 From 59df83992b6ec962fdf69e4db4c18951499cc67c Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Sun, 6 Apr 2008 10:35:10 -0700 Subject: s390: types: use for the s390 architecture This modifies to use the generic include files. Signed-off-by: H. Peter Anvin Cc: Martin Schwidefsky Cc: Heiko Carstens --- include/asm-s390/types.h | 48 ++++++------------------------------------------ 1 file changed, 6 insertions(+), 42 deletions(-) diff --git a/include/asm-s390/types.h b/include/asm-s390/types.h index 2c5879ae90c..78dda038dd4 100644 --- a/include/asm-s390/types.h +++ b/include/asm-s390/types.h @@ -9,34 +9,16 @@ #ifndef _S390_TYPES_H #define _S390_TYPES_H +#ifndef __s390x__ +# include +#else +# include +#endif + #ifndef __ASSEMBLY__ typedef unsigned short umode_t; -/* - * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the - * header files exported to user space - */ - -typedef __signed__ char __s8; -typedef unsigned char __u8; - -typedef __signed__ short __s16; -typedef unsigned short __u16; - -typedef __signed__ int __s32; -typedef unsigned int __u32; - -#ifndef __s390x__ -#if defined(__GNUC__) -__extension__ typedef __signed__ long long __s64; -__extension__ typedef unsigned long long __u64; -#endif -#else /* __s390x__ */ -typedef __signed__ long __s64; -typedef unsigned long __u64; -#endif - /* A address type so that arithmetic can be done on it & it can be upgraded to 64 bit when necessary */ @@ -58,24 +40,6 @@ typedef __signed__ long saddr_t; #ifndef __ASSEMBLY__ - -typedef signed char s8; -typedef unsigned char u8; - -typedef signed short s16; -typedef unsigned short u16; - -typedef signed int s32; -typedef unsigned int u32; - -#ifndef __s390x__ -typedef signed long long s64; -typedef unsigned long long u64; -#else /* __s390x__ */ -typedef signed long s64; -typedef unsigned long u64; -#endif /* __s390x__ */ - typedef u32 dma_addr_t; #ifndef __s390x__ -- cgit v1.2.3 From ba6677886e46adcd075f251d8971debf7b5ca3ee Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Sun, 6 Apr 2008 10:35:11 -0700 Subject: sh: types: use for the sh architecture This modifies to use the generic include files. Signed-off-by: H. Peter Anvin Cc: Paul Mundt --- include/asm-sh/types.h | 34 ++-------------------------------- 1 file changed, 2 insertions(+), 32 deletions(-) diff --git a/include/asm-sh/types.h b/include/asm-sh/types.h index a6e1d4126e6..beea4e6f8df 100644 --- a/include/asm-sh/types.h +++ b/include/asm-sh/types.h @@ -1,29 +1,12 @@ #ifndef __ASM_SH_TYPES_H #define __ASM_SH_TYPES_H +#include + #ifndef __ASSEMBLY__ typedef unsigned short umode_t; -/* - * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the - * header files exported to user space - */ - -typedef __signed__ char __s8; -typedef unsigned char __u8; - -typedef __signed__ short __s16; -typedef unsigned short __u16; - -typedef __signed__ int __s32; -typedef unsigned int __u32; - -#if defined(__GNUC__) -__extension__ typedef __signed__ long long __s64; -__extension__ typedef unsigned long long __u64; -#endif - #endif /* __ASSEMBLY__ */ /* @@ -35,19 +18,6 @@ __extension__ typedef unsigned long long __u64; #ifndef __ASSEMBLY__ - -typedef __signed__ char s8; -typedef unsigned char u8; - -typedef __signed__ short s16; -typedef unsigned short u16; - -typedef __signed__ int s32; -typedef unsigned int u32; - -typedef __signed__ long long s64; -typedef unsigned long long u64; - /* Dma addresses are 32-bits wide. */ typedef u32 dma_addr_t; -- cgit v1.2.3 From a3727dc6c21cd0bed64dbc97212c39d2b391f5af Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Sun, 6 Apr 2008 10:35:12 -0700 Subject: sparc: types: use for the sparc architecture This modifies to use the generic include files. Signed-off-by: H. Peter Anvin Cc: William L. Irwin Signed-off-by: David S. Miller --- include/asm-sparc/types.h | 30 +----------------------------- 1 file changed, 1 insertion(+), 29 deletions(-) diff --git a/include/asm-sparc/types.h b/include/asm-sparc/types.h index 42fc6ed9815..1b08ef860a6 100644 --- a/include/asm-sparc/types.h +++ b/include/asm-sparc/types.h @@ -2,11 +2,6 @@ #ifndef _SPARC_TYPES_H #define _SPARC_TYPES_H -/* - * _xx is ok: it doesn't pollute the POSIX namespace. Use these in the - * header files exported to user space. - */ - /* * This file is never included by application software unless * explicitly requested (e.g., via linux/types.h) in which case the @@ -14,23 +9,12 @@ * not a major issue. However, for interoperability, libraries still * need to be careful to avoid a name clashes. */ +#include #ifndef __ASSEMBLY__ typedef unsigned short umode_t; -typedef __signed__ char __s8; -typedef unsigned char __u8; - -typedef __signed__ short __s16; -typedef unsigned short __u16; - -typedef __signed__ int __s32; -typedef unsigned int __u32; - -typedef __signed__ long long __s64; -typedef unsigned long long __u64; - #endif /* __ASSEMBLY__ */ #ifdef __KERNEL__ @@ -39,18 +23,6 @@ typedef unsigned long long __u64; #ifndef __ASSEMBLY__ -typedef __signed__ char s8; -typedef unsigned char u8; - -typedef __signed__ short s16; -typedef unsigned short u16; - -typedef __signed__ int s32; -typedef unsigned int u32; - -typedef __signed__ long long s64; -typedef unsigned long long u64; - typedef u32 dma_addr_t; typedef u32 dma64_addr_t; -- cgit v1.2.3 From 0dc794754cba8e3e8eb39bc028cb88c5d6ed506b Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Sun, 6 Apr 2008 10:35:13 -0700 Subject: sparc64: types: use for the sparc64 architecture This modifies to use the generic include files. Signed-off-by: H. Peter Anvin Acked-by: David S. Miller --- include/asm-sparc64/types.h | 30 +----------------------------- 1 file changed, 1 insertion(+), 29 deletions(-) diff --git a/include/asm-sparc64/types.h b/include/asm-sparc64/types.h index d0ee7f10583..5dbe04f4044 100644 --- a/include/asm-sparc64/types.h +++ b/include/asm-sparc64/types.h @@ -9,28 +9,12 @@ * not a major issue. However, for interoperability, libraries still * need to be careful to avoid a name clashes. */ +#include #ifndef __ASSEMBLY__ typedef unsigned short umode_t; -/* - * _xx is ok: it doesn't pollute the POSIX namespace. Use these in the - * header files exported to user space. - */ - -typedef __signed__ char __s8; -typedef unsigned char __u8; - -typedef __signed__ short __s16; -typedef unsigned short __u16; - -typedef __signed__ int __s32; -typedef unsigned int __u32; - -typedef __signed__ long __s64; -typedef unsigned long __u64; - #endif /* __ASSEMBLY__ */ #ifdef __KERNEL__ @@ -39,18 +23,6 @@ typedef unsigned long __u64; #ifndef __ASSEMBLY__ -typedef __signed__ char s8; -typedef unsigned char u8; - -typedef __signed__ short s16; -typedef unsigned short u16; - -typedef __signed__ int s32; -typedef unsigned int u32; - -typedef __signed__ long s64; -typedef unsigned long u64; - /* Dma addresses come in generic and 64-bit flavours. */ typedef u32 dma_addr_t; -- cgit v1.2.3 From a192da9afa00476ca27edf763922ab0b5d64246e Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Sun, 6 Apr 2008 10:35:13 -0700 Subject: v850: types: use for the v850 architecture This modifies to use the generic include files. Signed-off-by: H. Peter Anvin --- include/asm-v850/types.h | 32 +------------------------------- 1 file changed, 1 insertion(+), 31 deletions(-) diff --git a/include/asm-v850/types.h b/include/asm-v850/types.h index 284bda88211..89f735ee41d 100644 --- a/include/asm-v850/types.h +++ b/include/asm-v850/types.h @@ -10,28 +10,10 @@ * not a major issue. However, for interoperability, libraries still * need to be careful to avoid a name clashes. */ +#include typedef unsigned short umode_t; -/* - * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the - * header files exported to user space - */ - -typedef __signed__ char __s8; -typedef unsigned char __u8; - -typedef __signed__ short __s16; -typedef unsigned short __u16; - -typedef __signed__ int __s32; -typedef unsigned int __u32; - -#if defined(__GNUC__) -__extension__ typedef __signed__ long long __s64; -__extension__ typedef unsigned long long __u64; -#endif - #endif /* !__ASSEMBLY__ */ /* @@ -43,18 +25,6 @@ __extension__ typedef unsigned long long __u64; #ifndef __ASSEMBLY__ -typedef signed char s8; -typedef unsigned char u8; - -typedef signed short s16; -typedef unsigned short u16; - -typedef signed int s32; -typedef unsigned int u32; - -typedef signed long long s64; -typedef unsigned long long u64; - /* Dma addresses are 32-bits wide. */ typedef u32 dma_addr_t; -- cgit v1.2.3 From edfa5cfa3dc5bfa95e6aa82a2b8904e7f6c35ed7 Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Sun, 6 Apr 2008 10:35:14 -0700 Subject: x86: types: use for the x86 architecture This modifies to use the generic include files. Signed-off-by: H. Peter Anvin Cc: H. Peter Anvin Cc: Ingo Molnar Cc: Thomas Gleixner --- include/asm-x86/types.h | 38 ++------------------------------------ 1 file changed, 2 insertions(+), 36 deletions(-) diff --git a/include/asm-x86/types.h b/include/asm-x86/types.h index 63733f31568..1ac80cd9acf 100644 --- a/include/asm-x86/types.h +++ b/include/asm-x86/types.h @@ -1,34 +1,12 @@ #ifndef _ASM_X86_TYPES_H #define _ASM_X86_TYPES_H +#include + #ifndef __ASSEMBLY__ typedef unsigned short umode_t; -/* - * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the - * header files exported to user space - */ - -typedef __signed__ char __s8; -typedef unsigned char __u8; - -typedef __signed__ short __s16; -typedef unsigned short __u16; - -typedef __signed__ int __s32; -typedef unsigned int __u32; - -#ifdef __i386__ -# ifdef __GNUC__ -__extension__ typedef __signed__ long long __s64; -__extension__ typedef unsigned long long __u64; -# endif -#else -typedef __signed__ long long __s64; -typedef unsigned long long __u64; -#endif - #endif /* __ASSEMBLY__ */ /* @@ -44,18 +22,6 @@ typedef unsigned long long __u64; #ifndef __ASSEMBLY__ -typedef signed char s8; -typedef unsigned char u8; - -typedef signed short s16; -typedef unsigned short u16; - -typedef signed int s32; -typedef unsigned int u32; - -typedef signed long long s64; -typedef unsigned long long u64; - typedef u64 dma64_addr_t; #if defined(CONFIG_X86_64) || defined(CONFIG_HIGHMEM64G) /* DMA addresses come in 32-bit and 64-bit flavours. */ -- cgit v1.2.3 From 4cf63c8ac48c63b4c55669d4648506ed2bb8976f Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Sun, 6 Apr 2008 10:35:15 -0700 Subject: xtensa: types: use for the xtensa architecture This modifies to use the generic include files. Signed-off-by: H. Peter Anvin Cc: Chris Zankel --- include/asm-xtensa/types.h | 33 +-------------------------------- 1 file changed, 1 insertion(+), 32 deletions(-) diff --git a/include/asm-xtensa/types.h b/include/asm-xtensa/types.h index b27d841a8eb..c89569a8da0 100644 --- a/include/asm-xtensa/types.h +++ b/include/asm-xtensa/types.h @@ -11,6 +11,7 @@ #ifndef _XTENSA_TYPES_H #define _XTENSA_TYPES_H +#include #ifdef __ASSEMBLY__ # define __XTENSA_UL(x) (x) @@ -24,43 +25,11 @@ typedef unsigned short umode_t; -/* - * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the - * header files exported to user space - */ - -typedef __signed__ char __s8; -typedef unsigned char __u8; - -typedef __signed__ short __s16; -typedef unsigned short __u16; - -typedef __signed__ int __s32; -typedef unsigned int __u32; - -#if defined(__GNUC__) -__extension__ typedef __signed__ long long __s64; -__extension__ typedef unsigned long long __u64; -#endif - /* * These aren't exported outside the kernel to avoid name space clashes */ #ifdef __KERNEL__ -typedef __signed__ char s8; -typedef unsigned char u8; - -typedef __signed__ short s16; -typedef unsigned short u16; - -typedef __signed__ int s32; -typedef unsigned int u32; - -typedef __signed__ long long s64; -typedef unsigned long long u64; - - #define BITS_PER_LONG 32 /* Dma addresses are 32-bits wide. */ -- cgit v1.2.3 From c25bd29805f4d854c3a0b4176813f3c1bff569d3 Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Thu, 24 Apr 2008 13:37:33 -0700 Subject: types: add C99-style constructors to Add C99-style constructor macros for fixed types to . Since Linux uses names like "u64" instead of "uint64_t", the constructor macros are called U64_C() instead of UINT64_C() and so forth. These macros allow specific sizes to be specified as U64_C(0x123456789abcdef), without gcc issuing warnings as it will if one writes (u64)0x123456789abcdef. When used from assembly, these macros pass their argument unchanged. Signed-off-by: H. Peter Anvin --- include/asm-generic/int-l64.h | 20 ++++++++++++++++++++ include/asm-generic/int-ll64.h | 20 ++++++++++++++++++++ 2 files changed, 40 insertions(+) diff --git a/include/asm-generic/int-l64.h b/include/asm-generic/int-l64.h index 629b5a43f0b..2af9b75d77d 100644 --- a/include/asm-generic/int-l64.h +++ b/include/asm-generic/int-l64.h @@ -44,6 +44,26 @@ typedef unsigned int u32; typedef signed long s64; typedef unsigned long u64; +#define S8_C(x) x +#define U8_C(x) x ## U +#define S16_C(x) x +#define U16_C(x) x ## U +#define S32_C(x) x +#define U32_C(x) x ## U +#define S64_C(x) x ## L +#define U64_C(x) x ## UL + +#else /* __ASSEMBLY__ */ + +#define S8_C(x) x +#define U8_C(x) x +#define S16_C(x) x +#define U16_C(x) x +#define S32_C(x) x +#define U32_C(x) x +#define S64_C(x) x +#define U64_C(x) x + #endif /* __ASSEMBLY__ */ #endif /* __KERNEL__ */ diff --git a/include/asm-generic/int-ll64.h b/include/asm-generic/int-ll64.h index 1e5ffec0575..260948905e4 100644 --- a/include/asm-generic/int-ll64.h +++ b/include/asm-generic/int-ll64.h @@ -49,6 +49,26 @@ typedef unsigned int u32; typedef signed long long s64; typedef unsigned long long u64; +#define S8_C(x) x +#define U8_C(x) x ## U +#define S16_C(x) x +#define U16_C(x) x ## U +#define S32_C(x) x +#define U32_C(x) x ## U +#define S64_C(x) x ## LL +#define U64_C(x) x ## ULL + +#else /* __ASSEMBLY__ */ + +#define S8_C(x) x +#define U8_C(x) x +#define S16_C(x) x +#define U16_C(x) x +#define S32_C(x) x +#define U32_C(x) x +#define S64_C(x) x +#define U64_C(x) x + #endif /* __ASSEMBLY__ */ #endif /* __KERNEL__ */ -- cgit v1.2.3 From b9095fd8a7f41dc7ac0b0b7864f74766a3056f96 Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Fri, 2 May 2008 16:18:42 -0700 Subject: Make constants in kernel/timeconst.h fixed 64 bits Force constants in kernel/timeconst.h (except shift counts) to be 64 bits, using U64_C() constructor macros, and eliminate constants that cannot be represented at all in 64 bits. This avoids warnings with some gcc versions. Drop generating 64-bit constants, since we have no real hope of getting a full set (operation on 64-bit values requires a 128-bit intermediate result, which gcc only supports on 64-bit platforms, and only with libgcc support on some.) Note that the use of these constants does not depend on if we are on a 32- or 64-bit architecture. This resolves Bugzilla 10153. Signed-off-by: H. Peter Anvin --- kernel/time.c | 8 ++-- kernel/timeconst.pl | 120 +++++++++++++++++++++------------------------------- 2 files changed, 52 insertions(+), 76 deletions(-) diff --git a/kernel/time.c b/kernel/time.c index cbe0d5a222f..6a08660b4fa 100644 --- a/kernel/time.c +++ b/kernel/time.c @@ -246,7 +246,7 @@ unsigned int inline jiffies_to_msecs(const unsigned long j) return (j + (HZ / MSEC_PER_SEC) - 1)/(HZ / MSEC_PER_SEC); #else # if BITS_PER_LONG == 32 - return ((u64)HZ_TO_MSEC_MUL32 * j) >> HZ_TO_MSEC_SHR32; + return (HZ_TO_MSEC_MUL32 * j) >> HZ_TO_MSEC_SHR32; # else return (j * HZ_TO_MSEC_NUM) / HZ_TO_MSEC_DEN; # endif @@ -262,7 +262,7 @@ unsigned int inline jiffies_to_usecs(const unsigned long j) return (j + (HZ / USEC_PER_SEC) - 1)/(HZ / USEC_PER_SEC); #else # if BITS_PER_LONG == 32 - return ((u64)HZ_TO_USEC_MUL32 * j) >> HZ_TO_USEC_SHR32; + return (HZ_TO_USEC_MUL32 * j) >> HZ_TO_USEC_SHR32; # else return (j * HZ_TO_USEC_NUM) / HZ_TO_USEC_DEN; # endif @@ -476,7 +476,7 @@ unsigned long msecs_to_jiffies(const unsigned int m) if (HZ > MSEC_PER_SEC && m > jiffies_to_msecs(MAX_JIFFY_OFFSET)) return MAX_JIFFY_OFFSET; - return ((u64)MSEC_TO_HZ_MUL32 * m + MSEC_TO_HZ_ADJ32) + return (MSEC_TO_HZ_MUL32 * m + MSEC_TO_HZ_ADJ32) >> MSEC_TO_HZ_SHR32; #endif } @@ -491,7 +491,7 @@ unsigned long usecs_to_jiffies(const unsigned int u) #elif HZ > USEC_PER_SEC && !(HZ % USEC_PER_SEC) return u * (HZ / USEC_PER_SEC); #else - return ((u64)USEC_TO_HZ_MUL32 * u + USEC_TO_HZ_ADJ32) + return (USEC_TO_HZ_MUL32 * u + USEC_TO_HZ_ADJ32) >> USEC_TO_HZ_SHR32; #endif } diff --git a/kernel/timeconst.pl b/kernel/timeconst.pl index 41468035473..eb51d76e058 100644 --- a/kernel/timeconst.pl +++ b/kernel/timeconst.pl @@ -1,7 +1,7 @@ #!/usr/bin/perl # ----------------------------------------------------------------------- # -# Copyright 2007 rPath, Inc. - All Rights Reserved +# Copyright 2007-2008 rPath, Inc. - All Rights Reserved # # This file is part of the Linux kernel, and is made available under # the terms of the GNU General Public License version 2 or (at your @@ -20,198 +20,138 @@ %canned_values = ( 24 => [ '0xa6aaaaab','0x2aaaaaa',26, - '0xa6aaaaaaaaaaaaab','0x2aaaaaaaaaaaaaa',58, 125,3, '0xc49ba5e4','0x1fbe76c8b4',37, - '0xc49ba5e353f7ceda','0x1fbe76c8b439581062',69, 3,125, '0xa2c2aaab','0xaaaa',16, - '0xa2c2aaaaaaaaaaab','0xaaaaaaaaaaaa',48, 125000,3, '0xc9539b89','0x7fffbce4217d',47, - '0xc9539b8887229e91','0x7fffbce4217d2849cb25',79, 3,125000, ], 32 => [ '0xfa000000','0x6000000',27, - '0xfa00000000000000','0x600000000000000',59, 125,4, '0x83126e98','0xfdf3b645a',36, - '0x83126e978d4fdf3c','0xfdf3b645a1cac0831',68, 4,125, '0xf4240000','0x0',17, - '0xf424000000000000','0x0',49, 31250,1, '0x8637bd06','0x3fff79c842fa',46, - '0x8637bd05af6c69b6','0x3fff79c842fa5093964a',78, 1,31250, ], 48 => [ '0xa6aaaaab','0x6aaaaaa',27, - '0xa6aaaaaaaaaaaaab','0x6aaaaaaaaaaaaaa',59, 125,6, '0xc49ba5e4','0xfdf3b645a',36, - '0xc49ba5e353f7ceda','0xfdf3b645a1cac0831',68, 6,125, '0xa2c2aaab','0x15555',17, - '0xa2c2aaaaaaaaaaab','0x1555555555555',49, 62500,3, '0xc9539b89','0x3fffbce4217d',46, - '0xc9539b8887229e91','0x3fffbce4217d2849cb25',78, 3,62500, ], 64 => [ '0xfa000000','0xe000000',28, - '0xfa00000000000000','0xe00000000000000',60, 125,8, '0x83126e98','0x7ef9db22d',35, - '0x83126e978d4fdf3c','0x7ef9db22d0e560418',67, 8,125, '0xf4240000','0x0',18, - '0xf424000000000000','0x0',50, 15625,1, '0x8637bd06','0x1fff79c842fa',45, - '0x8637bd05af6c69b6','0x1fff79c842fa5093964a',77, 1,15625, ], 100 => [ '0xa0000000','0x0',28, - '0xa000000000000000','0x0',60, 10,1, '0xcccccccd','0x733333333',35, - '0xcccccccccccccccd','0x73333333333333333',67, 1,10, '0x9c400000','0x0',18, - '0x9c40000000000000','0x0',50, 10000,1, '0xd1b71759','0x1fff2e48e8a7',45, - '0xd1b71758e219652c','0x1fff2e48e8a71de69ad4',77, 1,10000, ], 122 => [ '0x8325c53f','0xfbcda3a',28, - '0x8325c53ef368eb05','0xfbcda3ac10c9714',60, 500,61, '0xf9db22d1','0x7fbe76c8b',35, - '0xf9db22d0e560418a','0x7fbe76c8b43958106',67, 61,500, '0x8012e2a0','0x3ef36',18, - '0x8012e29f79b47583','0x3ef368eb04325',50, 500000,61, '0xffda4053','0x1ffffbce4217',45, - '0xffda4052d666a983','0x1ffffbce4217d2849cb2',77, 61,500000, ], 128 => [ '0xfa000000','0x1e000000',29, - '0xfa00000000000000','0x1e00000000000000',61, 125,16, '0x83126e98','0x3f7ced916',34, - '0x83126e978d4fdf3c','0x3f7ced916872b020c',66, 16,125, '0xf4240000','0x40000',19, - '0xf424000000000000','0x4000000000000',51, 15625,2, '0x8637bd06','0xfffbce4217d',44, - '0x8637bd05af6c69b6','0xfffbce4217d2849cb25',76, 2,15625, ], 200 => [ '0xa0000000','0x0',29, - '0xa000000000000000','0x0',61, 5,1, '0xcccccccd','0x333333333',34, - '0xcccccccccccccccd','0x33333333333333333',66, 1,5, '0x9c400000','0x0',19, - '0x9c40000000000000','0x0',51, 5000,1, '0xd1b71759','0xfff2e48e8a7',44, - '0xd1b71758e219652c','0xfff2e48e8a71de69ad4',76, 1,5000, ], 250 => [ '0x80000000','0x0',29, - '0x8000000000000000','0x0',61, 4,1, '0x80000000','0x180000000',33, - '0x8000000000000000','0x18000000000000000',65, 1,4, '0xfa000000','0x0',20, - '0xfa00000000000000','0x0',52, 4000,1, '0x83126e98','0x7ff7ced9168',43, - '0x83126e978d4fdf3c','0x7ff7ced916872b020c4',75, 1,4000, ], 256 => [ '0xfa000000','0x3e000000',30, - '0xfa00000000000000','0x3e00000000000000',62, 125,32, '0x83126e98','0x1fbe76c8b',33, - '0x83126e978d4fdf3c','0x1fbe76c8b43958106',65, 32,125, '0xf4240000','0xc0000',20, - '0xf424000000000000','0xc000000000000',52, 15625,4, '0x8637bd06','0x7ffde7210be',43, - '0x8637bd05af6c69b6','0x7ffde7210be9424e592',75, 4,15625, ], 300 => [ '0xd5555556','0x2aaaaaaa',30, - '0xd555555555555556','0x2aaaaaaaaaaaaaaa',62, 10,3, '0x9999999a','0x1cccccccc',33, - '0x999999999999999a','0x1cccccccccccccccc',65, 3,10, '0xd0555556','0xaaaaa',20, - '0xd055555555555556','0xaaaaaaaaaaaaa',52, 10000,3, '0x9d495183','0x7ffcb923a29',43, - '0x9d495182a9930be1','0x7ffcb923a29c779a6b5',75, 3,10000, ], 512 => [ '0xfa000000','0x7e000000',31, - '0xfa00000000000000','0x7e00000000000000',63, 125,64, '0x83126e98','0xfdf3b645',32, - '0x83126e978d4fdf3c','0xfdf3b645a1cac083',64, 64,125, '0xf4240000','0x1c0000',21, - '0xf424000000000000','0x1c000000000000',53, 15625,8, '0x8637bd06','0x3ffef39085f',42, - '0x8637bd05af6c69b6','0x3ffef39085f4a1272c9',74, 8,15625, ], 1000 => [ '0x80000000','0x0',31, - '0x8000000000000000','0x0',63, 1,1, '0x80000000','0x0',31, - '0x8000000000000000','0x0',63, 1,1, '0xfa000000','0x0',22, - '0xfa00000000000000','0x0',54, 1000,1, '0x83126e98','0x1ff7ced9168',41, - '0x83126e978d4fdf3c','0x1ff7ced916872b020c4',73, 1,1000, ], 1024 => [ '0xfa000000','0xfe000000',32, - '0xfa00000000000000','0xfe00000000000000',64, 125,128, '0x83126e98','0x7ef9db22',31, - '0x83126e978d4fdf3c','0x7ef9db22d0e56041',63, 128,125, '0xf4240000','0x3c0000',22, - '0xf424000000000000','0x3c000000000000',54, 15625,16, '0x8637bd06','0x1fff79c842f',41, - '0x8637bd05af6c69b6','0x1fff79c842fa5093964',73, 16,15625, ], 1200 => [ '0xd5555556','0xd5555555',32, - '0xd555555555555556','0xd555555555555555',64, 5,6, '0x9999999a','0x66666666',31, - '0x999999999999999a','0x6666666666666666',63, 6,5, '0xd0555556','0x2aaaaa',22, - '0xd055555555555556','0x2aaaaaaaaaaaaa',54, 2500,3, '0x9d495183','0x1ffcb923a29',41, - '0x9d495182a9930be1','0x1ffcb923a29c779a6b5',73, 3,2500, ] ); @@ -264,6 +204,15 @@ sub fmuls($$$) { return 0; } +# Generate a hex value if the result fits in 64 bits; +# otherwise skip. +sub bignum_hex($) { + my($x) = @_; + my $s = $x->as_hex(); + + return (length($s) > 18) ? undef : $s; +} + # Provides mul, adj, and shr factors for a specific # (bit, time, hz) combination sub muladj($$$) { @@ -271,7 +220,7 @@ sub muladj($$$) { my $s = fmuls($b, $t, $hz); my $m = fmul($s, $t, $hz); my $a = fadj($s, $t, $hz); - return ($m->as_hex(), $a->as_hex(), $s); + return (bignum_hex($m), bignum_hex($a), $s); } # Provides numerator, denominator values @@ -288,12 +237,10 @@ sub conversions($$) { # HZ_TO_xx push(@val, muladj(32, $t, $hz)); - push(@val, muladj(64, $t, $hz)); push(@val, numden($t, $hz)); # xx_TO_HZ push(@val, muladj(32, $hz, $t)); - push(@val, muladj(64, $hz, $t)); push(@val, numden($hz, $t)); return @val; @@ -318,6 +265,19 @@ sub compute_values($) { return @val; } +sub outputval($$) +{ + my($name, $val) = @_; + my $csuf; + + if (defined($val)) { + if ($name !~ /SHR/) { + $val = "U64_C($val)"; + } + printf "#define %-23s %s\n", $name.$csuf, $val.$csuf; + } +} + sub output($@) { my($hz, @val) = @_; @@ -331,6 +291,7 @@ sub output($@) print "\n"; print "#include \n"; + print "#include \n"; print "\n"; print "#if HZ != $hz\n"; @@ -340,15 +301,13 @@ sub output($@) foreach $pfx ('HZ_TO_MSEC','MSEC_TO_HZ', 'HZ_TO_USEC','USEC_TO_HZ') { - foreach $bit (32, 64) { + foreach $bit (32) { foreach $suf ('MUL', 'ADJ', 'SHR') { - printf "#define %-23s %s\n", - "${pfx}_$suf$bit", shift(@val); + outputval("${pfx}_$suf$bit", shift(@val)); } } foreach $suf ('NUM', 'DEN') { - printf "#define %-23s %s\n", - "${pfx}_$suf", shift(@val); + outputval("${pfx}_$suf", shift(@val)); } } @@ -356,6 +315,23 @@ sub output($@) print "#endif /* KERNEL_TIMECONST_H */\n"; } +# Pretty-print Perl values +sub perlvals(@) { + my $v; + my @l = (); + + foreach $v (@_) { + if (!defined($v)) { + push(@l, 'undef'); + } elsif ($v =~ /^0x/) { + push(@l, "\'".$v."\'"); + } else { + push(@l, $v.''); + } + } + return join(',', @l); +} + ($hz) = @ARGV; # Use this to generate the %canned_values structure @@ -373,15 +349,15 @@ if ($hz eq '--can') { print "$pf$hz => [\n"; while (scalar(@values)) { my $bit; - foreach $bit (32, 64) { + foreach $bit (32) { my $m = shift(@values); my $a = shift(@values); my $s = shift(@values); - print "\t\t\'",$m,"\',\'",$a,"\',",$s,",\n"; + print "\t\t", perlvals($m,$a,$s), ",\n"; } my $n = shift(@values); my $d = shift(@values); - print "\t\t",$n,',',$d,",\n"; + print "\t\t", perlvals($n,$d), ",\n"; } print "\t]"; $pf = ', '; -- cgit v1.2.3