diff options
author | Harvey Harrison <harvey.harrison@gmail.com> | 2009-01-13 22:31:29 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-01-14 22:56:49 -0500 |
commit | aa0effbd1c0269ce7dd13be8dbf13e6b04f30ebd (patch) | |
tree | a58e482f511aa2c79a3ca9d3025ec9ffe55c405e | |
parent | 5bf431fa32c52e7027c4af85c7afc82326fa6d43 (diff) |
cris: introduce asm/swab.h
Adjust the arch overrides to the new names as well.
Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | arch/cris/include/arch-v10/arch/swab.h (renamed from arch/cris/include/arch-v10/arch/byteorder.h) | 16 | ||||
-rw-r--r-- | arch/cris/include/arch-v32/arch/byteorder.h | 20 | ||||
-rw-r--r-- | arch/cris/include/arch-v32/arch/swab.h | 24 | ||||
-rw-r--r-- | arch/cris/include/asm/Kbuild | 1 | ||||
-rw-r--r-- | arch/cris/include/asm/byteorder.h | 20 | ||||
-rw-r--r-- | arch/cris/include/asm/swab.h | 8 |
6 files changed, 44 insertions, 45 deletions
diff --git a/arch/cris/include/arch-v10/arch/byteorder.h b/arch/cris/include/arch-v10/arch/swab.h index 255b646b7fa8..e4e847d8a05e 100644 --- a/arch/cris/include/arch-v10/arch/byteorder.h +++ b/arch/cris/include/arch-v10/arch/swab.h | |||
@@ -1,26 +1,30 @@ | |||
1 | #ifndef _CRIS_ARCH_BYTEORDER_H | 1 | #ifndef _CRIS_ARCH_SWAB_H |
2 | #define _CRIS_ARCH_BYTEORDER_H | 2 | #define _CRIS_ARCH_SWAB_H |
3 | 3 | ||
4 | #include <asm/types.h> | 4 | #include <asm/types.h> |
5 | #include <linux/compiler.h> | 5 | #include <linux/compiler.h> |
6 | 6 | ||
7 | #define __SWAB_64_THRU_32__ | ||
8 | |||
7 | /* we just define these two (as we can do the swap in a single | 9 | /* we just define these two (as we can do the swap in a single |
8 | * asm instruction in CRIS) and the arch-independent files will put | 10 | * asm instruction in CRIS) and the arch-independent files will put |
9 | * them together into ntohl etc. | 11 | * them together into ntohl etc. |
10 | */ | 12 | */ |
11 | 13 | ||
12 | static inline __attribute_const__ __u32 ___arch__swab32(__u32 x) | 14 | static inline __attribute_const__ __u32 __arch_swab32(__u32 x) |
13 | { | 15 | { |
14 | __asm__ ("swapwb %0" : "=r" (x) : "0" (x)); | 16 | __asm__ ("swapwb %0" : "=r" (x) : "0" (x)); |
15 | 17 | ||
16 | return(x); | 18 | return(x); |
17 | } | 19 | } |
20 | #define __arch_swab32 __arch_swab32 | ||
18 | 21 | ||
19 | static inline __attribute_const__ __u16 ___arch__swab16(__u16 x) | 22 | static inline __attribute_const__ __u16 __arch_swab16(__u16 x) |
20 | { | 23 | { |
21 | __asm__ ("swapb %0" : "=r" (x) : "0" (x)); | 24 | __asm__ ("swapb %0" : "=r" (x) : "0" (x)); |
22 | 25 | ||
23 | return(x); | 26 | return(x); |
24 | } | 27 | } |
28 | #define __arch_swab16 __arch_swab16 | ||
25 | 29 | ||
26 | #endif | 30 | #endif |
diff --git a/arch/cris/include/arch-v32/arch/byteorder.h b/arch/cris/include/arch-v32/arch/byteorder.h deleted file mode 100644 index 6ef8fb4a35f2..000000000000 --- a/arch/cris/include/arch-v32/arch/byteorder.h +++ /dev/null | |||
@@ -1,20 +0,0 @@ | |||
1 | #ifndef _ASM_CRIS_ARCH_BYTEORDER_H | ||
2 | #define _ASM_CRIS_ARCH_BYTEORDER_H | ||
3 | |||
4 | #include <asm/types.h> | ||
5 | |||
6 | static inline __const__ __u32 | ||
7 | ___arch__swab32(__u32 x) | ||
8 | { | ||
9 | __asm__ __volatile__ ("swapwb %0" : "=r" (x) : "0" (x)); | ||
10 | return (x); | ||
11 | } | ||
12 | |||
13 | static inline __const__ __u16 | ||
14 | ___arch__swab16(__u16 x) | ||
15 | { | ||
16 | __asm__ __volatile__ ("swapb %0" : "=r" (x) : "0" (x)); | ||
17 | return (x); | ||
18 | } | ||
19 | |||
20 | #endif /* _ASM_CRIS_ARCH_BYTEORDER_H */ | ||
diff --git a/arch/cris/include/arch-v32/arch/swab.h b/arch/cris/include/arch-v32/arch/swab.h new file mode 100644 index 000000000000..9a4ea5e209c2 --- /dev/null +++ b/arch/cris/include/arch-v32/arch/swab.h | |||
@@ -0,0 +1,24 @@ | |||
1 | #ifndef _ASM_CRIS_ARCH_SWAB_H | ||
2 | #define _ASM_CRIS_ARCH_SWAB_H | ||
3 | |||
4 | #include <asm/types.h> | ||
5 | |||
6 | #define __SWAB_64_THRU_32__ | ||
7 | |||
8 | static inline __const__ __u32 | ||
9 | __arch_swab32(__u32 x) | ||
10 | { | ||
11 | __asm__ __volatile__ ("swapwb %0" : "=r" (x) : "0" (x)); | ||
12 | return (x); | ||
13 | } | ||
14 | #define __arch_swab32 __arch_swab32 | ||
15 | |||
16 | static inline __const__ __u16 | ||
17 | __arch_swab16(__u16 x) | ||
18 | { | ||
19 | __asm__ __volatile__ ("swapb %0" : "=r" (x) : "0" (x)); | ||
20 | return (x); | ||
21 | } | ||
22 | #define __arch_swab16 __arch_swab16 | ||
23 | |||
24 | #endif /* _ASM_CRIS_ARCH_SWAB_H */ | ||
diff --git a/arch/cris/include/asm/Kbuild b/arch/cris/include/asm/Kbuild index d5b631935ec8..b79b7c6543a6 100644 --- a/arch/cris/include/asm/Kbuild +++ b/arch/cris/include/asm/Kbuild | |||
@@ -9,3 +9,4 @@ header-y += sync_serial.h | |||
9 | 9 | ||
10 | unifdef-y += etraxgpio.h | 10 | unifdef-y += etraxgpio.h |
11 | unifdef-y += rs485.h | 11 | unifdef-y += rs485.h |
12 | unifdef-y += swab.h | ||
diff --git a/arch/cris/include/asm/byteorder.h b/arch/cris/include/asm/byteorder.h index cc8e418cfd14..7678d86317ae 100644 --- a/arch/cris/include/asm/byteorder.h +++ b/arch/cris/include/asm/byteorder.h | |||
@@ -1,25 +1,7 @@ | |||
1 | #ifndef _CRIS_BYTEORDER_H | 1 | #ifndef _CRIS_BYTEORDER_H |
2 | #define _CRIS_BYTEORDER_H | 2 | #define _CRIS_BYTEORDER_H |
3 | 3 | ||
4 | #ifdef __GNUC__ | 4 | #include <asm/swab.h> |
5 | |||
6 | #ifdef __KERNEL__ | ||
7 | #include <arch/byteorder.h> | ||
8 | |||
9 | /* defines are necessary because the other files detect the presence | ||
10 | * of a defined __arch_swab32, not an inline | ||
11 | */ | ||
12 | #define __arch__swab32(x) ___arch__swab32(x) | ||
13 | #define __arch__swab16(x) ___arch__swab16(x) | ||
14 | #endif /* __KERNEL__ */ | ||
15 | |||
16 | #if !defined(__STRICT_ANSI__) || defined(__KERNEL__) | ||
17 | # define __BYTEORDER_HAS_U64__ | ||
18 | # define __SWAB_64_THRU_32__ | ||
19 | #endif | ||
20 | |||
21 | #endif /* __GNUC__ */ | ||
22 | |||
23 | #include <linux/byteorder/little_endian.h> | 5 | #include <linux/byteorder/little_endian.h> |
24 | 6 | ||
25 | #endif | 7 | #endif |
diff --git a/arch/cris/include/asm/swab.h b/arch/cris/include/asm/swab.h new file mode 100644 index 000000000000..80668e88419c --- /dev/null +++ b/arch/cris/include/asm/swab.h | |||
@@ -0,0 +1,8 @@ | |||
1 | #ifndef _CRIS_SWAB_H | ||
2 | #define _CRIS_SWAB_H | ||
3 | |||
4 | #ifdef __KERNEL__ | ||
5 | #include <arch/swab.h> | ||
6 | #endif /* __KERNEL__ */ | ||
7 | |||
8 | #endif /* _CRIS_SWAB_H */ | ||