File tree Expand file tree Collapse file tree 2 files changed +11
-1
lines changed
tools/testing/selftests/riscv/hwprobe Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change 19
19
#include "hwprobe.h"
20
20
#include "../../kselftest.h"
21
21
22
- #define MK_CBO (fn ) cpu_to_le32( (fn) << 20 | 10 << 15 | 2 << 12 | 0 << 7 | 15)
22
+ #define MK_CBO (fn ) le32_bswap((uint32_t) (fn) << 20 | 10 << 15 | 2 << 12 | 0 << 7 | 15)
23
23
24
24
static char mem [4096 ] __aligned (4096 ) = { [0 ... 4095 ] = 0xa5 };
25
25
Original file line number Diff line number Diff line change 4
4
#include <stddef.h>
5
5
#include <asm/hwprobe.h>
6
6
7
+ #if __BYTE_ORDER == __BIG_ENDIAN
8
+ # define le32_bswap (_x ) \
9
+ ((((_x) & 0x000000ffU) << 24) | \
10
+ (((_x) & 0x0000ff00U) << 8) | \
11
+ (((_x) & 0x00ff0000U) >> 8) | \
12
+ (((_x) & 0xff000000U) >> 24))
13
+ #else
14
+ # define le32_bswap (_x ) (_x)
15
+ #endif
16
+
7
17
/*
8
18
* Rather than relying on having a new enough libc to define this, just do it
9
19
* ourselves. This way we don't need to be coupled to a new-enough libc to
You can’t perform that action at this time.
0 commit comments