diff options
-rw-r--r-- | include/asm-alpha/types.h | 36 | ||||
-rw-r--r-- | include/asm-arm/types.h | 33 | ||||
-rw-r--r-- | include/asm-avr32/types.h | 32 | ||||
-rw-r--r-- | include/asm-blackfin/types.h | 34 | ||||
-rw-r--r-- | include/asm-cris/types.h | 33 | ||||
-rw-r--r-- | include/asm-frv/types.h | 34 | ||||
-rw-r--r-- | include/asm-generic/Kbuild | 2 | ||||
-rw-r--r-- | include/asm-generic/int-l64.h | 71 | ||||
-rw-r--r-- | include/asm-generic/int-ll64.h | 76 | ||||
-rw-r--r-- | include/asm-h8300/types.h | 33 | ||||
-rw-r--r-- | include/asm-ia64/types.h | 31 | ||||
-rw-r--r-- | include/asm-m32r/types.h | 32 | ||||
-rw-r--r-- | include/asm-m68k/types.h | 32 | ||||
-rw-r--r-- | include/asm-mips/types.h | 56 | ||||
-rw-r--r-- | include/asm-mn10300/types.h | 33 | ||||
-rw-r--r-- | include/asm-parisc/types.h | 33 | ||||
-rw-r--r-- | include/asm-powerpc/types.h | 48 | ||||
-rw-r--r-- | include/asm-s390/types.h | 48 | ||||
-rw-r--r-- | include/asm-sh/types.h | 34 | ||||
-rw-r--r-- | include/asm-sparc/types.h | 30 | ||||
-rw-r--r-- | include/asm-sparc64/types.h | 30 | ||||
-rw-r--r-- | include/asm-v850/types.h | 32 | ||||
-rw-r--r-- | include/asm-x86/types.h | 38 | ||||
-rw-r--r-- | include/asm-xtensa/types.h | 33 | ||||
-rw-r--r-- | kernel/time.c | 8 | ||||
-rw-r--r-- | kernel/timeconst.pl | 120 |
26 files changed, 249 insertions, 773 deletions
diff --git a/include/asm-alpha/types.h b/include/asm-alpha/types.h index f5716139ec89..a9e34ca4d463 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 <asm-generic/int-l64.h> #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 */ diff --git a/include/asm-arm/types.h b/include/asm-arm/types.h index 3141451a9bd6..345df01534a4 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 <asm-generic/int-ll64.h> + #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; diff --git a/include/asm-avr32/types.h b/include/asm-avr32/types.h index 8999a3819403..9cefda6f534a 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 <asm-generic/int-ll64.h> + #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; diff --git a/include/asm-blackfin/types.h b/include/asm-blackfin/types.h index 9785a6d531c6..8441cbc2bf9e 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 <asm-generic/int-ll64.h> + #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; diff --git a/include/asm-cris/types.h b/include/asm-cris/types.h index 5a21c42bc6c5..5790262cbe8a 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 <asm-generic/int-ll64.h> + #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; diff --git a/include/asm-frv/types.h b/include/asm-frv/types.h index 767e5ed71c4b..613bf1e962f0 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 <asm-generic/int-ll64.h> + #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; diff --git a/include/asm-generic/Kbuild b/include/asm-generic/Kbuild index c18110ee30f1..4c9932a2503f 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 000000000000..2af9b75d77db --- /dev/null +++ b/include/asm-generic/int-l64.h @@ -0,0 +1,71 @@ +/* + * 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; + +#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__ */ + +#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 000000000000..260948905e4e --- /dev/null +++ b/include/asm-generic/int-ll64.h @@ -0,0 +1,76 @@ +/* + * 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; + +#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__ */ + +#endif /* _ASM_GENERIC_INT_LL64_H */ diff --git a/include/asm-h8300/types.h b/include/asm-h8300/types.h index 56566e2a09fd..12875190b156 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 <asm-generic/int-ll64.h> + #if !defined(__ASSEMBLY__) /* @@ -14,41 +16,10 @@ 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. */ diff --git a/include/asm-ia64/types.h b/include/asm-ia64/types.h index 902850d12424..e36b3716e718 100644 --- a/include/asm-ia64/types.h +++ b/include/asm-ia64/types.h @@ -13,6 +13,8 @@ * David Mosberger-Tang <davidm@hpl.hp.com>, Hewlett-Packard Co */ +#include <asm-generic/int-l64.h> + #ifdef __ASSEMBLY__ # define __IA64_UL(x) (x) # define __IA64_UL_CONST(x) x @@ -28,39 +30,10 @@ 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. */ diff --git a/include/asm-m32r/types.h b/include/asm-m32r/types.h index b64c16639a7b..bc9f7fff0ac3 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 <asm-generic/int-ll64.h> + #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; diff --git a/include/asm-m68k/types.h b/include/asm-m68k/types.h index c35c09d93b66..6441cb5f8e7c 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 <asm-generic/int-ll64.h> #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; diff --git a/include/asm-mips/types.h b/include/asm-mips/types.h index 2dd147f519d1..7a2ee4f40131 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 <asm-generic/int-l64.h> +#else +# include <asm-generic/int-ll64.h> +#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; diff --git a/include/asm-mn10300/types.h b/include/asm-mn10300/types.h index d40ea7628bfc..7b9f01042fd4 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 <asm-generic/int-ll64.h> + #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; diff --git a/include/asm-parisc/types.h b/include/asm-parisc/types.h index 56c84802da59..7f5a39bfb4ce 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 <asm-generic/int-ll64.h> + #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; diff --git a/include/asm-powerpc/types.h b/include/asm-powerpc/types.h index c243a6ac60e5..d3374bc865ba 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 <asm-generic/int-l64.h> +#else +# include <asm-generic/int-ll64.h> +#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 */ diff --git a/include/asm-s390/types.h b/include/asm-s390/types.h index 2c5879ae90ca..78dda038dd47 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 <asm-generic/int-l64.h> +#else +# include <asm-generic/int-ll64.h> +#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__ diff --git a/include/asm-sh/types.h b/include/asm-sh/types.h index a6e1d4126e67..beea4e6f8dfd 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 <asm-generic/int-ll64.h> + #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; diff --git a/include/asm-sparc/types.h b/include/asm-sparc/types.h index 42fc6ed98156..1b08ef860a66 100644 --- a/include/asm-sparc/types.h +++ b/include/asm-sparc/types.h @@ -3,34 +3,18 @@ #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 * application is Linux specific so (user-) name space pollution is * not a major issue. However, for interoperability, libraries still * need to be careful to avoid a name clashes. */ +#include <asm-generic/int-ll64.h> #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; diff --git a/include/asm-sparc64/types.h b/include/asm-sparc64/types.h index d0ee7f105838..5dbe04f4044a 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 <asm-generic/int-l64.h> #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; diff --git a/include/asm-v850/types.h b/include/asm-v850/types.h index 284bda882112..89f735ee41dd 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 <asm-generic/int-ll64.h> 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; diff --git a/include/asm-x86/types.h b/include/asm-x86/types.h index 63733f315688..1ac80cd9acf8 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 <asm-generic/int-ll64.h> + #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. */ diff --git a/include/asm-xtensa/types.h b/include/asm-xtensa/types.h index b27d841a8eb7..c89569a8da0c 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 <asm-generic/int-ll64.h> #ifdef __ASSEMBLY__ # define __XTENSA_UL(x) (x) @@ -25,42 +26,10 @@ 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. */ diff --git a/kernel/time.c b/kernel/time.c index cbe0d5a222ff..6a08660b4fac 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 41468035473c..eb51d76e058a 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 <linux/param.h>\n"; + print "#include <linux/types.h>\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 = ', '; |