Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

asm-generic: use asm-generic/unaligned.h for most architectures

There are several architectures that just duplicate the contents
of asm-generic/unaligned.h, so change those over to use the
file directly, to make future modifications easier.

The exceptions are:

- arm32 sets HAVE_EFFICIENT_UNALIGNED_ACCESS, but wants the
unaligned-struct version

- ppc64le disables HAVE_EFFICIENT_UNALIGNED_ACCESS but includes
the access-ok version

- most m68k also uses the access-ok version without setting
HAVE_EFFICIENT_UNALIGNED_ACCESS.

- sh4a has a custom inline asm version

- openrisc is the only one using the memmove version that
generally leads to worse code.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Geert Uytterhoeven <geert@linux-m68k.org>
Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>

+2 -119
-12
arch/alpha/include/asm/unaligned.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 2 - #ifndef _ASM_ALPHA_UNALIGNED_H 3 - #define _ASM_ALPHA_UNALIGNED_H 4 - 5 - #include <linux/unaligned/le_struct.h> 6 - #include <linux/unaligned/be_byteshift.h> 7 - #include <linux/unaligned/generic.h> 8 - 9 - #define get_unaligned __get_unaligned_le 10 - #define put_unaligned __put_unaligned_le 11 - 12 - #endif /* _ASM_ALPHA_UNALIGNED_H */
-12
arch/ia64/include/asm/unaligned.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 2 - #ifndef _ASM_IA64_UNALIGNED_H 3 - #define _ASM_IA64_UNALIGNED_H 4 - 5 - #include <linux/unaligned/le_struct.h> 6 - #include <linux/unaligned/be_byteshift.h> 7 - #include <linux/unaligned/generic.h> 8 - 9 - #define get_unaligned __get_unaligned_le 10 - #define put_unaligned __put_unaligned_le 11 - 12 - #endif /* _ASM_IA64_UNALIGNED_H */
+1 -8
arch/m68k/include/asm/unaligned.h
··· 2 2 #ifndef _ASM_M68K_UNALIGNED_H 3 3 #define _ASM_M68K_UNALIGNED_H 4 4 5 - 6 5 #ifdef CONFIG_CPU_HAS_NO_UNALIGNED 7 - #include <linux/unaligned/be_struct.h> 8 - #include <linux/unaligned/le_byteshift.h> 9 - #include <linux/unaligned/generic.h> 10 - 11 - #define get_unaligned __get_unaligned_be 12 - #define put_unaligned __put_unaligned_be 13 - 6 + #include <asm-generic/unaligned.h> 14 7 #else 15 8 /* 16 9 * The m68k can do unaligned accesses itself.
-27
arch/microblaze/include/asm/unaligned.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 2 - /* 3 - * Copyright (C) 2008 Michal Simek <monstr@monstr.eu> 4 - * Copyright (C) 2006 Atmark Techno, Inc. 5 - */ 6 - 7 - #ifndef _ASM_MICROBLAZE_UNALIGNED_H 8 - #define _ASM_MICROBLAZE_UNALIGNED_H 9 - 10 - # ifdef __KERNEL__ 11 - 12 - # ifdef __MICROBLAZEEL__ 13 - # include <linux/unaligned/le_struct.h> 14 - # include <linux/unaligned/be_byteshift.h> 15 - # define get_unaligned __get_unaligned_le 16 - # define put_unaligned __put_unaligned_le 17 - # else 18 - # include <linux/unaligned/be_struct.h> 19 - # include <linux/unaligned/le_byteshift.h> 20 - # define get_unaligned __get_unaligned_be 21 - # define put_unaligned __put_unaligned_be 22 - # endif 23 - 24 - # include <linux/unaligned/generic.h> 25 - 26 - # endif /* __KERNEL__ */ 27 - #endif /* _ASM_MICROBLAZE_UNALIGNED_H */
+1 -5
arch/parisc/include/asm/unaligned.h
··· 2 2 #ifndef _ASM_PARISC_UNALIGNED_H 3 3 #define _ASM_PARISC_UNALIGNED_H 4 4 5 - #include <linux/unaligned/be_struct.h> 6 - #include <linux/unaligned/le_byteshift.h> 7 - #include <linux/unaligned/generic.h> 8 - #define get_unaligned __get_unaligned_be 9 - #define put_unaligned __put_unaligned_be 5 + #include <asm-generic/unaligned.h> 10 6 11 7 #ifdef __KERNEL__ 12 8 struct pt_regs;
-11
arch/sparc/include/asm/unaligned.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 2 - #ifndef _ASM_SPARC_UNALIGNED_H 3 - #define _ASM_SPARC_UNALIGNED_H 4 - 5 - #include <linux/unaligned/be_struct.h> 6 - #include <linux/unaligned/le_byteshift.h> 7 - #include <linux/unaligned/generic.h> 8 - #define get_unaligned __get_unaligned_be 9 - #define put_unaligned __put_unaligned_be 10 - 11 - #endif /* _ASM_SPARC_UNALIGNED_H */
-15
arch/x86/include/asm/unaligned.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 2 - #ifndef _ASM_X86_UNALIGNED_H 3 - #define _ASM_X86_UNALIGNED_H 4 - 5 - /* 6 - * The x86 can do unaligned accesses itself. 7 - */ 8 - 9 - #include <linux/unaligned/access_ok.h> 10 - #include <linux/unaligned/generic.h> 11 - 12 - #define get_unaligned __get_unaligned_le 13 - #define put_unaligned __put_unaligned_le 14 - 15 - #endif /* _ASM_X86_UNALIGNED_H */
-29
arch/xtensa/include/asm/unaligned.h
··· 1 - /* 2 - * Xtensa doesn't handle unaligned accesses efficiently. 3 - * 4 - * This file is subject to the terms and conditions of the GNU General Public 5 - * License. See the file "COPYING" in the main directory of this archive 6 - * for more details. 7 - * 8 - * Copyright (C) 2001 - 2005 Tensilica Inc. 9 - */ 10 - #ifndef _ASM_XTENSA_UNALIGNED_H 11 - #define _ASM_XTENSA_UNALIGNED_H 12 - 13 - #include <asm/byteorder.h> 14 - 15 - #ifdef __LITTLE_ENDIAN 16 - # include <linux/unaligned/le_struct.h> 17 - # include <linux/unaligned/be_byteshift.h> 18 - # include <linux/unaligned/generic.h> 19 - # define get_unaligned __get_unaligned_le 20 - # define put_unaligned __put_unaligned_le 21 - #else 22 - # include <linux/unaligned/be_struct.h> 23 - # include <linux/unaligned/le_byteshift.h> 24 - # include <linux/unaligned/generic.h> 25 - # define get_unaligned __get_unaligned_be 26 - # define put_unaligned __put_unaligned_be 27 - #endif 28 - 29 - #endif /* _ASM_XTENSA_UNALIGNED_H */