linux/arch/sparc/include/asm/byteorder.h
Sam Ravnborg fffeeb4137 sparc: fix warnings in userspace header byteorder.h
Fix following warnings in byteorder.h:

byteorder.h:4: include of <linux/types.h> is preferred over <asm/types.h>
byteorder.h:9: leaks CONFIG_SPARC32 to userspace where it is not valid
byteorder.h:13: leaks CONFIG_SPARC64 to userspace where it is not valid
byteorder.h:14: found __[us]{8,16,32,64} type without #include <linux/types.h>
byteorder.h:47: leaks CONFIG_SPARC64 to userspace where it is not valid

- changed to use include <linux/types.h> as suggested
- use preprocessor defined symbols to distingush between 32 and 64 bit

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
2009-01-02 21:31:58 -08:00

50 lines
999 B
C

#ifndef _SPARC_BYTEORDER_H
#define _SPARC_BYTEORDER_H
#include <linux/types.h>
#include <asm/asi.h>
#define __BIG_ENDIAN
#if defined(__sparc__) && defined(__arch64__)
static inline __u16 __arch_swab16p(const __u16 *addr)
{
__u16 ret;
__asm__ __volatile__ ("lduha [%1] %2, %0"
: "=r" (ret)
: "r" (addr), "i" (ASI_PL));
return ret;
}
#define __arch_swab16p __arch_swab16p
static inline __u32 __arch_swab32p(const __u32 *addr)
{
__u32 ret;
__asm__ __volatile__ ("lduwa [%1] %2, %0"
: "=r" (ret)
: "r" (addr), "i" (ASI_PL));
return ret;
}
#define __arch_swab32p __arch_swab32p
static inline __u64 __arch_swab64p(const __u64 *addr)
{
__u64 ret;
__asm__ __volatile__ ("ldxa [%1] %2, %0"
: "=r" (ret)
: "r" (addr), "i" (ASI_PL));
return ret;
}
#define __arch_swab64p __arch_swab64p
#else
#define __SWAB_64_THRU_32__
#endif /* defined(__sparc__) && defined(__arch64__) */
#include <linux/byteorder.h>
#endif /* _SPARC_BYTEORDER_H */