rtlwifi: avoid accessing RCR directly
authorPeter Wu <lekensteyn@gmail.com>
Fri, 14 Feb 2014 18:03:44 +0000 (19:03 +0100)
committerJohn W. Linville <linville@tuxdriver.com>
Mon, 24 Feb 2014 20:21:53 +0000 (15:21 -0500)
The rtl*_set_check_bssid functions are mostly the same, but access the
RCR register in different ways. Use the get_hw_reg abstraction layer
(which reads rtlpci->receive_config for PCI devices and mac->rx_conf for
USB).

There is no functional change for cases where receive_config was
accessed directly. For rtl8192ce, there is still no change because
nothing modifies REG_RCR or receive_config. For rtl8192cu, it now also
applies changes to rx_conf from configure_filter, but that can be
considered a bug which is fixed later.

Signed-off-by: Peter Wu <lekensteyn@gmail.com>
Acked-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/rtlwifi/rtl8188ee/hw.c
drivers/net/wireless/rtlwifi/rtl8192ce/hw.c
drivers/net/wireless/rtlwifi/rtl8192cu/hw.c
drivers/net/wireless/rtlwifi/rtl8192de/hw.c
drivers/net/wireless/rtlwifi/rtl8192se/hw.c
drivers/net/wireless/rtlwifi/rtl8723ae/hw.c

index e06971be7df77e047e8d869d046a126d0e987d14..ce2226cd2e4f82d54f15e81768a43a92d78426c8 100644 (file)
@@ -1235,12 +1235,13 @@ static int _rtl88ee_set_media_status(struct ieee80211_hw *hw,
 void rtl88ee_set_check_bssid(struct ieee80211_hw *hw, bool check_bssid)
 {
        struct rtl_priv *rtlpriv = rtl_priv(hw);
-       struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw));
-       u32 reg_rcr = rtlpci->receive_config;
+       u32 reg_rcr;
 
        if (rtlpriv->psc.rfpwr_state != ERFON)
                return;
 
+       rtlpriv->cfg->ops->get_hw_reg(hw, HW_VAR_RCR, (u8 *)(&reg_rcr));
+
        if (check_bssid == true) {
                reg_rcr |= (RCR_CBSSID_DATA | RCR_CBSSID_BCN);
                rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_RCR,
index a82b30a1996ca97cc5041ac47899171fef15e25e..25e178c80d704ee7efc35235e329e96a92c4604d 100644 (file)
@@ -1200,11 +1200,13 @@ static int _rtl92ce_set_media_status(struct ieee80211_hw *hw,
 void rtl92ce_set_check_bssid(struct ieee80211_hw *hw, bool check_bssid)
 {
        struct rtl_priv *rtlpriv = rtl_priv(hw);
-       u32 reg_rcr = rtl_read_dword(rtlpriv, REG_RCR);
+       u32 reg_rcr;
 
        if (rtlpriv->psc.rfpwr_state != ERFON)
                return;
 
+       rtlpriv->cfg->ops->get_hw_reg(hw, HW_VAR_RCR, (u8 *)(&reg_rcr));
+
        if (check_bssid) {
                reg_rcr |= (RCR_CBSSID_DATA | RCR_CBSSID_BCN);
                rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_RCR,
index 468bf73cc883f41bf26222cc7aa52e17c5ed96a3..49ad10668078763440522db7e49516711efc0b26 100644 (file)
@@ -1379,11 +1379,13 @@ void rtl92cu_set_check_bssid(struct ieee80211_hw *hw, bool check_bssid)
 {
        struct rtl_priv *rtlpriv = rtl_priv(hw);
        struct rtl_hal *rtlhal = rtl_hal(rtlpriv);
-       u32 reg_rcr = rtl_read_dword(rtlpriv, REG_RCR);
+       u32 reg_rcr;
 
        if (rtlpriv->psc.rfpwr_state != ERFON)
                return;
 
+       rtlpriv->cfg->ops->get_hw_reg(hw, HW_VAR_RCR, (u8 *)(&reg_rcr));
+
        if (check_bssid) {
                u8 tmp;
                if (IS_NORMAL_CHIP(rtlhal->version)) {
index c4a7db9135d6e3850dcd8490e5e9165807178b64..c16aa6b595271c259b8fd103100e08e3faeb5baf 100644 (file)
@@ -1138,11 +1138,13 @@ static int _rtl92de_set_media_status(struct ieee80211_hw *hw,
 void rtl92de_set_check_bssid(struct ieee80211_hw *hw, bool check_bssid)
 {
        struct rtl_priv *rtlpriv = rtl_priv(hw);
-       struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw));
-       u32 reg_rcr = rtlpci->receive_config;
+       u32 reg_rcr;
 
        if (rtlpriv->psc.rfpwr_state != ERFON)
                return;
+
+       rtlpriv->cfg->ops->get_hw_reg(hw, HW_VAR_RCR, (u8 *)(&reg_rcr));
+
        if (check_bssid) {
                reg_rcr |= (RCR_CBSSID_DATA | RCR_CBSSID_BCN);
                rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_RCR, (u8 *)(&reg_rcr));
index 4f461786a7eb24abb3ae49a1dbccc4311d54ea58..5aa39ef42eba815c1660aafc48647b3dad912090 100644 (file)
@@ -1135,12 +1135,13 @@ void rtl92se_set_mac_addr(struct rtl_io *io, const u8 *addr)
 void rtl92se_set_check_bssid(struct ieee80211_hw *hw, bool check_bssid)
 {
        struct rtl_priv *rtlpriv = rtl_priv(hw);
-       struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw));
-       u32 reg_rcr = rtlpci->receive_config;
+       u32 reg_rcr;
 
        if (rtlpriv->psc.rfpwr_state != ERFON)
                return;
 
+       rtlpriv->cfg->ops->get_hw_reg(hw, HW_VAR_RCR, (u8 *)(&reg_rcr));
+
        if (check_bssid) {
                reg_rcr |= (RCR_CBSSID);
                rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_RCR, (u8 *)(&reg_rcr));
index c333dfd116b868a8aff3dcf780e04611860d7951..4680816f9597198d17ac8fa7d893df67ed1c3a71 100644 (file)
@@ -1112,12 +1112,13 @@ static int _rtl8723ae_set_media_status(struct ieee80211_hw *hw,
 void rtl8723ae_set_check_bssid(struct ieee80211_hw *hw, bool check_bssid)
 {
        struct rtl_priv *rtlpriv = rtl_priv(hw);
-       struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw));
-       u32 reg_rcr = rtlpci->receive_config;
+       u32 reg_rcr;
 
        if (rtlpriv->psc.rfpwr_state != ERFON)
                return;
 
+       rtlpriv->cfg->ops->get_hw_reg(hw, HW_VAR_RCR, (u8 *)(&reg_rcr));
+
        if (check_bssid == true) {
                reg_rcr |= (RCR_CBSSID_DATA | RCR_CBSSID_BCN);
                rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_RCR,