aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/brcm80211/include/bcmendian.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/staging/brcm80211/include/bcmendian.h')
-rw-r--r--drivers/staging/brcm80211/include/bcmendian.h36
1 files changed, 18 insertions, 18 deletions
diff --git a/drivers/staging/brcm80211/include/bcmendian.h b/drivers/staging/brcm80211/include/bcmendian.h
index 6a9ca37664f..52296fb9fc5 100644
--- a/drivers/staging/brcm80211/include/bcmendian.h
+++ b/drivers/staging/brcm80211/include/bcmendian.h
@@ -26,15 +26,15 @@
26 26
27/* Reverse the bytes in a 32-bit value */ 27/* Reverse the bytes in a 32-bit value */
28#define BCMSWAP32(val) \ 28#define BCMSWAP32(val) \
29 ((uint32)((((uint32)(val) & (uint32)0x000000ffU) << 24) | \ 29 ((u32)((((u32)(val) & (u32)0x000000ffU) << 24) | \
30 (((uint32)(val) & (uint32)0x0000ff00U) << 8) | \ 30 (((u32)(val) & (u32)0x0000ff00U) << 8) | \
31 (((uint32)(val) & (uint32)0x00ff0000U) >> 8) | \ 31 (((u32)(val) & (u32)0x00ff0000U) >> 8) | \
32 (((uint32)(val) & (uint32)0xff000000U) >> 24))) 32 (((u32)(val) & (u32)0xff000000U) >> 24)))
33 33
34/* Reverse the two 16-bit halves of a 32-bit value */ 34/* Reverse the two 16-bit halves of a 32-bit value */
35#define BCMSWAP32BY16(val) \ 35#define BCMSWAP32BY16(val) \
36 ((uint32)((((uint32)(val) & (uint32)0x0000ffffU) << 16) | \ 36 ((u32)((((u32)(val) & (u32)0x0000ffffU) << 16) | \
37 (((uint32)(val) & (uint32)0xffff0000U) >> 16))) 37 (((u32)(val) & (u32)0xffff0000U) >> 16)))
38 38
39/* Byte swapping macros 39/* Byte swapping macros
40 * Host <=> Network (Big Endian) for 16- and 32-bit values 40 * Host <=> Network (Big Endian) for 16- and 32-bit values
@@ -107,13 +107,13 @@
107#define ltoh_ua(ptr) \ 107#define ltoh_ua(ptr) \
108 (sizeof(*(ptr)) == sizeof(u8) ? *(const u8 *)(ptr) : \ 108 (sizeof(*(ptr)) == sizeof(u8) ? *(const u8 *)(ptr) : \
109 sizeof(*(ptr)) == sizeof(u16) ? _LTOH16_UA((const u8 *)(ptr)) : \ 109 sizeof(*(ptr)) == sizeof(u16) ? _LTOH16_UA((const u8 *)(ptr)) : \
110 sizeof(*(ptr)) == sizeof(uint32) ? _LTOH32_UA((const u8 *)(ptr)) : \ 110 sizeof(*(ptr)) == sizeof(u32) ? _LTOH32_UA((const u8 *)(ptr)) : \
111 *(u8 *)0) 111 *(u8 *)0)
112 112
113#define ntoh_ua(ptr) \ 113#define ntoh_ua(ptr) \
114 (sizeof(*(ptr)) == sizeof(u8) ? *(const u8 *)(ptr) : \ 114 (sizeof(*(ptr)) == sizeof(u8) ? *(const u8 *)(ptr) : \
115 sizeof(*(ptr)) == sizeof(u16) ? _NTOH16_UA((const u8 *)(ptr)) : \ 115 sizeof(*(ptr)) == sizeof(u16) ? _NTOH16_UA((const u8 *)(ptr)) : \
116 sizeof(*(ptr)) == sizeof(uint32) ? _NTOH32_UA((const u8 *)(ptr)) : \ 116 sizeof(*(ptr)) == sizeof(u32) ? _NTOH32_UA((const u8 *)(ptr)) : \
117 *(u8 *)0) 117 *(u8 *)0)
118 118
119#ifdef __GNUC__ 119#ifdef __GNUC__
@@ -128,12 +128,12 @@
128}) 128})
129 129
130#define bcmswap32(val) ({ \ 130#define bcmswap32(val) ({ \
131 uint32 _val = (val); \ 131 u32 _val = (val); \
132 BCMSWAP32(_val); \ 132 BCMSWAP32(_val); \
133}) 133})
134 134
135#define bcmswap32by16(val) ({ \ 135#define bcmswap32by16(val) ({ \
136 uint32 _val = (val); \ 136 u32 _val = (val); \
137 BCMSWAP32BY16(_val); \ 137 BCMSWAP32BY16(_val); \
138}) 138})
139 139
@@ -154,7 +154,7 @@
154}) 154})
155 155
156#define htol32_ua_store(val, bytes) ({ \ 156#define htol32_ua_store(val, bytes) ({ \
157 uint32 _val = (val); \ 157 u32 _val = (val); \
158 u8 *_bytes = (u8 *)(bytes); \ 158 u8 *_bytes = (u8 *)(bytes); \
159 _bytes[0] = _val & 0xff; \ 159 _bytes[0] = _val & 0xff; \
160 _bytes[1] = (_val >> 8) & 0xff; \ 160 _bytes[1] = (_val >> 8) & 0xff; \
@@ -170,7 +170,7 @@
170}) 170})
171 171
172#define hton32_ua_store(val, bytes) ({ \ 172#define hton32_ua_store(val, bytes) ({ \
173 uint32 _val = (val); \ 173 u32 _val = (val); \
174 u8 *_bytes = (u8 *)(bytes); \ 174 u8 *_bytes = (u8 *)(bytes); \
175 _bytes[0] = _val >> 24; \ 175 _bytes[0] = _val >> 24; \
176 _bytes[1] = (_val >> 16) & 0xff; \ 176 _bytes[1] = (_val >> 16) & 0xff; \
@@ -206,12 +206,12 @@ static inline u16 bcmswap16(u16 val)
206 return BCMSWAP16(val); 206 return BCMSWAP16(val);
207} 207}
208 208
209static inline uint32 bcmswap32(uint32 val) 209static inline u32 bcmswap32(u32 val)
210{ 210{
211 return BCMSWAP32(val); 211 return BCMSWAP32(val);
212} 212}
213 213
214static inline uint32 bcmswap32by16(uint32 val) 214static inline u32 bcmswap32by16(u32 val)
215{ 215{
216 return BCMSWAP32BY16(val); 216 return BCMSWAP32BY16(val);
217} 217}
@@ -241,7 +241,7 @@ static inline void htol16_ua_store(u16 val, u8 *bytes)
241/* 241/*
242 * Store 32-bit value to unaligned little-endian byte array. 242 * Store 32-bit value to unaligned little-endian byte array.
243 */ 243 */
244static inline void htol32_ua_store(uint32 val, u8 *bytes) 244static inline void htol32_ua_store(u32 val, u8 *bytes)
245{ 245{
246 bytes[0] = val & 0xff; 246 bytes[0] = val & 0xff;
247 bytes[1] = (val >> 8) & 0xff; 247 bytes[1] = (val >> 8) & 0xff;
@@ -261,7 +261,7 @@ static inline void hton16_ua_store(u16 val, u8 *bytes)
261/* 261/*
262 * Store 32-bit value to unaligned network-(big-)endian byte array. 262 * Store 32-bit value to unaligned network-(big-)endian byte array.
263 */ 263 */
264static inline void hton32_ua_store(uint32 val, u8 *bytes) 264static inline void hton32_ua_store(u32 val, u8 *bytes)
265{ 265{
266 bytes[0] = val >> 24; 266 bytes[0] = val >> 24;
267 bytes[1] = (val >> 16) & 0xff; 267 bytes[1] = (val >> 16) & 0xff;
@@ -280,7 +280,7 @@ static inline u16 ltoh16_ua(const void *bytes)
280/* 280/*
281 * Load 32-bit value from unaligned little-endian byte array. 281 * Load 32-bit value from unaligned little-endian byte array.
282 */ 282 */
283static inline uint32 ltoh32_ua(const void *bytes) 283static inline u32 ltoh32_ua(const void *bytes)
284{ 284{
285 return _LTOH32_UA((const u8 *)bytes); 285 return _LTOH32_UA((const u8 *)bytes);
286} 286}
@@ -296,7 +296,7 @@ static inline u16 ntoh16_ua(const void *bytes)
296/* 296/*
297 * Load 32-bit value from unaligned big-(network-)endian byte array. 297 * Load 32-bit value from unaligned big-(network-)endian byte array.
298 */ 298 */
299static inline uint32 ntoh32_ua(const void *bytes) 299static inline u32 ntoh32_ua(const void *bytes)
300{ 300{
301 return _NTOH32_UA((const u8 *)bytes); 301 return _NTOH32_UA((const u8 *)bytes);
302} 302}