public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86: mostly merge types.h
@ 2007-10-19  6:09 Chris Snook
  2007-10-19  7:02 ` Thomas Gleixner
  0 siblings, 1 reply; 2+ messages in thread
From: Chris Snook @ 2007-10-19  6:09 UTC (permalink / raw)
  To: andi; +Cc: linux-kernel

From: Chris Snook <csnook@redhat.com>

Most of types_32.h and types_64.h are the same.  Merge the common definitions
into types.h, keeping the differences in their own files.  Also #error if
types_{32,64}.h is included directly.  Tested with allmodconfig on x86_64.

Signed-off-by: Chris Snook <csnook@redhat.com>

 types.h    |   45 +++++++++++++++++++++++++++++++++++++++++++++
 types_32.h |   48 ++++++------------------------------------------
 types_64.h |   47 +++++++----------------------------------------
 3 files changed, 58 insertions(+), 82 deletions(-)

diff -urp a/include/asm-x86/types_32.h b/include/asm-x86/types_32.h
--- a/include/asm-x86/types_32.h	2007-10-18 04:23:36.000000000 -0400
+++ b/include/asm-x86/types_32.h	2007-10-18 07:03:05.000000000 -0400
@@ -1,64 +1,28 @@
 #ifndef _I386_TYPES_H
 #define _I386_TYPES_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;
+#ifndef _X86_TYPES_H
+#error Do not include this file directly.  Use asm/types.h instead.
+#endif
 
-#if defined(__GNUC__)
+#if !defined(__ASSEMBLY__) && 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
- */
 #ifdef __KERNEL__
 
 #define BITS_PER_LONG 32
 
 #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 come in generic and 64-bit flavours.  */
-
+/* DMA addresses come in generic and 64-bit flavours. */
 #ifdef CONFIG_HIGHMEM64G
 typedef u64 dma_addr_t;
 #else
 typedef u32 dma_addr_t;
 #endif
-typedef u64 dma64_addr_t;
 
 #endif /* __ASSEMBLY__ */
-
 #endif /* __KERNEL__ */
-
-#endif
+#endif /* _I386_TYPES_H */
diff -urp a/include/asm-x86/types_64.h b/include/asm-x86/types_64.h
--- a/include/asm-x86/types_64.h	2007-10-18 04:23:36.000000000 -0400
+++ b/include/asm-x86/types_64.h	2007-10-18 07:03:11.000000000 -0400
@@ -1,55 +1,22 @@
 #ifndef _X86_64_TYPES_H
 #define _X86_64_TYPES_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;
+#ifndef _X86_TYPES_H
+#error Do not include this file directly.  Use asm/types.h instead.
+#endif
 
+#ifndef __ASSEMBLY__
 typedef __signed__ long long __s64;
 typedef unsigned long long  __u64;
+#endif
 
-#endif /* __ASSEMBLY__ */
-
-/*
- * These aren't exported outside the kernel to avoid name space clashes
- */
 #ifdef __KERNEL__
 
 #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 long s64;
-typedef unsigned long long u64;
-
-typedef u64 dma64_addr_t;
 typedef u64 dma_addr_t;
-
-#endif /* __ASSEMBLY__ */
+#endif
 
 #endif /* __KERNEL__ */
-
-#endif
+#endif /* _X86_64_TYPES_H */
diff -urp a/include/asm-x86/types.h b/include/asm-x86/types.h
--- a/include/asm-x86/types.h	2007-10-18 04:23:36.000000000 -0400
+++ b/include/asm-x86/types.h	2007-10-18 06:59:37.000000000 -0400
@@ -1,3 +1,46 @@
+#ifndef _X86_TYPES_H
+#define _X86_TYPES_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;
+
+/*
+ * 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;
+
+typedef u64 dma64_addr_t;
+
+#endif /* __KERNEL__ */
+#endif /* __ASSEMBLY__ */
+
 #ifdef __KERNEL__
 # ifdef CONFIG_X86_32
 #  include "types_32.h"
@@ -11,3 +54,5 @@
 #  include "types_64.h"
 # endif
 #endif
+
+#endif /* _X86_TYPES_H */


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] x86: mostly merge types.h
  2007-10-19  6:09 [PATCH] x86: mostly merge types.h Chris Snook
@ 2007-10-19  7:02 ` Thomas Gleixner
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Gleixner @ 2007-10-19  7:02 UTC (permalink / raw)
  To: Chris Snook; +Cc: andi, linux-kernel

On Fri, 19 Oct 2007, Chris Snook wrote:
> From: Chris Snook <csnook@redhat.com>
> 
> Most of types_32.h and types_64.h are the same.  Merge the common definitions
> into types.h, keeping the differences in their own files.  Also #error if
> types_{32,64}.h is included directly.  Tested with allmodconfig on x86_64.

Sorry, your patch is late:

http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=9d256ff51c174d8b157d99db038a1045f37a17c8

And we really want to eliminate the _32/64 variants completely when
ever it is possible.

Thanks,

	tglx

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-10-19  7:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-19  6:09 [PATCH] x86: mostly merge types.h Chris Snook
2007-10-19  7:02 ` Thomas Gleixner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox