kernel: Move arches to use common unaligned access
PATCH v3 2/2 kernel: Move arches to use common unaligned access
Unaligned access is ok for the following arches:
cris, m68k, mn10300, powerpc, s390, x86
Arches that use the memmove implementation for native endian, and the byteshifting for the opposite endianness.
h8300, m32r, xtensa
Packed struct for native endian, byteshifting for other endian:
alpha, blackfin, ia64, parisc, sparc, sparc64, mips, sh
m86knommu is generic_be for Coldfire, otherwise unaligned access is ok.
frv, arm chooses endianness based on compiler settings, uses the byteshifting versions.
v850 is le, uses the byteshifting versions for both be and le.
Remove the now unused asm-generic implementation.
--- include/asm-alpha/unaligned.h | 13 ++- include/asm-arm/unaligned.h | 174 +------------------------------- include/asm-avr32/unaligned.h | 13 ++- include/asm-blackfin/unaligned.h | 13 ++- include/asm-cris/unaligned.h | 17 ++-- include/asm-frv/unaligned.h | 196 ++----------------------------------- include/asm-generic/unaligned.h | 124 ----------------------- include/asm-h8300/unaligned.h | 20 ++--- include/asm-ia64/unaligned.h | 13 ++- include/asm-m32r/unaligned.h | 33 +++--- include/asm-m68k/unaligned.h | 17 ++-- include/asm-m68knommu/unaligned.h | 22 +++-- include/asm-mips/unaligned.h | 37 ++++---- include/asm-mn10300/unaligned.h | 130 ++----------------------- include/asm-parisc/unaligned.h | 6 +- include/asm-powerpc/unaligned.h | 17 ++-- include/asm-s390/unaligned.h | 25 ++---- include/asm-sh/unaligned.h | 20 +++- include/asm-sparc/unaligned.h | 8 +- include/asm-sparc64/unaligned.h | 8 +- include/asm-um/unaligned.h | 6 +- include/asm-v850/unaligned.h | 119 ++--------------------- include/asm-x86/unaligned.h | 38 ++------ include/asm-xtensa/unaligned.h | 33 ++++--- 24 files changed, 208 insertions(+), 894 deletions(-)
include/asm-alpha/unaligned.h +9 -4
@@ -1,6 +1,11 @@ -#ifndef __ALPHA_UNALIGNED_H -#define __ALPHA_UNALIGNED_H +#ifndef _ASM_ALPHA_UNALIGNED_H_ +#define _ASM_ALPHA_UNALIGNED_H_ -#include <asm-generic/unaligned.h> +#include <linux/unaligned/le_struct.h> +#include <linux/unaligned/be_byteshift.h> +#include <linux/unaligned/generic.h> -#endif +#define get_unaligned __get_unaligned_le +#define put_unaligned __put_unaligned_le + +#endif /* _ASM_ALPHA_UNALIGNED_H_ */
include/asm-arm/unaligned.h +6 -168
181 lines not on this page · raw message
include/asm-avr32/unaligned.h +9 -4
@@ -1,5 +1,5 @@ -#ifndef __ASM_AVR32_UNALIGNED_H -#define __ASM_AVR32_UNALIGNED_H +#ifndef _ASM_AVR32_UNALIGNED_H_ +#define _ASM_AVR32_UNALIGNED_H_/* * AVR32 can handle some unaligned accesses, depending on the
@@ -11,6 +11,11 @@* optimize word loads in general. */ -#include <asm-generic/unaligned.h> +#include <linux/unaligned/be_struct.h> +#include <linux/unaligned/le_byteshift.h> +#include <linux/unaligned/generic.h> -#endif /* __ASM_AVR32_UNALIGNED_H */ +#define get_unaligned __get_unaligned_be +#define put_unaligned __put_unaligned_be + +#endif /* _ASM_AVR32_UNALIGNED_H_ */
include/asm-blackfin/unaligned.h +9 -4
@@ -1,6 +1,11 @@ -#ifndef __BFIN_UNALIGNED_H -#define __BFIN_UNALIGNED_H +#ifndef _ASM_BLACKFIN_UNALIGNED_H_ +#define _ASM_BLACKFIN_UNALIGNED_H_ -#include <asm-generic/unaligned.h> +#include <linux/unaligned/le_struct.h> +#include <linux/unaligned/be_byteshift.h> +#include <linux/unaligned/generic.h> -#endif /* __BFIN_UNALIGNED_H */ +#define get_unaligned __get_unaligned_le +#define put_unaligned __put_unaligned_le + +#endif /* _ASM_BLACKFIN_UNALIGNED_H_ */
include/asm-cris/unaligned.h +7 -10
@@ -1,16 +1,13 @@ -#ifndef __CRIS_UNALIGNED_H -#define __CRIS_UNALIGNED_H +#ifndef _ASM_CRIS_UNALIGNED_H_ +#define _ASM_CRIS_UNALIGNED_H_/* * CRIS 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. */ +#include <linux/unaligned/access_ok.h> +#include <linux/unaligned/generic.h> -#define get_unaligned (ptr) (*(ptr)) +#define get_unaligned __get_unaligned_le +#define put_unaligned __put_unaligned_le -#define put_unaligned (val, ptr) ((void)( *(ptr) = (val) )) - -#endif +#endif /* _ASM_CRIS_UNALIGNED_H_ */
include/asm-frv/unaligned.h +8 -188
202 lines not on this page · raw message
include/asm-generic/unaligned.h deleted +0 -124
124 lines not on this page · raw message
include/asm-h8300/unaligned.h +8 -12
@@ -1,15 +1,11 @@ -#ifndef __H8300_UNALIGNED_H -#define __H8300_UNALIGNED_H +#ifndef _ASM_H8300_UNALIGNED_H_ +#define _ASM_H8300_UNALIGNED_H_ +#include <linux/unaligned/be_memmove.h> +#include <linux/unaligned/le_byteshift.h> +#include <linux/unaligned/generic.h> -/* Use memmove here, so gcc does not insert a __builtin_memcpy. */ +#define get_unaligned __get_unaligned_be +#define put_unaligned __put_unaligned_be -#define get_unaligned (ptr) \ - ({ __typeof__(*(ptr)) __tmp; memmove(&__tmp, (ptr), sizeof(*(ptr))); __tmp; }) - -#define put_unaligned (val, ptr) \ - ({ __typeof__(*(ptr)) __tmp = (val); \ - memmove((ptr), &__tmp, sizeof(*(ptr))); \ - (void)0; }) - -#endif +#endif /* _ASM_H8300_UNALIGNED_H_ */
include/asm-ia64/unaligned.h +9 -4
@@ -1,6 +1,11 @@ -#ifndef _ASM_IA64_UNALIGNED_H -#define _ASM_IA64_UNALIGNED_H +#ifndef _ASM_IA64_UNALIGNED_H_ +#define _ASM_IA64_UNALIGNED_H_ -#include <asm-generic/unaligned.h> +#include <linux/unaligned/le_struct.h> +#include <linux/unaligned/be_byteshift.h> +#include <linux/unaligned/generic.h> -#endif /* _ASM_IA64_UNALIGNED_H */ +#define get_unaligned __get_unaligned_le +#define put_unaligned __put_unaligned_le + +#endif /* _ASM_IA64_UNALIGNED_H_ */
include/asm-m32r/unaligned.h +16 -17
@@ -1,19 +1,18 @@ -#ifndef _ASM_M32R_UNALIGNED_H -#define _ASM_M32R_UNALIGNED_H +#ifndef _ASM_M32R_UNALIGNED_H_ +#define _ASM_M32R_UNALIGNED_H_ -/* -* For the benefit of those who are trying to port Linux to another -* architecture, here are some C-language equivalents. -*/ +#if defined(__LITTLE_ENDIAN__) +# include <linux/unaligned/le_memmove.h> +# include <linux/unaligned/be_byteshift.h> +# include <linux/unaligned/generic.h> +# define get_unaligned __get_unaligned_le +# define put_unaligned __put_unaligned_le +#else +# include <linux/unaligned/be_memmove.h> +# include <linux/unaligned/le_byteshift.h> +# include <linux/unaligned/generic.h> +# define get_unaligned __get_unaligned_be +# define put_unaligned __put_unaligned_be +#endif -#include <asm/string.h> - -#define get_unaligned (ptr) \ - ({ __typeof__(*(ptr)) __tmp; memmove(&__tmp, (ptr), sizeof(*(ptr))); __tmp; }) - -#define put_unaligned (val, ptr) \ - ({ __typeof__(*(ptr)) __tmp = (val); \ - memmove((ptr), &__tmp, sizeof(*(ptr))); \ - (void)0; }) - -#endif /* _ASM_M32R_UNALIGNED_H */ +#endif /* _ASM_M32R_UNALIGNED_H_ */
include/asm-m68k/unaligned.h +7 -10
@@ -1,16 +1,13 @@ -#ifndef __M68K_UNALIGNED_H -#define __M68K_UNALIGNED_H +#ifndef _ASM_M68K_UNALIGNED_H_ +#define _ASM_M68K_UNALIGNED_H_/* * 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. */ +#include <linux/unaligned/access_ok.h> +#include <linux/unaligned/generic.h> -#define get_unaligned (ptr) (*(ptr)) +#define get_unaligned __get_unaligned_be +#define put_unaligned __put_unaligned_be -#define put_unaligned (val, ptr) ((void)( *(ptr) = (val) )) - -#endif +#endif /* _ASM_M68K_UNALIGNED_H_ */
include/asm-m68knommu/unaligned.h +12 -10
@@ -1,23 +1,25 @@ -#ifndef __M68K_UNALIGNED_H -#define __M68K_UNALIGNED_H +#ifndef _ASM_M68KNOMMU_UNALIGNED_H_ +#define _ASM_M68KNOMMU_UNALIGNED_H_#ifdef CONFIG_COLDFIRE +#include <linux/unaligned/be_struct.h> +#include <linux/unaligned/le_byteshift.h> +#include <linux/unaligned/generic.h> -#include <asm-generic/unaligned.h> +#define get_unaligned __get_unaligned_be +#define put_unaligned __put_unaligned_be#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. */ +#include <linux/unaligned/access_ok.h> +#include <linux/unaligned/generic.h> -#define get_unaligned (ptr) (*(ptr)) -#define put_unaligned (val, ptr) ((void)( *(ptr) = (val) )) +#define get_unaligned __get_unaligned_be +#define put_unaligned __put_unaligned_be#endif -#endif +#endif /* _ASM_M68KNOMMU_UNALIGNED_H_ */
include/asm-mips/unaligned.h +18 -19
@@ -5,25 +5,24 @@* * Copyright (C) 2007 Ralf Baechle ([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/be_struct.h> +# include <linux/unaligned/le_byteshift.h> +# include <linux/unaligned/generic.h> +# define get_unaligned __get_unaligned_be +# define put_unaligned __put_unaligned_be +#elif defined(__MIPSEL__) +# include <linux/unaligned/le_struct.h> +# include <linux/unaligned/be_byteshift.h> +# include <linux/unaligned/generic.h> +# define get_unaligned __get_unaligned_le +# define put_unaligned __put_unaligned_le +#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-mn10300/unaligned.h +7 -123
136 lines not on this page · raw message
include/asm-parisc/unaligned.h +5 -1
@@ -1,7 +1,11 @@#ifndef _ASM_PARISC_UNALIGNED_H_#define _ASM_PARISC_UNALIGNED_H_ -#include <asm-generic/unaligned.h> +#include <linux/unaligned/be_struct.h> +#include <linux/unaligned/le_byteshift.h> +#include <linux/unaligned/generic.h> +#define get_unaligned __get_unaligned_be +#define put_unaligned __put_unaligned_be#ifdef __KERNEL__struct pt_regs ;
include/asm-powerpc/unaligned.h +7 -10
@@ -1,19 +1,16 @@ -#ifndef _ASM_POWERPC_UNALIGNED_H -#define _ASM_POWERPC_UNALIGNED_H +#ifndef _ASM_POWERPC_UNALIGNED_H_ +#define _ASM_POWERPC_UNALIGNED_H_#ifdef __KERNEL__/* * The PowerPC can do unaligned accesses itself in big endian mode. -* -* 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. */ +#include <linux/unaligned/access_ok.h> +#include <linux/unaligned/generic.h> -#define get_unaligned (ptr) (*(ptr)) - -#define put_unaligned (val, ptr) ((void)( *(ptr) = (val) )) +#define get_unaligned __get_unaligned_be +#define put_unaligned __put_unaligned_be#endif /* __KERNEL__ */ -#endif /* _ASM_POWERPC_UNALIGNED_H */ +#endif /* _ASM_POWERPC_UNALIGNED_H_ */
include/asm-s390/unaligned.h +7 -18
@@ -1,24 +1,13 @@ -/* -* include/asm-s390/unaligned.h -* -* S390 version -* -* Derived from "include/asm-i386/unaligned.h" -*/ - -#ifndef __S390_UNALIGNED_H -#define __S390_UNALIGNED_H +#ifndef _ASM_S390_UNALIGNED_H_ +#define _ASM_S390_UNALIGNED_H_/* * The S390 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. */ +#include <linux/unaligned/access_ok.h> +#include <linux/unaligned/generic.h> -#define get_unaligned (ptr) (*(ptr)) - -#define put_unaligned (val, ptr) ((void)( *(ptr) = (val) )) +#define get_unaligned __get_unaligned_be +#define put_unaligned __put_unaligned_be -#endif +#endif /* _ASM_S390_UNALIGNED_H_ */
include/asm-sh/unaligned.h +16 -4
@@ -1,7 +1,19 @@ -#ifndef __ASM_SH_UNALIGNED_H -#define __ASM_SH_UNALIGNED_H +#ifndef _ASM_SH_UNALIGNED_H_ +#define _ASM_SH_UNALIGNED_H_/* SH can't handle unaligned accesses. */ -#include <asm-generic/unaligned.h> +#ifdef __LITTLE_ENDIAN__ +# include <linux/unaligned/le_struct.h> +# include <linux/unaligned/be_byteshift.h> +# include <linux/unaligned/generic.h> +# define get_unaligned __get_unaligned_le +# define put_unaligned __put_unaligned_le +#else +# include <linux/unaligned/be_struct.h> +# include <linux/unaligned/le_byteshift.h> +# include <linux/unaligned/generic.h> +# define get_unaligned __get_unaligned_be +# define put_unaligned __put_unaligned_be +#endif -#endif /* __ASM_SH_UNALIGNED_H */ +#endif /* _ASM_SH_UNALIGNED_H_ */
include/asm-sparc/unaligned.h +6 -2
@@ -1,6 +1,10 @@#ifndef _ASM_SPARC_UNALIGNED_H_#define _ASM_SPARC_UNALIGNED_H_ -#include <asm-generic/unaligned.h> +#include <linux/unaligned/be_struct.h> +#include <linux/unaligned/le_byteshift.h> +#include <linux/unaligned/generic.h> +#define get_unaligned __get_unaligned_be +#define put_unaligned __put_unaligned_be -#endif /* _ASM_SPARC_UNALIGNED_H */ +#endif /* _ASM_SPARC_UNALIGNED_H_ */
include/asm-sparc64/unaligned.h +6 -2
@@ -1,6 +1,10 @@#ifndef _ASM_SPARC64_UNALIGNED_H_#define _ASM_SPARC64_UNALIGNED_H_ -#include <asm-generic/unaligned.h> +#include <linux/unaligned/be_struct.h> +#include <linux/unaligned/le_byteshift.h> +#include <linux/unaligned/generic.h> +#define get_unaligned __get_unaligned_be +#define put_unaligned __put_unaligned_be -#endif /* _ASM_SPARC64_UNALIGNED_H */ +#endif /* _ASM_SPARC64_UNALIGNED_H_ */
include/asm-um/unaligned.h +3 -3
@@ -1,6 +1,6 @@ -#ifndef __UM_UNALIGNED_H -#define __UM_UNALIGNED_H +#ifndef _ASM_UM_UNALIGNED_H_ +#define _ASM_UM_UNALIGNED_H_#include "asm/arch/unaligned.h" -#endif +#endif /* _ASM_UM_UNALIGNED_H_ */
include/asm-v850/unaligned.h +8 -111
125 lines not on this page · raw message
include/asm-x86/unaligned.h +7 -31
@@ -1,37 +1,13 @@ -#ifndef _ASM_X86_UNALIGNED_H -#define _ASM_X86_UNALIGNED_H +#ifndef _ASM_X86_UNALIGNED_H_ +#define _ASM_X86_UNALIGNED_H_/* * The x86 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. */ +#include <linux/unaligned/access_ok.h> +#include <linux/unaligned/generic.h> -/** -* get_unaligned - get value from possibly mis-aligned location -* @ptr: pointer to value -* -* This macro should be used for accessing values larger in size than -* single bytes at locations that are expected to be improperly aligned, -* e.g. retrieving a u16 value from a location not u16-aligned. -* -* Note that unaligned accesses can be very expensive on some architectures. -*/ -#define get_unaligned (ptr) (*(ptr)) - -/** -* put_unaligned - put value to a possibly mis-aligned location -* @val: value to place -* @ptr: pointer to location -* -* This macro should be used for placing values larger in size than -* single bytes at locations that are expected to be improperly aligned, -* e.g. writing a u16 value to a location not u16-aligned. -* -* Note that unaligned accesses can be very expensive on some architectures. -*/ -#define put_unaligned (val, ptr) ((void)( *(ptr) = (val) )) +#define get_unaligned __get_unaligned_le +#define put_unaligned __put_unaligned_le -#endif /* _ASM_X86_UNALIGNED_H */ +#endif /* _ASM_X86_UNALIGNED_H_ */
include/asm-xtensa/unaligned.h +18 -15
@@ -9,20 +9,23 @@* * Copyright (C) 2001 - 2005 Tensilica Inc. */ +#ifndef _ASM_XTENSA_UNALIGNED_H_ +#define _ASM_XTENSA_UNALIGNED_H_ -#ifndef _XTENSA_UNALIGNED_H -#define _XTENSA_UNALIGNED_H +#ifdef __XTENSA_EL__ +# include <linux/unaligned/le_memmove.h> +# include <linux/unaligned/be_byteshift.h> +# include <linux/unaligned/generic.h> +# define get_unaligned __get_unaligned_le +# define put_unaligned __put_unaligned_le +#elif defined(__XTENSA_EB__) +# include <linux/unaligned/be_memmove.h> +# include <linux/unaligned/le_byteshift.h> +# include <linux/unaligned/generic.h> +# define get_unaligned __get_unaligned_be +# define put_unaligned __put_unaligned_be +#else +# error processor byte order undefined! +#endif -#include <linux/string.h> - -/* Use memmove here, so gcc does not insert a __builtin_memcpy. */ - -#define get_unaligned (ptr) \ - ({ __typeof__(*(ptr)) __tmp; memmove(&__tmp, (ptr), sizeof(*(ptr))); __tmp; }) - -#define put_unaligned (val, ptr) \ - ({ __typeof__(*(ptr)) __tmp = (val); \ - memmove((ptr), &__tmp, sizeof(*(ptr))); \ - (void)0; }) - -#endif /* _XTENSA_UNALIGNED_H */ +#endif /* _ASM_XTENSA_UNALIGNED_H_ */
Signature · 1 line
1.5.5.144.g3e42
include/asm-frv/unaligned.h line 13
Quoted 4 lines · Harvey Harrison
include/asm-frv/unaligned.h +2
-2-#ifndef _ASM_UNALIGNED_H -#define _ASM_UNALIGNED_H +#ifndef _ASM_FRV_UNALIGNED_H_ +#define _ASM_FRV_UNALIGNED_H_
Please don't. Why do you need to change these to make your patch work?
Quoted 1 line
-extern int
handle_misalignment(unsigned long esr0, unsigned long ear0, unsigned long epcr0);
Don't lose this please, not unless you're going to erase the handle_misalignment() function and remove the refs to it.
David
Quoted 8 lines · David Howells
include/asm-frv/unaligned.h line 13
Quoted 4 lines · Harvey Harrison
include/asm-frv/unaligned.h +2
-2-#ifndef _ASM_UNALIGNED_H -#define _ASM_UNALIGNED_H +#ifndef _ASM_FRV_UNALIGNED_H_ +#define _ASM_FRV_UNALIGNED_H_Please don't. Why do you need to change these to make your patch work?
Indeed - ditto for the ARM changes. The patch is changing them to a different style to the others in the respective asm/ directories - which is also different from the linux/ directory.
IMHO, if Harvey wishes to clean those up, then that should be a separate patch and should be part of a set converting all includes to use the same style.
Signature · 3 lines
Russell King Linux kernel 2.6 ARM Linux - http://www.arm.linux.org.uk/ maintainer of:
Quoted 10 lines · Russell King
Quoted 8 lines · David Howells
include/asm-frv/unaligned.h line 13
Quoted 4 lines · Harvey Harrison
include/asm-frv/unaligned.h +2
-2-#ifndef _ASM_UNALIGNED_H -#define _ASM_UNALIGNED_H +#ifndef _ASM_FRV_UNALIGNED_H_ +#define _ASM_FRV_UNALIGNED_H_Please don't. Why do you need to change these to make your patch work?
Quoted 8 lines
Indeed - ditto for the ARM changes. The patch is changing them to a different style to the others in the respective asm/ directories - which is also different from the linux/ directory.
IMHO, if Harvey wishes to clean those up, then that should be a separate patch and should be part of a set converting all includes to use the same style.
OK, I'll revise without these changes. I am curious what the preferred 'linux' style is (if there is one).
Linus, Andrew?
Harvey
Quoted 15 lines · Harvey Harrison
Quoted 14 lines · Russell King
Quoted 8 lines · David Howells
include/asm-frv/unaligned.h line 13
Quoted 4 lines · Harvey Harrison
include/asm-frv/unaligned.h +2
-2-#ifndef _ASM_UNALIGNED_H -#define _ASM_UNALIGNED_H +#ifndef _ASM_FRV_UNALIGNED_H_ +#define _ASM_FRV_UNALIGNED_H_Please don't. Why do you need to change these to make your patch work?
Indeed - ditto for the ARM changes. The patch is changing them to a different style to the others in the respective asm/ directories - which is also different from the linux/ directory.
Quoted 7 lines
Quoted 4 lines
IMHO, if Harvey wishes to clean those up, then that should be a separate patch and should be part of a set converting all includes to use the same style.
OK, I'll revise without these changes. I am curious what the preferred 'linux' style is (if there is one).
The one that's already established by the majority is one answer. 8)
$ grep '^#ifndef LINUX_.*_H$' include/linux/*.h | wc -l 33 $ grep '^#ifndef _LINUX_.*_H$' include/linux/*.h | wc -l 388 $ grep '^#ifndef __LINUX_.*_H$' include/linux/*.h | wc -l 110 $ grep '^#ifndef LINUX_.*_H_$' include/linux/*.h | wc -l 1 $ grep '^#ifndef LINUX_.*_H__$' include/linux/*.h | wc -l 0 $ grep '^#ifndef _LINUX_.*_H_$' include/linux/*.h | wc -l 20 $ grep '^#ifndef __LINUX_.*_H__$' include/linux/*.h | wc -l 20
So it seems _LINUX_FOO_H for linux/foo.h wins.
But... honestly, I wouldn't bother with such a cleanup - at the end of the day, it's personal choice and people are always going to do something slightly different. So it's probably best all round to just accept what's already in the files you're modifying.
Let's not add to the expanding beaurocracy by demanding a format for these macro names.
Signature · 3 lines
Russell King Linux kernel 2.6 ARM Linux - http://www.arm.linux.org.uk/ maintainer of:
Quoted 43 lines · Russell King
Quoted 15 lines · Harvey Harrison
Quoted 14 lines · Russell King
Quoted 8 lines · David Howells
Review
Quoted 4 lines · Harvey Harrison
(quoted diff) +2
-2-#ifndef _ASM_UNALIGNED_H -#define _ASM_UNALIGNED_H +#ifndef _ASM_FRV_UNALIGNED_H_ +#define _ASM_FRV_UNALIGNED_H_Please don't. Why do you need to change these to make your patch work?
Indeed - ditto for the ARM changes. The patch is changing them to a different style to the others in the respective asm/ directories - which is also different from the linux/ directory.
Quoted 7 lines
Quoted 4 lines
IMHO, if Harvey wishes to clean those up, then that should be a separate patch and should be part of a set converting all includes to use the same style.
OK, I'll revise without these changes. I am curious what the preferred 'linux' style is (if there is one).
The one that's already established by the majority is one answer. 8)
$ grep '^#ifndef LINUX_.*_H$' include/linux/*.h | wc -l 33 $ grep '^#ifndef _LINUX_.*_H$' include/linux/*.h | wc -l 388 $ grep '^#ifndef __LINUX_.*_H$' include/linux/*.h | wc -l 110 $ grep '^#ifndef LINUX_.*_H_$' include/linux/*.h | wc -l 1 $ grep '^#ifndef LINUX_.*_H__$' include/linux/*.h | wc -l 0 $ grep '^#ifndef _LINUX_.*_H_$' include/linux/*.h | wc -l 20 $ grep '^#ifndef __LINUX_.*_H__$' include/linux/*.h | wc -l 20So it seems
_LINUX_FOO_Hforlinux/foo.hwins.
Quoted 8 lines
But... honestly, I wouldn't bother with such a cleanup - at the end of the day, it's personal choice and people are always going to do something slightly different. So it's probably best all round to just accept what's already in the files you're modifying.
Let's not add to the expanding beaurocracy by demanding a format for these macro names.
Well, I'm not interested in a comprehensive cleanup here, but as I am changing every arch's asm/unaligned.h, may as well at least do those ones. Would you accept my patch with ARM's changed to _ASM_ARM_UNALIGNED_H?
Harvey