kernel: move arches that use the generic_le/be helpers
PATCH 4/8 kernel: move arches that use the generic_le/be helpers
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.
--- 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(-)
include/asm-alpha/unaligned.h +1 -1
@@ -1,6 +1,6 @@#ifndef __ALPHA_UNALIGNED_H#define __ALPHA_UNALIGNED_H -#include <asm-generic/unaligned.h> +#include <linux/unaligned/generic_le.h> #endif
include/asm-avr32/unaligned.h +1 -1
@@ -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 */
include/asm-blackfin/unaligned.h +1 -1
@@ -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 */
include/asm-ia64/unaligned.h +1 -1
@@ -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 */
include/asm-m68knommu/unaligned.h +2 -8
@@ -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
include/asm-mips/unaligned.h +10 -19
@@ -5,25 +5,16 @@* * Copyright (C) 2007 Ralf Baechle (ralf-6z/[email protected]) */ -#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 */
include/asm-parisc/unaligned.h +1 -1
@@ -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 ;
include/asm-sh/unaligned.h +5 -1
@@ -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 */
include/asm-sparc/unaligned.h +1 -1
@@ -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 */
include/asm-sparc64/unaligned.h +1 -1
@@ -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 */
Signature · 1 line
1.5.5.144.g3e42
Quoted 8 lines · Ralf Baechle
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_unalignedandput_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