* [PATCH 4/8] kernel: move arches that use the generic_le/be helpers
@ 2008-04-10 19:44 Harvey Harrison
2008-04-10 19:44 ` Harvey Harrison
[not found] ` <20080410203708.GA28014@linux-mips.org>
0 siblings, 2 replies; 4+ messages in thread
From: Harvey Harrison @ 2008-04-10 19:44 UTC (permalink / raw)
To: Andrew Morton
Cc: linux-arch, rth-hL46jP5Bxq7R7s880joybQ@public.gmane.org, wli,
David Miller, Bryan Wu, tony.luck, Geert Uytterhoeven,
Roman Zippel, ralf-6z/3iImG2C8G8FEW9MqTrA@public.gmane.org,
Matthew Wilcox, Paul Mundt
Generic le:
alpha, blackfin, ia64,
Generic be:
parisc, sparc, sparc64
Chooses endianness based on compiler settings, either generic_le or be:
mips, sh
m86knommu is generic_be for Coldfire, otherwise unaligned access is ok.
Signed-off-by: Harvey Harrison <harvey.harrison-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
include/asm-alpha/unaligned.h | 2 +-
include/asm-avr32/unaligned.h | 2 +-
include/asm-blackfin/unaligned.h | 2 +-
include/asm-ia64/unaligned.h | 2 +-
include/asm-m68knommu/unaligned.h | 10 ++--------
include/asm-mips/unaligned.h | 29 ++++++++++-------------------
include/asm-parisc/unaligned.h | 2 +-
include/asm-sh/unaligned.h | 6 +++++-
include/asm-sparc/unaligned.h | 2 +-
include/asm-sparc64/unaligned.h | 2 +-
10 files changed, 24 insertions(+), 35 deletions(-)
diff --git a/include/asm-alpha/unaligned.h b/include/asm-alpha/unaligned.h
index a1d7284..18acc19 100644
--- a/include/asm-alpha/unaligned.h
+++ b/include/asm-alpha/unaligned.h
@@ -1,6 +1,6 @@
#ifndef __ALPHA_UNALIGNED_H
#define __ALPHA_UNALIGNED_H
-#include <asm-generic/unaligned.h>
+#include <linux/unaligned/generic_le.h>
#endif
diff --git a/include/asm-avr32/unaligned.h b/include/asm-avr32/unaligned.h
index 36f5fd4..28fa20e 100644
--- a/include/asm-avr32/unaligned.h
+++ b/include/asm-avr32/unaligned.h
@@ -11,6 +11,6 @@
* optimize word loads in general.
*/
-#include <asm-generic/unaligned.h>
+#include <linux/unaligned/generic_be.h>
#endif /* __ASM_AVR32_UNALIGNED_H */
diff --git a/include/asm-blackfin/unaligned.h b/include/asm-blackfin/unaligned.h
index 10081dc..25861cd 100644
--- a/include/asm-blackfin/unaligned.h
+++ b/include/asm-blackfin/unaligned.h
@@ -1,6 +1,6 @@
#ifndef __BFIN_UNALIGNED_H
#define __BFIN_UNALIGNED_H
-#include <asm-generic/unaligned.h>
+#include <linux/unaligned/generic_le.h>
#endif /* __BFIN_UNALIGNED_H */
diff --git a/include/asm-ia64/unaligned.h b/include/asm-ia64/unaligned.h
index bb85598..2134205 100644
--- a/include/asm-ia64/unaligned.h
+++ b/include/asm-ia64/unaligned.h
@@ -1,6 +1,6 @@
#ifndef _ASM_IA64_UNALIGNED_H
#define _ASM_IA64_UNALIGNED_H
-#include <asm-generic/unaligned.h>
+#include <linux/unaligned/generic_le.h>
#endif /* _ASM_IA64_UNALIGNED_H */
diff --git a/include/asm-m68knommu/unaligned.h b/include/asm-m68knommu/unaligned.h
index 869e9dd..6b5c7a2 100644
--- a/include/asm-m68knommu/unaligned.h
+++ b/include/asm-m68knommu/unaligned.h
@@ -4,19 +4,13 @@
#ifdef CONFIG_COLDFIRE
-#include <asm-generic/unaligned.h>
+#include <linux/unaligned/generic_be.h>
#else
/*
* The m68k can do unaligned accesses itself.
- *
- * The strange macros are there to make sure these can't
- * be misused in a way that makes them not work on other
- * architectures where unaligned accesses aren't as simple.
*/
-
-#define get_unaligned(ptr) (*(ptr))
-#define put_unaligned(val, ptr) ((void)( *(ptr) = (val) ))
+#include <linux/unaligned/access_ok.h>
#endif
diff --git a/include/asm-mips/unaligned.h b/include/asm-mips/unaligned.h
index 3249049..471e127 100644
--- a/include/asm-mips/unaligned.h
+++ b/include/asm-mips/unaligned.h
@@ -5,25 +5,16 @@
*
* Copyright (C) 2007 Ralf Baechle (ralf-6z/3iImG2C8G8FEW9MqTrA@public.gmane.org)
*/
-#ifndef __ASM_GENERIC_UNALIGNED_H
-#define __ASM_GENERIC_UNALIGNED_H
+#ifndef __ASM_MIPS_UNALIGNED_H
+#define __ASM_MIPS_UNALIGNED_H
#include <linux/compiler.h>
+#if defined(__MIPSEB__)
+# include <linux/unaligned/generic_be.h>
+#elif defined(__MIPSEL__)
+# include <linux/unaligned/generic_le.h>
+#else
+# error "MIPS, but neither __MIPSEB__, nor __MIPSEL__???"
+#endif
-#define get_unaligned(ptr) \
-({ \
- struct __packed { \
- typeof(*(ptr)) __v; \
- } *__p = (void *) (ptr); \
- __p->__v; \
-})
-
-#define put_unaligned(val, ptr) \
-do { \
- struct __packed { \
- typeof(*(ptr)) __v; \
- } *__p = (void *) (ptr); \
- __p->__v = (val); \
-} while(0)
-
-#endif /* __ASM_GENERIC_UNALIGNED_H */
+#endif /* __ASM_MIPS_UNALIGNED_H */
diff --git a/include/asm-parisc/unaligned.h b/include/asm-parisc/unaligned.h
index 53c9058..865867c 100644
--- a/include/asm-parisc/unaligned.h
+++ b/include/asm-parisc/unaligned.h
@@ -1,7 +1,7 @@
#ifndef _ASM_PARISC_UNALIGNED_H_
#define _ASM_PARISC_UNALIGNED_H_
-#include <asm-generic/unaligned.h>
+#include <linux/unaligned/generic_be.h>
#ifdef __KERNEL__
struct pt_regs;
diff --git a/include/asm-sh/unaligned.h b/include/asm-sh/unaligned.h
index 5250e30..391da8d 100644
--- a/include/asm-sh/unaligned.h
+++ b/include/asm-sh/unaligned.h
@@ -2,6 +2,10 @@
#define __ASM_SH_UNALIGNED_H
/* SH can't handle unaligned accesses. */
-#include <asm-generic/unaligned.h>
+#ifdef __LITTLE_ENDIAN__
+#include <linux/unaligned/generic_le.h>
+#else
+#include <linux/unaligned/generic_be.h>
+#endif
#endif /* __ASM_SH_UNALIGNED_H */
diff --git a/include/asm-sparc/unaligned.h b/include/asm-sparc/unaligned.h
index b6f8edd..9f1bb56 100644
--- a/include/asm-sparc/unaligned.h
+++ b/include/asm-sparc/unaligned.h
@@ -1,6 +1,6 @@
#ifndef _ASM_SPARC_UNALIGNED_H_
#define _ASM_SPARC_UNALIGNED_H_
-#include <asm-generic/unaligned.h>
+#include <linux/unaligned/generic_be.h>
#endif /* _ASM_SPARC_UNALIGNED_H */
diff --git a/include/asm-sparc64/unaligned.h b/include/asm-sparc64/unaligned.h
index 1ed3ba5..faa18cd 100644
--- a/include/asm-sparc64/unaligned.h
+++ b/include/asm-sparc64/unaligned.h
@@ -1,6 +1,6 @@
#ifndef _ASM_SPARC64_UNALIGNED_H_
#define _ASM_SPARC64_UNALIGNED_H_
-#include <asm-generic/unaligned.h>
+#include <linux/unaligned/generic_be.h>
#endif /* _ASM_SPARC64_UNALIGNED_H */
--
1.5.5.144.g3e42
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 4/8] kernel: move arches that use the generic_le/be helpers
2008-04-10 19:44 [PATCH 4/8] kernel: move arches that use the generic_le/be helpers Harvey Harrison
@ 2008-04-10 19:44 ` Harvey Harrison
[not found] ` <20080410203708.GA28014@linux-mips.org>
1 sibling, 0 replies; 4+ messages in thread
From: Harvey Harrison @ 2008-04-10 19:44 UTC (permalink / raw)
To: Andrew Morton
Cc: linux-arch, rth@twiddle.net, wli, David Miller, Bryan Wu,
tony.luck, Geert Uytterhoeven, Roman Zippel, ralf@linux-mips.org,
Matthew Wilcox, Paul Mundt
Generic le:
alpha, blackfin, ia64,
Generic be:
parisc, sparc, sparc64
Chooses endianness based on compiler settings, either generic_le or be:
mips, sh
m86knommu is generic_be for Coldfire, otherwise unaligned access is ok.
Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
---
include/asm-alpha/unaligned.h | 2 +-
include/asm-avr32/unaligned.h | 2 +-
include/asm-blackfin/unaligned.h | 2 +-
include/asm-ia64/unaligned.h | 2 +-
include/asm-m68knommu/unaligned.h | 10 ++--------
include/asm-mips/unaligned.h | 29 ++++++++++-------------------
include/asm-parisc/unaligned.h | 2 +-
include/asm-sh/unaligned.h | 6 +++++-
include/asm-sparc/unaligned.h | 2 +-
include/asm-sparc64/unaligned.h | 2 +-
10 files changed, 24 insertions(+), 35 deletions(-)
diff --git a/include/asm-alpha/unaligned.h b/include/asm-alpha/unaligned.h
index a1d7284..18acc19 100644
--- a/include/asm-alpha/unaligned.h
+++ b/include/asm-alpha/unaligned.h
@@ -1,6 +1,6 @@
#ifndef __ALPHA_UNALIGNED_H
#define __ALPHA_UNALIGNED_H
-#include <asm-generic/unaligned.h>
+#include <linux/unaligned/generic_le.h>
#endif
diff --git a/include/asm-avr32/unaligned.h b/include/asm-avr32/unaligned.h
index 36f5fd4..28fa20e 100644
--- a/include/asm-avr32/unaligned.h
+++ b/include/asm-avr32/unaligned.h
@@ -11,6 +11,6 @@
* optimize word loads in general.
*/
-#include <asm-generic/unaligned.h>
+#include <linux/unaligned/generic_be.h>
#endif /* __ASM_AVR32_UNALIGNED_H */
diff --git a/include/asm-blackfin/unaligned.h b/include/asm-blackfin/unaligned.h
index 10081dc..25861cd 100644
--- a/include/asm-blackfin/unaligned.h
+++ b/include/asm-blackfin/unaligned.h
@@ -1,6 +1,6 @@
#ifndef __BFIN_UNALIGNED_H
#define __BFIN_UNALIGNED_H
-#include <asm-generic/unaligned.h>
+#include <linux/unaligned/generic_le.h>
#endif /* __BFIN_UNALIGNED_H */
diff --git a/include/asm-ia64/unaligned.h b/include/asm-ia64/unaligned.h
index bb85598..2134205 100644
--- a/include/asm-ia64/unaligned.h
+++ b/include/asm-ia64/unaligned.h
@@ -1,6 +1,6 @@
#ifndef _ASM_IA64_UNALIGNED_H
#define _ASM_IA64_UNALIGNED_H
-#include <asm-generic/unaligned.h>
+#include <linux/unaligned/generic_le.h>
#endif /* _ASM_IA64_UNALIGNED_H */
diff --git a/include/asm-m68knommu/unaligned.h b/include/asm-m68knommu/unaligned.h
index 869e9dd..6b5c7a2 100644
--- a/include/asm-m68knommu/unaligned.h
+++ b/include/asm-m68knommu/unaligned.h
@@ -4,19 +4,13 @@
#ifdef CONFIG_COLDFIRE
-#include <asm-generic/unaligned.h>
+#include <linux/unaligned/generic_be.h>
#else
/*
* The m68k can do unaligned accesses itself.
- *
- * The strange macros are there to make sure these can't
- * be misused in a way that makes them not work on other
- * architectures where unaligned accesses aren't as simple.
*/
-
-#define get_unaligned(ptr) (*(ptr))
-#define put_unaligned(val, ptr) ((void)( *(ptr) = (val) ))
+#include <linux/unaligned/access_ok.h>
#endif
diff --git a/include/asm-mips/unaligned.h b/include/asm-mips/unaligned.h
index 3249049..471e127 100644
--- a/include/asm-mips/unaligned.h
+++ b/include/asm-mips/unaligned.h
@@ -5,25 +5,16 @@
*
* Copyright (C) 2007 Ralf Baechle (ralf@linux-mips.org)
*/
-#ifndef __ASM_GENERIC_UNALIGNED_H
-#define __ASM_GENERIC_UNALIGNED_H
+#ifndef __ASM_MIPS_UNALIGNED_H
+#define __ASM_MIPS_UNALIGNED_H
#include <linux/compiler.h>
+#if defined(__MIPSEB__)
+# include <linux/unaligned/generic_be.h>
+#elif defined(__MIPSEL__)
+# include <linux/unaligned/generic_le.h>
+#else
+# error "MIPS, but neither __MIPSEB__, nor __MIPSEL__???"
+#endif
-#define get_unaligned(ptr) \
-({ \
- struct __packed { \
- typeof(*(ptr)) __v; \
- } *__p = (void *) (ptr); \
- __p->__v; \
-})
-
-#define put_unaligned(val, ptr) \
-do { \
- struct __packed { \
- typeof(*(ptr)) __v; \
- } *__p = (void *) (ptr); \
- __p->__v = (val); \
-} while(0)
-
-#endif /* __ASM_GENERIC_UNALIGNED_H */
+#endif /* __ASM_MIPS_UNALIGNED_H */
diff --git a/include/asm-parisc/unaligned.h b/include/asm-parisc/unaligned.h
index 53c9058..865867c 100644
--- a/include/asm-parisc/unaligned.h
+++ b/include/asm-parisc/unaligned.h
@@ -1,7 +1,7 @@
#ifndef _ASM_PARISC_UNALIGNED_H_
#define _ASM_PARISC_UNALIGNED_H_
-#include <asm-generic/unaligned.h>
+#include <linux/unaligned/generic_be.h>
#ifdef __KERNEL__
struct pt_regs;
diff --git a/include/asm-sh/unaligned.h b/include/asm-sh/unaligned.h
index 5250e30..391da8d 100644
--- a/include/asm-sh/unaligned.h
+++ b/include/asm-sh/unaligned.h
@@ -2,6 +2,10 @@
#define __ASM_SH_UNALIGNED_H
/* SH can't handle unaligned accesses. */
-#include <asm-generic/unaligned.h>
+#ifdef __LITTLE_ENDIAN__
+#include <linux/unaligned/generic_le.h>
+#else
+#include <linux/unaligned/generic_be.h>
+#endif
#endif /* __ASM_SH_UNALIGNED_H */
diff --git a/include/asm-sparc/unaligned.h b/include/asm-sparc/unaligned.h
index b6f8edd..9f1bb56 100644
--- a/include/asm-sparc/unaligned.h
+++ b/include/asm-sparc/unaligned.h
@@ -1,6 +1,6 @@
#ifndef _ASM_SPARC_UNALIGNED_H_
#define _ASM_SPARC_UNALIGNED_H_
-#include <asm-generic/unaligned.h>
+#include <linux/unaligned/generic_be.h>
#endif /* _ASM_SPARC_UNALIGNED_H */
diff --git a/include/asm-sparc64/unaligned.h b/include/asm-sparc64/unaligned.h
index 1ed3ba5..faa18cd 100644
--- a/include/asm-sparc64/unaligned.h
+++ b/include/asm-sparc64/unaligned.h
@@ -1,6 +1,6 @@
#ifndef _ASM_SPARC64_UNALIGNED_H_
#define _ASM_SPARC64_UNALIGNED_H_
-#include <asm-generic/unaligned.h>
+#include <linux/unaligned/generic_be.h>
#endif /* _ASM_SPARC64_UNALIGNED_H */
--
1.5.5.144.g3e42
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 4/8] kernel: move arches that use the generic_le/be helpers
[not found] ` <20080410203708.GA28014-6z/3iImG2C8G8FEW9MqTrA@public.gmane.org>
@ 2008-04-10 20:43 ` Harvey Harrison
2008-04-10 20:43 ` Harvey Harrison
0 siblings, 1 reply; 4+ messages in thread
From: Harvey Harrison @ 2008-04-10 20:43 UTC (permalink / raw)
To: Ralf Baechle; +Cc: linux-arch
On Thu, 2008-04-10 at 21:37 +0100, Ralf Baechle wrote:
> On Thu, Apr 10, 2008 at 12:44:08PM -0700, Harvey Harrison wrote:
>
> Btw, you may want to look at the current MIPS implementation of
> get_unaligned and put_unaligned. It's pure C and at least on MIPS it
> produces somewhat shorter code and the source is definately much
> shorter since it exploits the compiler's cleverness.
>
> Ralf
Yeah, the only reason I did not is that many arches intentionally bug
during the linking process when the argument size is not 1,2,4,8 whereas
some do not...it would be nice to get a decision on what is the right
answer.
Also, I saw the mips version, what would you think of moving to the
no_builtin_memcpy version from my patchset...or just look at
h3800, xtensa, or m32r arch implementations currently in tree.
Cheers,
Harvey
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 4/8] kernel: move arches that use the generic_le/be helpers
2008-04-10 20:43 ` Harvey Harrison
@ 2008-04-10 20:43 ` Harvey Harrison
0 siblings, 0 replies; 4+ messages in thread
From: Harvey Harrison @ 2008-04-10 20:43 UTC (permalink / raw)
To: Ralf Baechle; +Cc: linux-arch
On Thu, 2008-04-10 at 21:37 +0100, Ralf Baechle wrote:
> On Thu, Apr 10, 2008 at 12:44:08PM -0700, Harvey Harrison wrote:
>
> Btw, you may want to look at the current MIPS implementation of
> get_unaligned and put_unaligned. It's pure C and at least on MIPS it
> produces somewhat shorter code and the source is definately much
> shorter since it exploits the compiler's cleverness.
>
> Ralf
Yeah, the only reason I did not is that many arches intentionally bug
during the linking process when the argument size is not 1,2,4,8 whereas
some do not...it would be nice to get a decision on what is the right
answer.
Also, I saw the mips version, what would you think of moving to the
no_builtin_memcpy version from my patchset...or just look at
h3800, xtensa, or m32r arch implementations currently in tree.
Cheers,
Harvey
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2008-04-10 20:43 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-10 19:44 [PATCH 4/8] kernel: move arches that use the generic_le/be helpers Harvey Harrison
2008-04-10 19:44 ` Harvey Harrison
[not found] ` <20080410203708.GA28014@linux-mips.org>
[not found] ` <20080410203708.GA28014-6z/3iImG2C8G8FEW9MqTrA@public.gmane.org>
2008-04-10 20:43 ` Harvey Harrison
2008-04-10 20:43 ` Harvey Harrison
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox