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

rtlwifi: Remove dependence on special bit manipulation macros for common driver

The special macros are used in several places in the base driver.
These are replaced by standard bit manipulation macros or code.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>

authored by

Larry Finger and committed by
Kalle Valo
f0dcd57e 4c8692d4

+12 -12
+2 -2
drivers/net/wireless/realtek/rtlwifi/base.h
··· 61 61 CP_MACADDR((u8 *)(_hdr)+FRAME_OFFSET_ADDRESS3, (u8 *)(_val)) 62 62 63 63 #define SET_TX_DESC_SPE_RPT(__pdesc, __val) \ 64 - SET_BITS_TO_LE_4BYTE((__pdesc) + 8, 19, 1, __val) 64 + le32p_replace_bits((__le32 *)(__pdesc + 8), __val, BIT(19)) 65 65 #define SET_TX_DESC_SW_DEFINE(__pdesc, __val) \ 66 - SET_BITS_TO_LE_4BYTE((__pdesc) + 24, 0, 12, __val) 66 + le32p_replace_bits((__le32 *)(__pdesc + 24), __val, GENMASK(11, 0)) 67 67 68 68 int rtl_init_core(struct ieee80211_hw *hw); 69 69 void rtl_deinit_core(struct ieee80211_hw *hw);
+10 -10
drivers/net/wireless/realtek/rtlwifi/ps.c
··· 737 737 find_p2p_ie = true; 738 738 /*to find noa ie*/ 739 739 while (ie + 1 < end) { 740 - noa_len = READEF2BYTE((__le16 *)&ie[1]); 740 + noa_len = le16_to_cpu(*((__le16 *)&ie[1])); 741 741 if (ie + 3 + ie[1] > end) 742 742 return; 743 743 ··· 766 766 index = 5; 767 767 for (i = 0; i < noa_num; i++) { 768 768 p2pinfo->noa_count_type[i] = 769 - READEF1BYTE(ie+index); 769 + *(u8 *)(ie + index); 770 770 index += 1; 771 771 p2pinfo->noa_duration[i] = 772 - READEF4BYTE((__le32 *)ie+index); 772 + le32_to_cpu(*(__le32 *)ie + index); 773 773 index += 4; 774 774 p2pinfo->noa_interval[i] = 775 - READEF4BYTE((__le32 *)ie+index); 775 + le32_to_cpu(*(__le32 *)ie + index); 776 776 index += 4; 777 777 p2pinfo->noa_start_time[i] = 778 - READEF4BYTE((__le32 *)ie+index); 778 + le32_to_cpu(*(__le32 *)ie + index); 779 779 index += 4; 780 780 } 781 781 ··· 832 832 RT_TRACE(rtlpriv, COMP_FW, DBG_LOUD, "action frame find P2P IE.\n"); 833 833 /*to find noa ie*/ 834 834 while (ie + 1 < end) { 835 - noa_len = READEF2BYTE((__le16 *)&ie[1]); 835 + noa_len = le16_to_cpu(*(__le16 *)&ie[1]); 836 836 if (ie + 3 + ie[1] > end) 837 837 return; 838 838 ··· 861 861 index = 5; 862 862 for (i = 0; i < noa_num; i++) { 863 863 p2pinfo->noa_count_type[i] = 864 - READEF1BYTE(ie+index); 864 + *(u8 *)(ie + index); 865 865 index += 1; 866 866 p2pinfo->noa_duration[i] = 867 - READEF4BYTE((__le32 *)ie+index); 867 + le32_to_cpu(*(__le32 *)ie + index); 868 868 index += 4; 869 869 p2pinfo->noa_interval[i] = 870 - READEF4BYTE((__le32 *)ie+index); 870 + le32_to_cpu(*(__le32 *)ie + index); 871 871 index += 4; 872 872 p2pinfo->noa_start_time[i] = 873 - READEF4BYTE((__le32 *)ie+index); 873 + le32_to_cpu(*(__le32 *)ie + index); 874 874 index += 4; 875 875 } 876 876