diff options
author | Larry Finger <Larry.Finger@lwfinger.net> | 2017-01-19 23:28:08 +0300 |
---|---|---|
committer | Kalle Valo <kvalo@codeaurora.org> | 2017-01-20 13:06:10 +0300 |
commit | 106e0deca1ac6ac627a10617fe77a95200cb01a7 (patch) | |
tree | 34ea5ce0952c1122cca17117817519cd96e441e3 /drivers/net/wireless/realtek/rtlwifi/wifi.h | |
parent | 69d8597e9fe5ca76da8ad18245d51af96cf8457a (diff) | |
download | linux-106e0deca1ac6ac627a10617fe77a95200cb01a7.tar.xz |
rtlwifi: rtl8192cu: Convert driver to use common macros
These drivers use a set of complicated macros to extract and insert
information for the RX and TX descriptors. Driver rtl8192cu had a
different set than was used for the PCI-based drivers. To simplify
the code, rtl8192cu is switched to use the common version. In the
process, two errors in those common macros were found and fixed.
Besides simplifying the code, there is an additional benefit. We have
no BE hardware to test the PCI driver, but using the common macros
provides an additional test for the validity of many endian-sensitive
operations.
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Diffstat (limited to 'drivers/net/wireless/realtek/rtlwifi/wifi.h')
-rw-r--r-- | drivers/net/wireless/realtek/rtlwifi/wifi.h | 23 |
1 files changed, 7 insertions, 16 deletions
diff --git a/drivers/net/wireless/realtek/rtlwifi/wifi.h b/drivers/net/wireless/realtek/rtlwifi/wifi.h index 262c02a347cf..310fa90200b2 100644 --- a/drivers/net/wireless/realtek/rtlwifi/wifi.h +++ b/drivers/net/wireless/realtek/rtlwifi/wifi.h @@ -2704,23 +2704,14 @@ enum bt_radio_shared { (le32_to_cpu(_val)) /* Read data from memory */ -#define READEF1BYTE(_ptr) \ +#define READEF1BYTE(_ptr) \ EF1BYTE(*((u8 *)(_ptr))) /* Read le16 data from memory and convert to host ordering */ -#define READEF2BYTE(_ptr) \ +#define READEF2BYTE(_ptr) \ EF2BYTE(*(_ptr)) -#define READEF4BYTE(_ptr) \ +#define READEF4BYTE(_ptr) \ EF4BYTE(*(_ptr)) -/* Write data to memory */ -#define WRITEEF1BYTE(_ptr, _val) \ - (*((u8 *)(_ptr))) = EF1BYTE(_val) -/* Write le16 data to memory in host ordering */ -#define WRITEEF2BYTE(_ptr, _val) \ - (*((u16 *)(_ptr))) = EF2BYTE(_val) -#define WRITEEF4BYTE(_ptr, _val) \ - (*((u32 *)(_ptr))) = EF2BYTE(_val) - /* Create a bit mask * Examples: * BIT_LEN_MASK_32(0) => 0x00000000 @@ -2801,14 +2792,14 @@ value to host byte ordering.*/ * Set subfield of little-endian 4-byte value to specified value. */ #define SET_BITS_TO_LE_4BYTE(__pstart, __bitoffset, __bitlen, __val) \ - *((u32 *)(__pstart)) = \ - ( \ + *((__le32 *)(__pstart)) = \ + cpu_to_le32( \ LE_BITS_CLEARED_TO_4BYTE(__pstart, __bitoffset, __bitlen) | \ ((((u32)__val) & BIT_LEN_MASK_32(__bitlen)) << (__bitoffset)) \ ); #define SET_BITS_TO_LE_2BYTE(__pstart, __bitoffset, __bitlen, __val) \ - *((u16 *)(__pstart)) = \ - ( \ + *((__le16 *)(__pstart)) = \ + cpu_to_le16( \ LE_BITS_CLEARED_TO_2BYTE(__pstart, __bitoffset, __bitlen) | \ ((((u16)__val) & BIT_LEN_MASK_16(__bitlen)) << (__bitoffset)) \ ); |