Skip to content

Commit aa0effb

Browse files
hharrisontorvalds
authored andcommitted
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>
1 parent 5bf431f commit aa0effb

6 files changed

Lines changed: 44 additions & 45 deletions

File tree

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,30 @@
1-
#ifndef _CRIS_ARCH_BYTEORDER_H
2-
#define _CRIS_ARCH_BYTEORDER_H
1+
#ifndef _CRIS_ARCH_SWAB_H
2+
#define _CRIS_ARCH_SWAB_H
33

44
#include <asm/types.h>
55
#include <linux/compiler.h>
66

7+
#define __SWAB_64_THRU_32__
8+
79
/* we just define these two (as we can do the swap in a single
810
* asm instruction in CRIS) and the arch-independent files will put
911
* them together into ntohl etc.
1012
*/
1113

12-
static inline __attribute_const__ __u32 ___arch__swab32(__u32 x)
14+
static inline __attribute_const__ __u32 __arch_swab32(__u32 x)
1315
{
1416
__asm__ ("swapwb %0" : "=r" (x) : "0" (x));
15-
17+
1618
return(x);
1719
}
20+
#define __arch_swab32 __arch_swab32
1821

19-
static inline __attribute_const__ __u16 ___arch__swab16(__u16 x)
22+
static inline __attribute_const__ __u16 __arch_swab16(__u16 x)
2023
{
2124
__asm__ ("swapb %0" : "=r" (x) : "0" (x));
22-
25+
2326
return(x);
2427
}
28+
#define __arch_swab16 __arch_swab16
2529

2630
#endif

‎arch/cris/include/arch-v32/arch/byteorder.h‎

Lines changed: 0 additions & 20 deletions
This file was deleted.
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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 */

‎arch/cris/include/asm/Kbuild‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@ header-y += sync_serial.h
99

1010
unifdef-y += etraxgpio.h
1111
unifdef-y += rs485.h
12+
unifdef-y += swab.h

‎arch/cris/include/asm/byteorder.h‎

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,7 @@
11
#ifndef _CRIS_BYTEORDER_H
22
#define _CRIS_BYTEORDER_H
33

4-
#ifdef __GNUC__
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-
4+
#include <asm/swab.h>
235
#include <linux/byteorder/little_endian.h>
246

257
#endif

‎arch/cris/include/asm/swab.h‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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 */

0 commit comments

Comments
 (0)