Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: Harvey Harrison <harvey.harrison@gmail.com>
Cc: "David S. Miller" <davem@davemloft.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Harvey Harrison and committed by
Linus Torvalds
acf0108a b8e465f4

-10
-10
include/linux/swab.h
··· 47 47 { 48 48 #ifdef __arch_swab16 49 49 return __arch_swab16(val); 50 - #elif defined(__arch_swab16p) 51 - return __arch_swab16p(&val); 52 50 #else 53 51 return __const_swab16(val); 54 52 #endif ··· 56 58 { 57 59 #ifdef __arch_swab32 58 60 return __arch_swab32(val); 59 - #elif defined(__arch_swab32p) 60 - return __arch_swab32p(&val); 61 61 #else 62 62 return __const_swab32(val); 63 63 #endif ··· 65 69 { 66 70 #ifdef __arch_swab64 67 71 return __arch_swab64(val); 68 - #elif defined(__arch_swab64p) 69 - return __arch_swab64p(&val); 70 72 #elif defined(__SWAB_64_THRU_32__) 71 73 __u32 h = val >> 32; 72 74 __u32 l = val & ((1ULL << 32) - 1); ··· 78 84 { 79 85 #ifdef __arch_swahw32 80 86 return __arch_swahw32(val); 81 - #elif defined(__arch_swahw32p) 82 - return __arch_swahw32p(&val); 83 87 #else 84 88 return __const_swahw32(val); 85 89 #endif ··· 87 95 { 88 96 #ifdef __arch_swahb32 89 97 return __arch_swahb32(val); 90 - #elif defined(__arch_swahb32p) 91 - return __arch_swahb32p(&val); 92 98 #else 93 99 return __const_swahb32(val); 94 100 #endif