diff options
Diffstat (limited to 'arch/arm/include/asm/swab.h')
-rw-r--r-- | arch/arm/include/asm/swab.h | 37 |
1 files changed, 1 insertions, 36 deletions
diff --git a/arch/arm/include/asm/swab.h b/arch/arm/include/asm/swab.h index b859d82e30ca..537fc9b91889 100644 --- a/arch/arm/include/asm/swab.h +++ b/arch/arm/include/asm/swab.h | |||
@@ -15,14 +15,8 @@ | |||
15 | #ifndef __ASM_ARM_SWAB_H | 15 | #ifndef __ASM_ARM_SWAB_H |
16 | #define __ASM_ARM_SWAB_H | 16 | #define __ASM_ARM_SWAB_H |
17 | 17 | ||
18 | #include <linux/compiler.h> | 18 | #include <uapi/asm/swab.h> |
19 | #include <linux/types.h> | ||
20 | 19 | ||
21 | #if !defined(__STRICT_ANSI__) || defined(__KERNEL__) | ||
22 | # define __SWAB_64_THRU_32__ | ||
23 | #endif | ||
24 | |||
25 | #if defined(__KERNEL__) | ||
26 | #if __LINUX_ARM_ARCH__ >= 6 | 20 | #if __LINUX_ARM_ARCH__ >= 6 |
27 | 21 | ||
28 | static inline __attribute_const__ __u32 __arch_swahb32(__u32 x) | 22 | static inline __attribute_const__ __u32 __arch_swahb32(__u32 x) |
@@ -42,32 +36,3 @@ static inline __attribute_const__ __u32 __arch_swab32(__u32 x) | |||
42 | 36 | ||
43 | #endif | 37 | #endif |
44 | #endif | 38 | #endif |
45 | |||
46 | #if !defined(__KERNEL__) || __LINUX_ARM_ARCH__ < 6 | ||
47 | static inline __attribute_const__ __u32 __arch_swab32(__u32 x) | ||
48 | { | ||
49 | __u32 t; | ||
50 | |||
51 | #ifndef __thumb__ | ||
52 | if (!__builtin_constant_p(x)) { | ||
53 | /* | ||
54 | * The compiler needs a bit of a hint here to always do the | ||
55 | * right thing and not screw it up to different degrees | ||
56 | * depending on the gcc version. | ||
57 | */ | ||
58 | asm ("eor\t%0, %1, %1, ror #16" : "=r" (t) : "r" (x)); | ||
59 | } else | ||
60 | #endif | ||
61 | t = x ^ ((x << 16) | (x >> 16)); /* eor r1,r0,r0,ror #16 */ | ||
62 | |||
63 | x = (x << 24) | (x >> 8); /* mov r0,r0,ror #8 */ | ||
64 | t &= ~0x00FF0000; /* bic r1,r1,#0x00FF0000 */ | ||
65 | x ^= (t >> 8); /* eor r0,r0,r1,lsr #8 */ | ||
66 | |||
67 | return x; | ||
68 | } | ||
69 | #define __arch_swab32 __arch_swab32 | ||
70 | |||
71 | #endif | ||
72 | |||
73 | #endif | ||