Commit acf0108a authored by Harvey Harrison's avatar Harvey Harrison Committed by Linus Torvalds

byteorder: use generic C version for value byteswapping

This makes the new implementation of the byteorder helpers match the old
in how it degraded when an arch-defined version was not available:

1) swab()
	- look for arch defined
	- if not, use generic c version

2) swabp()
	- look for arch-defined
	- if not, deref pointer and use swab()

3) swabs()
	- look for arch defined
	- if not, use swabp
Signed-off-by: default avatarHarvey Harrison <harvey.harrison@gmail.com>
Cc: "David S. Miller" <davem@davemloft.net>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent b8e465f4
...@@ -47,8 +47,6 @@ static inline __attribute_const__ __u16 ___swab16(__u16 val) ...@@ -47,8 +47,6 @@ static inline __attribute_const__ __u16 ___swab16(__u16 val)
{ {
#ifdef __arch_swab16 #ifdef __arch_swab16
return __arch_swab16(val); return __arch_swab16(val);
#elif defined(__arch_swab16p)
return __arch_swab16p(&val);
#else #else
return __const_swab16(val); return __const_swab16(val);
#endif #endif
...@@ -58,8 +56,6 @@ static inline __attribute_const__ __u32 ___swab32(__u32 val) ...@@ -58,8 +56,6 @@ static inline __attribute_const__ __u32 ___swab32(__u32 val)
{ {
#ifdef __arch_swab32 #ifdef __arch_swab32
return __arch_swab32(val); return __arch_swab32(val);
#elif defined(__arch_swab32p)
return __arch_swab32p(&val);
#else #else
return __const_swab32(val); return __const_swab32(val);
#endif #endif
...@@ -69,8 +65,6 @@ static inline __attribute_const__ __u64 ___swab64(__u64 val) ...@@ -69,8 +65,6 @@ static inline __attribute_const__ __u64 ___swab64(__u64 val)
{ {
#ifdef __arch_swab64 #ifdef __arch_swab64
return __arch_swab64(val); return __arch_swab64(val);
#elif defined(__arch_swab64p)
return __arch_swab64p(&val);
#elif defined(__SWAB_64_THRU_32__) #elif defined(__SWAB_64_THRU_32__)
__u32 h = val >> 32; __u32 h = val >> 32;
__u32 l = val & ((1ULL << 32) - 1); __u32 l = val & ((1ULL << 32) - 1);
...@@ -84,8 +78,6 @@ static inline __attribute_const__ __u32 ___swahw32(__u32 val) ...@@ -84,8 +78,6 @@ static inline __attribute_const__ __u32 ___swahw32(__u32 val)
{ {
#ifdef __arch_swahw32 #ifdef __arch_swahw32
return __arch_swahw32(val); return __arch_swahw32(val);
#elif defined(__arch_swahw32p)
return __arch_swahw32p(&val);
#else #else
return __const_swahw32(val); return __const_swahw32(val);
#endif #endif
...@@ -95,8 +87,6 @@ static inline __attribute_const__ __u32 ___swahb32(__u32 val) ...@@ -95,8 +87,6 @@ static inline __attribute_const__ __u32 ___swahb32(__u32 val)
{ {
#ifdef __arch_swahb32 #ifdef __arch_swahb32
return __arch_swahb32(val); return __arch_swahb32(val);
#elif defined(__arch_swahb32p)
return __arch_swahb32p(&val);
#else #else
return __const_swahb32(val); return __const_swahb32(val);
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment