diff options
-rw-r--r-- | arch/sh/include/asm/byteorder.h | 36 |
1 files changed, 17 insertions, 19 deletions
diff --git a/arch/sh/include/asm/byteorder.h b/arch/sh/include/asm/byteorder.h index 4c13e6117563..f5fa0653ebc6 100644 --- a/arch/sh/include/asm/byteorder.h +++ b/arch/sh/include/asm/byteorder.h | |||
@@ -8,7 +8,15 @@ | |||
8 | #include <linux/compiler.h> | 8 | #include <linux/compiler.h> |
9 | #include <linux/types.h> | 9 | #include <linux/types.h> |
10 | 10 | ||
11 | static inline __attribute_const__ __u32 ___arch__swab32(__u32 x) | 11 | #ifdef __LITTLE_ENDIAN__ |
12 | # define __LITTLE_ENDIAN | ||
13 | #else | ||
14 | # define __BIG_ENDIAN | ||
15 | #endif | ||
16 | |||
17 | #define __SWAB_64_THRU_32__ | ||
18 | |||
19 | static inline __attribute_const__ __u32 __arch_swab32(__u32 x) | ||
12 | { | 20 | { |
13 | __asm__( | 21 | __asm__( |
14 | #ifdef __SH5__ | 22 | #ifdef __SH5__ |
@@ -24,8 +32,9 @@ static inline __attribute_const__ __u32 ___arch__swab32(__u32 x) | |||
24 | 32 | ||
25 | return x; | 33 | return x; |
26 | } | 34 | } |
35 | #define __arch_swab32 __arch_swab32 | ||
27 | 36 | ||
28 | static inline __attribute_const__ __u16 ___arch__swab16(__u16 x) | 37 | static inline __attribute_const__ __u16 __arch_swab16(__u16 x) |
29 | { | 38 | { |
30 | __asm__( | 39 | __asm__( |
31 | #ifdef __SH5__ | 40 | #ifdef __SH5__ |
@@ -39,32 +48,21 @@ static inline __attribute_const__ __u16 ___arch__swab16(__u16 x) | |||
39 | 48 | ||
40 | return x; | 49 | return x; |
41 | } | 50 | } |
51 | #define __arch_swab16 __arch_swab16 | ||
42 | 52 | ||
43 | static inline __u64 ___arch__swab64(__u64 val) | 53 | static inline __u64 __arch_swab64(__u64 val) |
44 | { | 54 | { |
45 | union { | 55 | union { |
46 | struct { __u32 a,b; } s; | 56 | struct { __u32 a,b; } s; |
47 | __u64 u; | 57 | __u64 u; |
48 | } v, w; | 58 | } v, w; |
49 | v.u = val; | 59 | v.u = val; |
50 | w.s.b = ___arch__swab32(v.s.a); | 60 | w.s.b = __arch_swab32(v.s.a); |
51 | w.s.a = ___arch__swab32(v.s.b); | 61 | w.s.a = __arch_swab32(v.s.b); |
52 | return w.u; | 62 | return w.u; |
53 | } | 63 | } |
64 | #define __arch_swab64 __arch_swab64 | ||
54 | 65 | ||
55 | #define __arch__swab64(x) ___arch__swab64(x) | 66 | #include <linux/byteorder.h> |
56 | #define __arch__swab32(x) ___arch__swab32(x) | ||
57 | #define __arch__swab16(x) ___arch__swab16(x) | ||
58 | |||
59 | #if !defined(__STRICT_ANSI__) || defined(__KERNEL__) | ||
60 | # define __BYTEORDER_HAS_U64__ | ||
61 | # define __SWAB_64_THRU_32__ | ||
62 | #endif | ||
63 | |||
64 | #ifdef __LITTLE_ENDIAN__ | ||
65 | #include <linux/byteorder/little_endian.h> | ||
66 | #else | ||
67 | #include <linux/byteorder/big_endian.h> | ||
68 | #endif | ||
69 | 67 | ||
70 | #endif /* __ASM_SH_BYTEORDER_H */ | 68 | #endif /* __ASM_SH_BYTEORDER_H */ |