All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Snook <csnook@redhat.com>
To: andi@firstfloor.org
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] x86: mostly merge types.h
Date: Fri, 19 Oct 2007 02:09:29 -0400	[thread overview]
Message-ID: <20071019060929.GA16291@shell.boston.redhat.com> (raw)

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 */


             reply	other threads:[~2007-10-19  6:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-19  6:09 Chris Snook [this message]
2007-10-19  7:02 ` [PATCH] x86: mostly merge types.h Thomas Gleixner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20071019060929.GA16291@shell.boston.redhat.com \
    --to=csnook@redhat.com \
    --cc=andi@firstfloor.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.