OSDN Git Service

rtlwifi: Remove dependence on special bit manipulation macros for common driver
authorLarry Finger <Larry.Finger@lwfinger.net>
Mon, 25 Nov 2019 22:09:29 +0000 (16:09 -0600)
committerKalle Valo <kvalo@codeaurora.org>
Wed, 18 Dec 2019 18:22:29 +0000 (20:22 +0200)
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>
drivers/net/wireless/realtek/rtlwifi/base.h
drivers/net/wireless/realtek/rtlwifi/ps.c

index e4a7e07..fa92e29 100644 (file)
@@ -61,9 +61,9 @@ enum ap_peer {
        CP_MACADDR((u8 *)(_hdr)+FRAME_OFFSET_ADDRESS3, (u8 *)(_val))
 
 #define SET_TX_DESC_SPE_RPT(__pdesc, __val)                    \
-       SET_BITS_TO_LE_4BYTE((__pdesc) + 8, 19, 1, __val)
+       le32p_replace_bits((__le32 *)(__pdesc + 8), __val, BIT(19))
 #define SET_TX_DESC_SW_DEFINE(__pdesc, __val)  \
-       SET_BITS_TO_LE_4BYTE((__pdesc) + 24, 0, 12, __val)
+       le32p_replace_bits((__le32 *)(__pdesc + 24), __val, GENMASK(11, 0))
 
 int rtl_init_core(struct ieee80211_hw *hw);
 void rtl_deinit_core(struct ieee80211_hw *hw);
index e5e1ec5..bc0ac96 100644 (file)
@@ -737,7 +737,7 @@ static void rtl_p2p_noa_ie(struct ieee80211_hw *hw, void *data,
        find_p2p_ie = true;
        /*to find noa ie*/
        while (ie + 1 < end) {
-               noa_len = READEF2BYTE((__le16 *)&ie[1]);
+               noa_len = le16_to_cpu(*((__le16 *)&ie[1]));
                if (ie + 3 + ie[1] > end)
                        return;
 
@@ -766,16 +766,16 @@ static void rtl_p2p_noa_ie(struct ieee80211_hw *hw, void *data,
                                index = 5;
                                for (i = 0; i < noa_num; i++) {
                                        p2pinfo->noa_count_type[i] =
-                                                       READEF1BYTE(ie+index);
+                                        *(u8 *)(ie + index);
                                        index += 1;
                                        p2pinfo->noa_duration[i] =
-                                                READEF4BYTE((__le32 *)ie+index);
+                                        le32_to_cpu(*(__le32 *)ie + index);
                                        index += 4;
                                        p2pinfo->noa_interval[i] =
-                                                READEF4BYTE((__le32 *)ie+index);
+                                        le32_to_cpu(*(__le32 *)ie + index);
                                        index += 4;
                                        p2pinfo->noa_start_time[i] =
-                                                READEF4BYTE((__le32 *)ie+index);
+                                        le32_to_cpu(*(__le32 *)ie + index);
                                        index += 4;
                                }
 
@@ -832,7 +832,7 @@ static void rtl_p2p_action_ie(struct ieee80211_hw *hw, void *data,
        RT_TRACE(rtlpriv, COMP_FW, DBG_LOUD, "action frame find P2P IE.\n");
        /*to find noa ie*/
        while (ie + 1 < end) {
-               noa_len = READEF2BYTE((__le16 *)&ie[1]);
+               noa_len = le16_to_cpu(*(__le16 *)&ie[1]);
                if (ie + 3 + ie[1] > end)
                        return;
 
@@ -861,16 +861,16 @@ static void rtl_p2p_action_ie(struct ieee80211_hw *hw, void *data,
                                index = 5;
                                for (i = 0; i < noa_num; i++) {
                                        p2pinfo->noa_count_type[i] =
-                                                       READEF1BYTE(ie+index);
+                                        *(u8 *)(ie + index);
                                        index += 1;
                                        p2pinfo->noa_duration[i] =
-                                                        READEF4BYTE((__le32 *)ie+index);
+                                        le32_to_cpu(*(__le32 *)ie + index);
                                        index += 4;
                                        p2pinfo->noa_interval[i] =
-                                                        READEF4BYTE((__le32 *)ie+index);
+                                        le32_to_cpu(*(__le32 *)ie + index);
                                        index += 4;
                                        p2pinfo->noa_start_time[i] =
-                                                        READEF4BYTE((__le32 *)ie+index);
+                                        le32_to_cpu(*(__le32 *)ie + index);
                                        index += 4;
                                }