staging: brcm80211: Remove swaps in R_REG and W_REG macros
Swapping the addresses is unnecessary, since the swaps are handled by the underlying platform code (i.e. readb() etc. handle any necessary swapping). Tested on Mac G5 PPC and BCM63281. Signed-off-by: Henry Ptasinski <henryp@broadcom.com> Reviewed-by: Arend van Spriel <arend@broadcom.com> Tested-by: Jonas Gorski <jonas.gorski@gmail.com> Signed-off-by: Arend van Spriel <arend@broadcom.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
parent
8ac98a56fa
commit
ba1fff7f70
|
@ -329,28 +329,17 @@ do { \
|
||||||
* location are defined in only one spot. This reduces the risk of the
|
* location are defined in only one spot. This reduces the risk of the
|
||||||
* programmer trying to use an unsupported transaction size on a register.
|
* programmer trying to use an unsupported transaction size on a register.
|
||||||
*
|
*
|
||||||
* For big endian operation, a byte swap has to be done. Eg, when attempting
|
|
||||||
* to read byte address 0, byte 3 should be read. This is accomplished
|
|
||||||
* using an xor ('^') operator.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __BIG_ENDIAN
|
|
||||||
#define SWP2(r) (r)
|
|
||||||
#define SWP3(r) (r)
|
|
||||||
#else
|
|
||||||
#define SWP2(r) ((unsigned long)(r)^2)
|
|
||||||
#define SWP3(r) ((unsigned long)(r)^3)
|
|
||||||
#endif /* __BIG_ENDIAN */
|
|
||||||
|
|
||||||
#define R_REG(r) \
|
#define R_REG(r) \
|
||||||
({ \
|
({ \
|
||||||
__typeof(*(r)) __osl_v; \
|
__typeof(*(r)) __osl_v; \
|
||||||
switch (sizeof(*(r))) { \
|
switch (sizeof(*(r))) { \
|
||||||
case sizeof(u8): \
|
case sizeof(u8): \
|
||||||
__osl_v = readb((u8 *)(SWP3(r))); \
|
__osl_v = readb((u8 *)(r)); \
|
||||||
break; \
|
break; \
|
||||||
case sizeof(u16): \
|
case sizeof(u16): \
|
||||||
__osl_v = readw((u16 *)(SWP2(r))); \
|
__osl_v = readw((u16 *)(r)); \
|
||||||
break; \
|
break; \
|
||||||
case sizeof(u32): \
|
case sizeof(u32): \
|
||||||
__osl_v = readl((u32 *)(r)); \
|
__osl_v = readl((u32 *)(r)); \
|
||||||
|
@ -362,10 +351,10 @@ do { \
|
||||||
#define W_REG(r, v) do { \
|
#define W_REG(r, v) do { \
|
||||||
switch (sizeof(*(r))) { \
|
switch (sizeof(*(r))) { \
|
||||||
case sizeof(u8): \
|
case sizeof(u8): \
|
||||||
writeb((u8)(v), (u8 *)(SWP3(r))); \
|
writeb((u8)(v), (u8 *)(r)); \
|
||||||
break; \
|
break; \
|
||||||
case sizeof(u16): \
|
case sizeof(u16): \
|
||||||
writew((u16)(v), (u16 *)(SWP2(r))); \
|
writew((u16)(v), (u16 *)(r)); \
|
||||||
break; \
|
break; \
|
||||||
case sizeof(u32): \
|
case sizeof(u32): \
|
||||||
writel((u32)(v), (u32 *)(r)); \
|
writel((u32)(v), (u32 *)(r)); \
|
||||||
|
|
Loading…
Reference in New Issue