libfdt: Change names of sparse helper macros
The default libfdt_env.h (for POSIXish userland builds) supports sparse checking. It has a couple of helper macros, __force and __bitwise which expand the relevant sparse attributes to enable checking for incorrect or missing endian conversions. Those are bad names: for one, leading underscores are supposed to be reserved for the system libraries, and worse, some systems (including RHEL7) do define those names already. So change them to FDT_FORCE and FDT_BITWISE which are far less likely to have collisions. Suggested-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>main
parent
bad5b28049
commit
881012e443
|
@ -58,16 +58,16 @@
|
|||
#include <string.h>
|
||||
|
||||
#ifdef __CHECKER__
|
||||
#define __force __attribute__((force))
|
||||
#define __bitwise __attribute__((bitwise))
|
||||
#define FDT_FORCE __attribute__((force))
|
||||
#define FDT_BITWISE __attribute__((bitwise))
|
||||
#else
|
||||
#define __force
|
||||
#define __bitwise
|
||||
#define FDT_FORCE
|
||||
#define FDT_BITWISE
|
||||
#endif
|
||||
|
||||
typedef uint16_t __bitwise fdt16_t;
|
||||
typedef uint32_t __bitwise fdt32_t;
|
||||
typedef uint64_t __bitwise fdt64_t;
|
||||
typedef uint16_t FDT_BITWISE fdt16_t;
|
||||
typedef uint32_t FDT_BITWISE fdt32_t;
|
||||
typedef uint64_t FDT_BITWISE fdt64_t;
|
||||
|
||||
#define EXTRACT_BYTE(x, n) ((unsigned long long)((uint8_t *)&x)[n])
|
||||
#define CPU_TO_FDT16(x) ((EXTRACT_BYTE(x, 0) << 8) | EXTRACT_BYTE(x, 1))
|
||||
|
@ -80,29 +80,29 @@ typedef uint64_t __bitwise fdt64_t;
|
|||
|
||||
static inline uint16_t fdt16_to_cpu(fdt16_t x)
|
||||
{
|
||||
return (__force uint16_t)CPU_TO_FDT16(x);
|
||||
return (FDT_FORCE uint16_t)CPU_TO_FDT16(x);
|
||||
}
|
||||
static inline fdt16_t cpu_to_fdt16(uint16_t x)
|
||||
{
|
||||
return (__force fdt16_t)CPU_TO_FDT16(x);
|
||||
return (FDT_FORCE fdt16_t)CPU_TO_FDT16(x);
|
||||
}
|
||||
|
||||
static inline uint32_t fdt32_to_cpu(fdt32_t x)
|
||||
{
|
||||
return (__force uint32_t)CPU_TO_FDT32(x);
|
||||
return (FDT_FORCE uint32_t)CPU_TO_FDT32(x);
|
||||
}
|
||||
static inline fdt32_t cpu_to_fdt32(uint32_t x)
|
||||
{
|
||||
return (__force fdt32_t)CPU_TO_FDT32(x);
|
||||
return (FDT_FORCE fdt32_t)CPU_TO_FDT32(x);
|
||||
}
|
||||
|
||||
static inline uint64_t fdt64_to_cpu(fdt64_t x)
|
||||
{
|
||||
return (__force uint64_t)CPU_TO_FDT64(x);
|
||||
return (FDT_FORCE uint64_t)CPU_TO_FDT64(x);
|
||||
}
|
||||
static inline fdt64_t cpu_to_fdt64(uint64_t x)
|
||||
{
|
||||
return (__force fdt64_t)CPU_TO_FDT64(x);
|
||||
return (FDT_FORCE fdt64_t)CPU_TO_FDT64(x);
|
||||
}
|
||||
#undef CPU_TO_FDT64
|
||||
#undef CPU_TO_FDT32
|
||||
|
|
Loading…
Reference in New Issue