aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/rtlwifi
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/rtlwifi')
-rw-r--r--drivers/net/wireless/rtlwifi/base.c4
-rw-r--r--drivers/net/wireless/rtlwifi/efuse.c6
-rw-r--r--drivers/net/wireless/rtlwifi/pci.c39
-rw-r--r--drivers/net/wireless/rtlwifi/ps.c48
-rw-r--r--drivers/net/wireless/rtlwifi/regd.c18
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192c/fw_common.c2
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192c/phy_common.c12
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192ce/hw.c9
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192ce/phy.c14
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192ce/trx.c4
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192cu/mac.c2
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192cu/phy.c2
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192se/dm.c5
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192se/fw.c2
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192se/hw.c12
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192se/phy.c18
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192se/trx.c6
-rw-r--r--drivers/net/wireless/rtlwifi/wifi.h2
18 files changed, 71 insertions, 134 deletions
diff --git a/drivers/net/wireless/rtlwifi/base.c b/drivers/net/wireless/rtlwifi/base.c
index ccb6da38fe22..fb5e43bd7c3c 100644
--- a/drivers/net/wireless/rtlwifi/base.c
+++ b/drivers/net/wireless/rtlwifi/base.c
@@ -888,7 +888,6 @@ int rtl_tx_agg_stop(struct ieee80211_hw *hw,
888{ 888{
889 struct rtl_priv *rtlpriv = rtl_priv(hw); 889 struct rtl_priv *rtlpriv = rtl_priv(hw);
890 struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); 890 struct rtl_mac *mac = rtl_mac(rtl_priv(hw));
891 struct rtl_tid_data *tid_data;
892 struct rtl_sta_info *sta_entry = NULL; 891 struct rtl_sta_info *sta_entry = NULL;
893 892
894 if (sta == NULL) 893 if (sta == NULL)
@@ -906,7 +905,6 @@ int rtl_tx_agg_stop(struct ieee80211_hw *hw,
906 return -EINVAL; 905 return -EINVAL;
907 906
908 sta_entry = (struct rtl_sta_info *)sta->drv_priv; 907 sta_entry = (struct rtl_sta_info *)sta->drv_priv;
909 tid_data = &sta_entry->tids[tid];
910 sta_entry->tids[tid].agg.agg_state = RTL_AGG_STOP; 908 sta_entry->tids[tid].agg.agg_state = RTL_AGG_STOP;
911 909
912 ieee80211_stop_tx_ba_cb_irqsafe(mac->vif, sta->addr, tid); 910 ieee80211_stop_tx_ba_cb_irqsafe(mac->vif, sta->addr, tid);
@@ -918,7 +916,6 @@ int rtl_tx_agg_oper(struct ieee80211_hw *hw,
918 struct ieee80211_sta *sta, u16 tid) 916 struct ieee80211_sta *sta, u16 tid)
919{ 917{
920 struct rtl_priv *rtlpriv = rtl_priv(hw); 918 struct rtl_priv *rtlpriv = rtl_priv(hw);
921 struct rtl_tid_data *tid_data;
922 struct rtl_sta_info *sta_entry = NULL; 919 struct rtl_sta_info *sta_entry = NULL;
923 920
924 if (sta == NULL) 921 if (sta == NULL)
@@ -936,7 +933,6 @@ int rtl_tx_agg_oper(struct ieee80211_hw *hw,
936 return -EINVAL; 933 return -EINVAL;
937 934
938 sta_entry = (struct rtl_sta_info *)sta->drv_priv; 935 sta_entry = (struct rtl_sta_info *)sta->drv_priv;
939 tid_data = &sta_entry->tids[tid];
940 sta_entry->tids[tid].agg.agg_state = RTL_AGG_OPERATIONAL; 936 sta_entry->tids[tid].agg.agg_state = RTL_AGG_OPERATIONAL;
941 937
942 return 0; 938 return 0;
diff --git a/drivers/net/wireless/rtlwifi/efuse.c b/drivers/net/wireless/rtlwifi/efuse.c
index 50de6f5d8a56..0b562322f138 100644
--- a/drivers/net/wireless/rtlwifi/efuse.c
+++ b/drivers/net/wireless/rtlwifi/efuse.c
@@ -925,7 +925,7 @@ static int efuse_pg_packet_write(struct ieee80211_hw *hw,
925 struct rtl_priv *rtlpriv = rtl_priv(hw); 925 struct rtl_priv *rtlpriv = rtl_priv(hw);
926 struct pgpkt_struct target_pkt; 926 struct pgpkt_struct target_pkt;
927 u8 write_state = PG_STATE_HEADER; 927 u8 write_state = PG_STATE_HEADER;
928 int continual = true, dataempty = true, result = true; 928 int continual = true, result = true;
929 u16 efuse_addr = 0; 929 u16 efuse_addr = 0;
930 u8 efuse_data; 930 u8 efuse_data;
931 u8 target_word_cnts = 0; 931 u8 target_word_cnts = 0;
@@ -953,7 +953,6 @@ static int efuse_pg_packet_write(struct ieee80211_hw *hw,
953 (EFUSE_MAX_SIZE - EFUSE_OOB_PROTECT_BYTES))) { 953 (EFUSE_MAX_SIZE - EFUSE_OOB_PROTECT_BYTES))) {
954 954
955 if (write_state == PG_STATE_HEADER) { 955 if (write_state == PG_STATE_HEADER) {
956 dataempty = true;
957 badworden = 0x0F; 956 badworden = 0x0F;
958 RTPRINT(rtlpriv, FEEPROM, EFUSE_PG, 957 RTPRINT(rtlpriv, FEEPROM, EFUSE_PG,
959 ("efuse PG_STATE_HEADER\n")); 958 ("efuse PG_STATE_HEADER\n"));
@@ -1176,13 +1175,12 @@ static u16 efuse_get_current_size(struct ieee80211_hw *hw)
1176{ 1175{
1177 int continual = true; 1176 int continual = true;
1178 u16 efuse_addr = 0; 1177 u16 efuse_addr = 0;
1179 u8 hoffset, hworden; 1178 u8 hworden;
1180 u8 efuse_data, word_cnts; 1179 u8 efuse_data, word_cnts;
1181 1180
1182 while (continual && efuse_one_byte_read(hw, efuse_addr, &efuse_data) 1181 while (continual && efuse_one_byte_read(hw, efuse_addr, &efuse_data)
1183 && (efuse_addr < EFUSE_MAX_SIZE)) { 1182 && (efuse_addr < EFUSE_MAX_SIZE)) {
1184 if (efuse_data != 0xFF) { 1183 if (efuse_data != 0xFF) {
1185 hoffset = (efuse_data >> 4) & 0x0F;
1186 hworden = efuse_data & 0x0F; 1184 hworden = efuse_data & 0x0F;
1187 word_cnts = efuse_calculate_word_cnts(hworden); 1185 word_cnts = efuse_calculate_word_cnts(hworden);
1188 efuse_addr = efuse_addr + (word_cnts * 2) + 1; 1186 efuse_addr = efuse_addr + (word_cnts * 2) + 1;
diff --git a/drivers/net/wireless/rtlwifi/pci.c b/drivers/net/wireless/rtlwifi/pci.c
index 9f8ccae93317..e502db0532e5 100644
--- a/drivers/net/wireless/rtlwifi/pci.c
+++ b/drivers/net/wireless/rtlwifi/pci.c
@@ -622,7 +622,7 @@ tx_status_ok:
622 if (((rtlpriv->link_info.num_rx_inperiod + 622 if (((rtlpriv->link_info.num_rx_inperiod +
623 rtlpriv->link_info.num_tx_inperiod) > 8) || 623 rtlpriv->link_info.num_tx_inperiod) > 8) ||
624 (rtlpriv->link_info.num_rx_inperiod > 2)) { 624 (rtlpriv->link_info.num_rx_inperiod > 2)) {
625 rtl_lps_leave(hw); 625 tasklet_schedule(&rtlpriv->works.ips_leave_tasklet);
626 } 626 }
627} 627}
628 628
@@ -644,22 +644,23 @@ static void _rtl_pci_rx_interrupt(struct ieee80211_hw *hw)
644 .noise = -98, 644 .noise = -98,
645 .rate = 0, 645 .rate = 0,
646 }; 646 };
647 int index = rtlpci->rx_ring[rx_queue_idx].idx;
647 648
648 /*RX NORMAL PKT */ 649 /*RX NORMAL PKT */
649 while (count--) { 650 while (count--) {
650 /*rx descriptor */ 651 /*rx descriptor */
651 struct rtl_rx_desc *pdesc = &rtlpci->rx_ring[rx_queue_idx].desc[ 652 struct rtl_rx_desc *pdesc = &rtlpci->rx_ring[rx_queue_idx].desc[
652 rtlpci->rx_ring[rx_queue_idx].idx]; 653 index];
653 /*rx pkt */ 654 /*rx pkt */
654 struct sk_buff *skb = rtlpci->rx_ring[rx_queue_idx].rx_buf[ 655 struct sk_buff *skb = rtlpci->rx_ring[rx_queue_idx].rx_buf[
655 rtlpci->rx_ring[rx_queue_idx].idx]; 656 index];
656 657
657 own = (u8) rtlpriv->cfg->ops->get_desc((u8 *) pdesc, 658 own = (u8) rtlpriv->cfg->ops->get_desc((u8 *) pdesc,
658 false, HW_DESC_OWN); 659 false, HW_DESC_OWN);
659 660
660 if (own) { 661 if (own) {
661 /*wait data to be filled by hardware */ 662 /*wait data to be filled by hardware */
662 return; 663 break;
663 } else { 664 } else {
664 struct ieee80211_hdr *hdr; 665 struct ieee80211_hdr *hdr;
665 __le16 fc; 666 __le16 fc;
@@ -763,15 +764,12 @@ static void _rtl_pci_rx_interrupt(struct ieee80211_hw *hw)
763 if (((rtlpriv->link_info.num_rx_inperiod + 764 if (((rtlpriv->link_info.num_rx_inperiod +
764 rtlpriv->link_info.num_tx_inperiod) > 8) || 765 rtlpriv->link_info.num_tx_inperiod) > 8) ||
765 (rtlpriv->link_info.num_rx_inperiod > 2)) { 766 (rtlpriv->link_info.num_rx_inperiod > 2)) {
766 rtl_lps_leave(hw); 767 tasklet_schedule(&rtlpriv->works.ips_leave_tasklet);
767 } 768 }
768 769
769 skb = new_skb; 770 skb = new_skb;
770 771
771 rtlpci->rx_ring[rx_queue_idx].rx_buf[rtlpci-> 772 rtlpci->rx_ring[rx_queue_idx].rx_buf[index] = skb;
772 rx_ring
773 [rx_queue_idx].
774 idx] = skb;
775 *((dma_addr_t *) skb->cb) = 773 *((dma_addr_t *) skb->cb) =
776 pci_map_single(rtlpci->pdev, skb_tail_pointer(skb), 774 pci_map_single(rtlpci->pdev, skb_tail_pointer(skb),
777 rtlpci->rxbuffersize, 775 rtlpci->rxbuffersize,
@@ -784,23 +782,22 @@ done:
784 rtlpriv->cfg->ops->set_desc((u8 *) pdesc, false, 782 rtlpriv->cfg->ops->set_desc((u8 *) pdesc, false,
785 HW_DESC_RXBUFF_ADDR, 783 HW_DESC_RXBUFF_ADDR,
786 (u8 *)&bufferaddress); 784 (u8 *)&bufferaddress);
787 rtlpriv->cfg->ops->set_desc((u8 *)pdesc, false, HW_DESC_RXOWN,
788 (u8 *)&tmp_one);
789 rtlpriv->cfg->ops->set_desc((u8 *)pdesc, false, 785 rtlpriv->cfg->ops->set_desc((u8 *)pdesc, false,
790 HW_DESC_RXPKT_LEN, 786 HW_DESC_RXPKT_LEN,
791 (u8 *)&rtlpci->rxbuffersize); 787 (u8 *)&rtlpci->rxbuffersize);
792 788
793 if (rtlpci->rx_ring[rx_queue_idx].idx == 789 if (index == rtlpci->rxringcount - 1)
794 rtlpci->rxringcount - 1)
795 rtlpriv->cfg->ops->set_desc((u8 *)pdesc, false, 790 rtlpriv->cfg->ops->set_desc((u8 *)pdesc, false,
796 HW_DESC_RXERO, 791 HW_DESC_RXERO,
797 (u8 *)&tmp_one); 792 (u8 *)&tmp_one);
798 793
799 rtlpci->rx_ring[rx_queue_idx].idx = 794 rtlpriv->cfg->ops->set_desc((u8 *)pdesc, false, HW_DESC_RXOWN,
800 (rtlpci->rx_ring[rx_queue_idx].idx + 1) % 795 (u8 *)&tmp_one);
801 rtlpci->rxringcount; 796
797 index = (index + 1) % rtlpci->rxringcount;
802 } 798 }
803 799
800 rtlpci->rx_ring[rx_queue_idx].idx = index;
804} 801}
805 802
806static irqreturn_t _rtl_pci_interrupt(int irq, void *dev_id) 803static irqreturn_t _rtl_pci_interrupt(int irq, void *dev_id)
@@ -938,6 +935,11 @@ static void _rtl_pci_irq_tasklet(struct ieee80211_hw *hw)
938 _rtl_pci_tx_chk_waitq(hw); 935 _rtl_pci_tx_chk_waitq(hw);
939} 936}
940 937
938static void _rtl_pci_ips_leave_tasklet(struct ieee80211_hw *hw)
939{
940 rtl_lps_leave(hw);
941}
942
941static void _rtl_pci_prepare_bcn_tasklet(struct ieee80211_hw *hw) 943static void _rtl_pci_prepare_bcn_tasklet(struct ieee80211_hw *hw)
942{ 944{
943 struct rtl_priv *rtlpriv = rtl_priv(hw); 945 struct rtl_priv *rtlpriv = rtl_priv(hw);
@@ -1036,6 +1038,9 @@ static void _rtl_pci_init_struct(struct ieee80211_hw *hw,
1036 tasklet_init(&rtlpriv->works.irq_prepare_bcn_tasklet, 1038 tasklet_init(&rtlpriv->works.irq_prepare_bcn_tasklet,
1037 (void (*)(unsigned long))_rtl_pci_prepare_bcn_tasklet, 1039 (void (*)(unsigned long))_rtl_pci_prepare_bcn_tasklet,
1038 (unsigned long)hw); 1040 (unsigned long)hw);
1041 tasklet_init(&rtlpriv->works.ips_leave_tasklet,
1042 (void (*)(unsigned long))_rtl_pci_ips_leave_tasklet,
1043 (unsigned long)hw);
1039} 1044}
1040 1045
1041static int _rtl_pci_init_tx_ring(struct ieee80211_hw *hw, 1046static int _rtl_pci_init_tx_ring(struct ieee80211_hw *hw,
@@ -1505,6 +1510,7 @@ static void rtl_pci_deinit(struct ieee80211_hw *hw)
1505 1510
1506 synchronize_irq(rtlpci->pdev->irq); 1511 synchronize_irq(rtlpci->pdev->irq);
1507 tasklet_kill(&rtlpriv->works.irq_tasklet); 1512 tasklet_kill(&rtlpriv->works.irq_tasklet);
1513 tasklet_kill(&rtlpriv->works.ips_leave_tasklet);
1508 1514
1509 flush_workqueue(rtlpriv->works.rtl_wq); 1515 flush_workqueue(rtlpriv->works.rtl_wq);
1510 destroy_workqueue(rtlpriv->works.rtl_wq); 1516 destroy_workqueue(rtlpriv->works.rtl_wq);
@@ -1579,6 +1585,7 @@ static void rtl_pci_stop(struct ieee80211_hw *hw)
1579 set_hal_stop(rtlhal); 1585 set_hal_stop(rtlhal);
1580 1586
1581 rtlpriv->cfg->ops->disable_interrupt(hw); 1587 rtlpriv->cfg->ops->disable_interrupt(hw);
1588 tasklet_kill(&rtlpriv->works.ips_leave_tasklet);
1582 1589
1583 spin_lock_irqsave(&rtlpriv->locks.rf_ps_lock, flags); 1590 spin_lock_irqsave(&rtlpriv->locks.rf_ps_lock, flags);
1584 while (ppsc->rfchange_inprogress) { 1591 while (ppsc->rfchange_inprogress) {
diff --git a/drivers/net/wireless/rtlwifi/ps.c b/drivers/net/wireless/rtlwifi/ps.c
index 39b0297ce925..d14c13d02177 100644
--- a/drivers/net/wireless/rtlwifi/ps.c
+++ b/drivers/net/wireless/rtlwifi/ps.c
@@ -68,6 +68,7 @@ bool rtl_ps_disable_nic(struct ieee80211_hw *hw)
68 68
69 /*<2> Disable Interrupt */ 69 /*<2> Disable Interrupt */
70 rtlpriv->cfg->ops->disable_interrupt(hw); 70 rtlpriv->cfg->ops->disable_interrupt(hw);
71 tasklet_kill(&rtlpriv->works.irq_tasklet);
71 72
72 /*<3> Disable Adapter */ 73 /*<3> Disable Adapter */
73 rtlpriv->cfg->ops->hw_disable(hw); 74 rtlpriv->cfg->ops->hw_disable(hw);
@@ -82,10 +83,8 @@ bool rtl_ps_set_rf_state(struct ieee80211_hw *hw,
82{ 83{
83 struct rtl_priv *rtlpriv = rtl_priv(hw); 84 struct rtl_priv *rtlpriv = rtl_priv(hw);
84 struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); 85 struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw));
85 enum rf_pwrstate rtstate;
86 bool actionallowed = false; 86 bool actionallowed = false;
87 u16 rfwait_cnt = 0; 87 u16 rfwait_cnt = 0;
88 unsigned long flag;
89 88
90 /*protect_or_not = true; */ 89 /*protect_or_not = true; */
91 90
@@ -98,10 +97,9 @@ bool rtl_ps_set_rf_state(struct ieee80211_hw *hw,
98 *should wait to be executed. 97 *should wait to be executed.
99 */ 98 */
100 while (true) { 99 while (true) {
101 spin_lock_irqsave(&rtlpriv->locks.rf_ps_lock, flag); 100 spin_lock(&rtlpriv->locks.rf_ps_lock);
102 if (ppsc->rfchange_inprogress) { 101 if (ppsc->rfchange_inprogress) {
103 spin_unlock_irqrestore(&rtlpriv->locks.rf_ps_lock, 102 spin_unlock(&rtlpriv->locks.rf_ps_lock);
104 flag);
105 103
106 RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, 104 RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING,
107 ("RF Change in progress!" 105 ("RF Change in progress!"
@@ -122,15 +120,12 @@ bool rtl_ps_set_rf_state(struct ieee80211_hw *hw,
122 } 120 }
123 } else { 121 } else {
124 ppsc->rfchange_inprogress = true; 122 ppsc->rfchange_inprogress = true;
125 spin_unlock_irqrestore(&rtlpriv->locks.rf_ps_lock, 123 spin_unlock(&rtlpriv->locks.rf_ps_lock);
126 flag);
127 break; 124 break;
128 } 125 }
129 } 126 }
130 127
131no_protect: 128no_protect:
132 rtstate = ppsc->rfpwr_state;
133
134 switch (state_toset) { 129 switch (state_toset) {
135 case ERFON: 130 case ERFON:
136 ppsc->rfoff_reason &= (~changesource); 131 ppsc->rfoff_reason &= (~changesource);
@@ -173,9 +168,9 @@ no_protect:
173 rtlpriv->cfg->ops->set_rf_power_state(hw, state_toset); 168 rtlpriv->cfg->ops->set_rf_power_state(hw, state_toset);
174 169
175 if (!protect_or_not) { 170 if (!protect_or_not) {
176 spin_lock_irqsave(&rtlpriv->locks.rf_ps_lock, flag); 171 spin_lock(&rtlpriv->locks.rf_ps_lock);
177 ppsc->rfchange_inprogress = false; 172 ppsc->rfchange_inprogress = false;
178 spin_unlock_irqrestore(&rtlpriv->locks.rf_ps_lock, flag); 173 spin_unlock(&rtlpriv->locks.rf_ps_lock);
179 } 174 }
180 175
181 return actionallowed; 176 return actionallowed;
@@ -289,12 +284,11 @@ void rtl_ips_nic_on(struct ieee80211_hw *hw)
289 struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); 284 struct rtl_mac *mac = rtl_mac(rtl_priv(hw));
290 struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); 285 struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw));
291 enum rf_pwrstate rtstate; 286 enum rf_pwrstate rtstate;
292 unsigned long flags;
293 287
294 if (mac->opmode != NL80211_IFTYPE_STATION) 288 if (mac->opmode != NL80211_IFTYPE_STATION)
295 return; 289 return;
296 290
297 spin_lock_irqsave(&rtlpriv->locks.ips_lock, flags); 291 spin_lock(&rtlpriv->locks.ips_lock);
298 292
299 if (ppsc->inactiveps) { 293 if (ppsc->inactiveps) {
300 rtstate = ppsc->rfpwr_state; 294 rtstate = ppsc->rfpwr_state;
@@ -310,7 +304,7 @@ void rtl_ips_nic_on(struct ieee80211_hw *hw)
310 } 304 }
311 } 305 }
312 306
313 spin_unlock_irqrestore(&rtlpriv->locks.ips_lock, flags); 307 spin_unlock(&rtlpriv->locks.ips_lock);
314} 308}
315 309
316/*for FW LPS*/ 310/*for FW LPS*/
@@ -428,7 +422,6 @@ void rtl_lps_enter(struct ieee80211_hw *hw)
428 struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); 422 struct rtl_mac *mac = rtl_mac(rtl_priv(hw));
429 struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); 423 struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw));
430 struct rtl_priv *rtlpriv = rtl_priv(hw); 424 struct rtl_priv *rtlpriv = rtl_priv(hw);
431 unsigned long flag;
432 425
433 if (!ppsc->fwctrl_lps) 426 if (!ppsc->fwctrl_lps)
434 return; 427 return;
@@ -449,7 +442,7 @@ void rtl_lps_enter(struct ieee80211_hw *hw)
449 if (mac->link_state != MAC80211_LINKED) 442 if (mac->link_state != MAC80211_LINKED)
450 return; 443 return;
451 444
452 spin_lock_irqsave(&rtlpriv->locks.lps_lock, flag); 445 spin_lock(&rtlpriv->locks.lps_lock);
453 446
454 /* Idle for a while if we connect to AP a while ago. */ 447 /* Idle for a while if we connect to AP a while ago. */
455 if (mac->cnt_after_linked >= 2) { 448 if (mac->cnt_after_linked >= 2) {
@@ -461,7 +454,7 @@ void rtl_lps_enter(struct ieee80211_hw *hw)
461 } 454 }
462 } 455 }
463 456
464 spin_unlock_irqrestore(&rtlpriv->locks.lps_lock, flag); 457 spin_unlock(&rtlpriv->locks.lps_lock);
465} 458}
466 459
467/*Leave the leisure power save mode.*/ 460/*Leave the leisure power save mode.*/
@@ -470,9 +463,8 @@ void rtl_lps_leave(struct ieee80211_hw *hw)
470 struct rtl_priv *rtlpriv = rtl_priv(hw); 463 struct rtl_priv *rtlpriv = rtl_priv(hw);
471 struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); 464 struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw));
472 struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); 465 struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw));
473 unsigned long flag;
474 466
475 spin_lock_irqsave(&rtlpriv->locks.lps_lock, flag); 467 spin_lock(&rtlpriv->locks.lps_lock);
476 468
477 if (ppsc->fwctrl_lps) { 469 if (ppsc->fwctrl_lps) {
478 if (ppsc->dot11_psmode != EACTIVE) { 470 if (ppsc->dot11_psmode != EACTIVE) {
@@ -493,7 +485,7 @@ void rtl_lps_leave(struct ieee80211_hw *hw)
493 rtl_lps_set_psmode(hw, EACTIVE); 485 rtl_lps_set_psmode(hw, EACTIVE);
494 } 486 }
495 } 487 }
496 spin_unlock_irqrestore(&rtlpriv->locks.lps_lock, flag); 488 spin_unlock(&rtlpriv->locks.lps_lock);
497} 489}
498 490
499/* For sw LPS*/ 491/* For sw LPS*/
@@ -582,7 +574,6 @@ void rtl_swlps_rf_awake(struct ieee80211_hw *hw)
582 struct rtl_priv *rtlpriv = rtl_priv(hw); 574 struct rtl_priv *rtlpriv = rtl_priv(hw);
583 struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); 575 struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw));
584 struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); 576 struct rtl_mac *mac = rtl_mac(rtl_priv(hw));
585 unsigned long flag;
586 577
587 if (!rtlpriv->psc.swctrl_lps) 578 if (!rtlpriv->psc.swctrl_lps)
588 return; 579 return;
@@ -595,9 +586,9 @@ void rtl_swlps_rf_awake(struct ieee80211_hw *hw)
595 RT_CLEAR_PS_LEVEL(ppsc, RT_PS_LEVEL_ASPM); 586 RT_CLEAR_PS_LEVEL(ppsc, RT_PS_LEVEL_ASPM);
596 } 587 }
597 588
598 spin_lock_irqsave(&rtlpriv->locks.lps_lock, flag); 589 spin_lock(&rtlpriv->locks.lps_lock);
599 rtl_ps_set_rf_state(hw, ERFON, RF_CHANGE_BY_PS, false); 590 rtl_ps_set_rf_state(hw, ERFON, RF_CHANGE_BY_PS, false);
600 spin_unlock_irqrestore(&rtlpriv->locks.lps_lock, flag); 591 spin_unlock(&rtlpriv->locks.lps_lock);
601} 592}
602 593
603void rtl_swlps_rfon_wq_callback(void *data) 594void rtl_swlps_rfon_wq_callback(void *data)
@@ -614,7 +605,6 @@ void rtl_swlps_rf_sleep(struct ieee80211_hw *hw)
614 struct rtl_priv *rtlpriv = rtl_priv(hw); 605 struct rtl_priv *rtlpriv = rtl_priv(hw);
615 struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); 606 struct rtl_mac *mac = rtl_mac(rtl_priv(hw));
616 struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); 607 struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw));
617 unsigned long flag;
618 u8 sleep_intv; 608 u8 sleep_intv;
619 609
620 if (!rtlpriv->psc.sw_ps_enabled) 610 if (!rtlpriv->psc.sw_ps_enabled)
@@ -631,16 +621,16 @@ void rtl_swlps_rf_sleep(struct ieee80211_hw *hw)
631 if (rtlpriv->link_info.busytraffic) 621 if (rtlpriv->link_info.busytraffic)
632 return; 622 return;
633 623
634 spin_lock_irqsave(&rtlpriv->locks.rf_ps_lock, flag); 624 spin_lock(&rtlpriv->locks.rf_ps_lock);
635 if (rtlpriv->psc.rfchange_inprogress) { 625 if (rtlpriv->psc.rfchange_inprogress) {
636 spin_unlock_irqrestore(&rtlpriv->locks.rf_ps_lock, flag); 626 spin_unlock(&rtlpriv->locks.rf_ps_lock);
637 return; 627 return;
638 } 628 }
639 spin_unlock_irqrestore(&rtlpriv->locks.rf_ps_lock, flag); 629 spin_unlock(&rtlpriv->locks.rf_ps_lock);
640 630
641 spin_lock_irqsave(&rtlpriv->locks.lps_lock, flag); 631 spin_lock(&rtlpriv->locks.lps_lock);
642 rtl_ps_set_rf_state(hw, ERFSLEEP, RF_CHANGE_BY_PS, false); 632 rtl_ps_set_rf_state(hw, ERFSLEEP, RF_CHANGE_BY_PS, false);
643 spin_unlock_irqrestore(&rtlpriv->locks.lps_lock, flag); 633 spin_unlock(&rtlpriv->locks.lps_lock);
644 634
645 if (ppsc->reg_rfps_level & RT_RF_OFF_LEVL_ASPM && 635 if (ppsc->reg_rfps_level & RT_RF_OFF_LEVL_ASPM &&
646 !RT_IN_PS_LEVEL(ppsc, RT_PS_LEVEL_ASPM)) { 636 !RT_IN_PS_LEVEL(ppsc, RT_PS_LEVEL_ASPM)) {
diff --git a/drivers/net/wireless/rtlwifi/regd.c b/drivers/net/wireless/rtlwifi/regd.c
index 8f6718f163e5..9fedb1f70919 100644
--- a/drivers/net/wireless/rtlwifi/regd.c
+++ b/drivers/net/wireless/rtlwifi/regd.c
@@ -303,22 +303,6 @@ static void _rtl_reg_apply_world_flags(struct wiphy *wiphy,
303 return; 303 return;
304} 304}
305 305
306static void _rtl_dump_channel_map(struct wiphy *wiphy)
307{
308 enum ieee80211_band band;
309 struct ieee80211_supported_band *sband;
310 struct ieee80211_channel *ch;
311 unsigned int i;
312
313 for (band = 0; band < IEEE80211_NUM_BANDS; band++) {
314 if (!wiphy->bands[band])
315 continue;
316 sband = wiphy->bands[band];
317 for (i = 0; i < sband->n_channels; i++)
318 ch = &sband->channels[i];
319 }
320}
321
322static int _rtl_reg_notifier_apply(struct wiphy *wiphy, 306static int _rtl_reg_notifier_apply(struct wiphy *wiphy,
323 struct regulatory_request *request, 307 struct regulatory_request *request,
324 struct rtl_regulatory *reg) 308 struct rtl_regulatory *reg)
@@ -336,8 +320,6 @@ static int _rtl_reg_notifier_apply(struct wiphy *wiphy,
336 break; 320 break;
337 } 321 }
338 322
339 _rtl_dump_channel_map(wiphy);
340
341 return 0; 323 return 0;
342} 324}
343 325
diff --git a/drivers/net/wireless/rtlwifi/rtl8192c/fw_common.c b/drivers/net/wireless/rtlwifi/rtl8192c/fw_common.c
index 50303e1adff1..f9f2370e9256 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192c/fw_common.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192c/fw_common.c
@@ -546,7 +546,6 @@ static bool _rtl92c_cmd_send_packet(struct ieee80211_hw *hw,
546 struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); 546 struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw));
547 struct rtl8192_tx_ring *ring; 547 struct rtl8192_tx_ring *ring;
548 struct rtl_tx_desc *pdesc; 548 struct rtl_tx_desc *pdesc;
549 u8 own;
550 unsigned long flags; 549 unsigned long flags;
551 struct sk_buff *pskb = NULL; 550 struct sk_buff *pskb = NULL;
552 551
@@ -559,7 +558,6 @@ static bool _rtl92c_cmd_send_packet(struct ieee80211_hw *hw,
559 spin_lock_irqsave(&rtlpriv->locks.irq_th_lock, flags); 558 spin_lock_irqsave(&rtlpriv->locks.irq_th_lock, flags);
560 559
561 pdesc = &ring->desc[0]; 560 pdesc = &ring->desc[0];
562 own = (u8) rtlpriv->cfg->ops->get_desc((u8 *) pdesc, true, HW_DESC_OWN);
563 561
564 rtlpriv->cfg->ops->fill_tx_cmddesc(hw, (u8 *) pdesc, 1, 1, skb); 562 rtlpriv->cfg->ops->fill_tx_cmddesc(hw, (u8 *) pdesc, 1, 1, skb);
565 563
diff --git a/drivers/net/wireless/rtlwifi/rtl8192c/phy_common.c b/drivers/net/wireless/rtlwifi/rtl8192c/phy_common.c
index d2cc81586a6a..3b11642d3f7d 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192c/phy_common.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192c/phy_common.c
@@ -1253,10 +1253,9 @@ static void _rtl92c_phy_iq_calibrate(struct ieee80211_hw *hw,
1253 1253
1254 const u32 retrycount = 2; 1254 const u32 retrycount = 2;
1255 1255
1256 u32 bbvalue;
1257
1258 if (t == 0) { 1256 if (t == 0) {
1259 bbvalue = rtl_get_bbreg(hw, 0x800, MASKDWORD); 1257 /* dummy read */
1258 rtl_get_bbreg(hw, 0x800, MASKDWORD);
1260 1259
1261 _rtl92c_phy_save_adda_registers(hw, adda_reg, 1260 _rtl92c_phy_save_adda_registers(hw, adda_reg,
1262 rtlphy->adda_backup, 16); 1261 rtlphy->adda_backup, 16);
@@ -1762,8 +1761,7 @@ void rtl92c_phy_iq_calibrate(struct ieee80211_hw *hw, bool recovery)
1762 long result[4][8]; 1761 long result[4][8];
1763 u8 i, final_candidate; 1762 u8 i, final_candidate;
1764 bool patha_ok, pathb_ok; 1763 bool patha_ok, pathb_ok;
1765 long reg_e94, reg_e9c, reg_ea4, reg_eac, reg_eb4, reg_ebc, reg_ec4, 1764 long reg_e94, reg_e9c, reg_ea4, reg_eb4, reg_ebc, reg_ec4, reg_tmp = 0;
1766 reg_ecc, reg_tmp = 0;
1767 bool is12simular, is13simular, is23simular; 1765 bool is12simular, is13simular, is23simular;
1768 bool start_conttx = false, singletone = false; 1766 bool start_conttx = false, singletone = false;
1769 u32 iqk_bb_reg[10] = { 1767 u32 iqk_bb_reg[10] = {
@@ -1841,21 +1839,17 @@ void rtl92c_phy_iq_calibrate(struct ieee80211_hw *hw, bool recovery)
1841 reg_e94 = result[i][0]; 1839 reg_e94 = result[i][0];
1842 reg_e9c = result[i][1]; 1840 reg_e9c = result[i][1];
1843 reg_ea4 = result[i][2]; 1841 reg_ea4 = result[i][2];
1844 reg_eac = result[i][3];
1845 reg_eb4 = result[i][4]; 1842 reg_eb4 = result[i][4];
1846 reg_ebc = result[i][5]; 1843 reg_ebc = result[i][5];
1847 reg_ec4 = result[i][6]; 1844 reg_ec4 = result[i][6];
1848 reg_ecc = result[i][7];
1849 } 1845 }
1850 if (final_candidate != 0xff) { 1846 if (final_candidate != 0xff) {
1851 rtlphy->reg_e94 = reg_e94 = result[final_candidate][0]; 1847 rtlphy->reg_e94 = reg_e94 = result[final_candidate][0];
1852 rtlphy->reg_e9c = reg_e9c = result[final_candidate][1]; 1848 rtlphy->reg_e9c = reg_e9c = result[final_candidate][1];
1853 reg_ea4 = result[final_candidate][2]; 1849 reg_ea4 = result[final_candidate][2];
1854 reg_eac = result[final_candidate][3];
1855 rtlphy->reg_eb4 = reg_eb4 = result[final_candidate][4]; 1850 rtlphy->reg_eb4 = reg_eb4 = result[final_candidate][4];
1856 rtlphy->reg_ebc = reg_ebc = result[final_candidate][5]; 1851 rtlphy->reg_ebc = reg_ebc = result[final_candidate][5];
1857 reg_ec4 = result[final_candidate][6]; 1852 reg_ec4 = result[final_candidate][6];
1858 reg_ecc = result[final_candidate][7];
1859 patha_ok = pathb_ok = true; 1853 patha_ok = pathb_ok = true;
1860 } else { 1854 } else {
1861 rtlphy->reg_e94 = rtlphy->reg_eb4 = 0x100; 1855 rtlphy->reg_e94 = rtlphy->reg_eb4 = 0x100;
diff --git a/drivers/net/wireless/rtlwifi/rtl8192ce/hw.c b/drivers/net/wireless/rtlwifi/rtl8192ce/hw.c
index defb4370cf74..944f55e9d316 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192ce/hw.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192ce/hw.c
@@ -763,11 +763,9 @@ static void _rtl92ce_hw_configure(struct ieee80211_hw *hw)
763 struct rtl_priv *rtlpriv = rtl_priv(hw); 763 struct rtl_priv *rtlpriv = rtl_priv(hw);
764 struct rtl_pci_priv *rtlpcipriv = rtl_pcipriv(hw); 764 struct rtl_pci_priv *rtlpcipriv = rtl_pcipriv(hw);
765 u8 reg_bw_opmode; 765 u8 reg_bw_opmode;
766 u32 reg_ratr, reg_prsr; 766 u32 reg_prsr;
767 767
768 reg_bw_opmode = BW_OPMODE_20MHZ; 768 reg_bw_opmode = BW_OPMODE_20MHZ;
769 reg_ratr = RATE_ALL_CCK | RATE_ALL_OFDM_AG |
770 RATE_ALL_OFDM_1SS | RATE_ALL_OFDM_2SS;
771 reg_prsr = RATE_ALL_CCK | RATE_ALL_OFDM_AG; 769 reg_prsr = RATE_ALL_CCK | RATE_ALL_OFDM_AG;
772 770
773 rtl_write_byte(rtlpriv, REG_INIRTS_RATE_SEL, 0x8); 771 rtl_write_byte(rtlpriv, REG_INIRTS_RATE_SEL, 0x8);
@@ -1196,6 +1194,7 @@ void rtl92ce_disable_interrupt(struct ieee80211_hw *hw)
1196 rtl_write_dword(rtlpriv, REG_HIMR, IMR8190_DISABLED); 1194 rtl_write_dword(rtlpriv, REG_HIMR, IMR8190_DISABLED);
1197 rtl_write_dword(rtlpriv, REG_HIMRE, IMR8190_DISABLED); 1195 rtl_write_dword(rtlpriv, REG_HIMRE, IMR8190_DISABLED);
1198 rtlpci->irq_enabled = false; 1196 rtlpci->irq_enabled = false;
1197 synchronize_irq(rtlpci->pdev->irq);
1199} 1198}
1200 1199
1201static void _rtl92ce_poweroff_adapter(struct ieee80211_hw *hw) 1200static void _rtl92ce_poweroff_adapter(struct ieee80211_hw *hw)
@@ -1969,7 +1968,7 @@ bool rtl92ce_gpio_radio_on_off_checking(struct ieee80211_hw *hw, u8 *valid)
1969 struct rtl_priv *rtlpriv = rtl_priv(hw); 1968 struct rtl_priv *rtlpriv = rtl_priv(hw);
1970 struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); 1969 struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw));
1971 struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); 1970 struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw));
1972 enum rf_pwrstate e_rfpowerstate_toset, cur_rfstate; 1971 enum rf_pwrstate e_rfpowerstate_toset;
1973 u8 u1tmp; 1972 u8 u1tmp;
1974 bool actuallyset = false; 1973 bool actuallyset = false;
1975 unsigned long flag; 1974 unsigned long flag;
@@ -1989,8 +1988,6 @@ bool rtl92ce_gpio_radio_on_off_checking(struct ieee80211_hw *hw, u8 *valid)
1989 spin_unlock_irqrestore(&rtlpriv->locks.rf_ps_lock, flag); 1988 spin_unlock_irqrestore(&rtlpriv->locks.rf_ps_lock, flag);
1990 } 1989 }
1991 1990
1992 cur_rfstate = ppsc->rfpwr_state;
1993
1994 rtl_write_byte(rtlpriv, REG_MAC_PINMUX_CFG, rtl_read_byte(rtlpriv, 1991 rtl_write_byte(rtlpriv, REG_MAC_PINMUX_CFG, rtl_read_byte(rtlpriv,
1995 REG_MAC_PINMUX_CFG)&~(BIT(3))); 1992 REG_MAC_PINMUX_CFG)&~(BIT(3)));
1996 1993
diff --git a/drivers/net/wireless/rtlwifi/rtl8192ce/phy.c b/drivers/net/wireless/rtlwifi/rtl8192ce/phy.c
index abe0fcc75368..592a10ac5929 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192ce/phy.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192ce/phy.c
@@ -46,13 +46,12 @@ u32 rtl92c_phy_query_rf_reg(struct ieee80211_hw *hw,
46 struct rtl_priv *rtlpriv = rtl_priv(hw); 46 struct rtl_priv *rtlpriv = rtl_priv(hw);
47 u32 original_value, readback_value, bitshift; 47 u32 original_value, readback_value, bitshift;
48 struct rtl_phy *rtlphy = &(rtlpriv->phy); 48 struct rtl_phy *rtlphy = &(rtlpriv->phy);
49 unsigned long flags;
50 49
51 RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE, ("regaddr(%#x), " 50 RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE, ("regaddr(%#x), "
52 "rfpath(%#x), bitmask(%#x)\n", 51 "rfpath(%#x), bitmask(%#x)\n",
53 regaddr, rfpath, bitmask)); 52 regaddr, rfpath, bitmask));
54 53
55 spin_lock_irqsave(&rtlpriv->locks.rf_lock, flags); 54 spin_lock(&rtlpriv->locks.rf_lock);
56 55
57 if (rtlphy->rf_mode != RF_OP_BY_FW) { 56 if (rtlphy->rf_mode != RF_OP_BY_FW) {
58 original_value = _rtl92c_phy_rf_serial_read(hw, 57 original_value = _rtl92c_phy_rf_serial_read(hw,
@@ -65,7 +64,7 @@ u32 rtl92c_phy_query_rf_reg(struct ieee80211_hw *hw,
65 bitshift = _rtl92c_phy_calculate_bit_shift(bitmask); 64 bitshift = _rtl92c_phy_calculate_bit_shift(bitmask);
66 readback_value = (original_value & bitmask) >> bitshift; 65 readback_value = (original_value & bitmask) >> bitshift;
67 66
68 spin_unlock_irqrestore(&rtlpriv->locks.rf_lock, flags); 67 spin_unlock(&rtlpriv->locks.rf_lock);
69 68
70 RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE, 69 RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE,
71 ("regaddr(%#x), rfpath(%#x), " 70 ("regaddr(%#x), rfpath(%#x), "
@@ -120,13 +119,12 @@ void rtl92ce_phy_set_rf_reg(struct ieee80211_hw *hw,
120 struct rtl_priv *rtlpriv = rtl_priv(hw); 119 struct rtl_priv *rtlpriv = rtl_priv(hw);
121 struct rtl_phy *rtlphy = &(rtlpriv->phy); 120 struct rtl_phy *rtlphy = &(rtlpriv->phy);
122 u32 original_value, bitshift; 121 u32 original_value, bitshift;
123 unsigned long flags;
124 122
125 RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE, 123 RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE,
126 ("regaddr(%#x), bitmask(%#x), data(%#x), rfpath(%#x)\n", 124 ("regaddr(%#x), bitmask(%#x), data(%#x), rfpath(%#x)\n",
127 regaddr, bitmask, data, rfpath)); 125 regaddr, bitmask, data, rfpath));
128 126
129 spin_lock_irqsave(&rtlpriv->locks.rf_lock, flags); 127 spin_lock(&rtlpriv->locks.rf_lock);
130 128
131 if (rtlphy->rf_mode != RF_OP_BY_FW) { 129 if (rtlphy->rf_mode != RF_OP_BY_FW) {
132 if (bitmask != RFREG_OFFSET_MASK) { 130 if (bitmask != RFREG_OFFSET_MASK) {
@@ -153,7 +151,7 @@ void rtl92ce_phy_set_rf_reg(struct ieee80211_hw *hw,
153 _rtl92c_phy_fw_rf_serial_write(hw, rfpath, regaddr, data); 151 _rtl92c_phy_fw_rf_serial_write(hw, rfpath, regaddr, data);
154 } 152 }
155 153
156 spin_unlock_irqrestore(&rtlpriv->locks.rf_lock, flags); 154 spin_unlock(&rtlpriv->locks.rf_lock);
157 155
158 RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE, ("regaddr(%#x), " 156 RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE, ("regaddr(%#x), "
159 "bitmask(%#x), data(%#x), " 157 "bitmask(%#x), data(%#x), "
@@ -281,7 +279,6 @@ bool rtl92c_phy_config_rf_with_headerfile(struct ieee80211_hw *hw,
281{ 279{
282 280
283 int i; 281 int i;
284 bool rtstatus = true;
285 u32 *radioa_array_table; 282 u32 *radioa_array_table;
286 u32 *radiob_array_table; 283 u32 *radiob_array_table;
287 u16 radioa_arraylen, radiob_arraylen; 284 u16 radioa_arraylen, radiob_arraylen;
@@ -308,7 +305,6 @@ bool rtl92c_phy_config_rf_with_headerfile(struct ieee80211_hw *hw,
308 ("Radio_B:RTL8192CE_RADIOB_1TARRAY\n")); 305 ("Radio_B:RTL8192CE_RADIOB_1TARRAY\n"));
309 } 306 }
310 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, ("Radio No %x\n", rfpath)); 307 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, ("Radio No %x\n", rfpath));
311 rtstatus = true;
312 switch (rfpath) { 308 switch (rfpath) {
313 case RF90_PATH_A: 309 case RF90_PATH_A:
314 for (i = 0; i < radioa_arraylen; i = i + 2) { 310 for (i = 0; i < radioa_arraylen; i = i + 2) {
@@ -521,7 +517,6 @@ static bool _rtl92ce_phy_set_rf_power_state(struct ieee80211_hw *hw,
521 u8 i, queue_id; 517 u8 i, queue_id;
522 struct rtl8192_tx_ring *ring = NULL; 518 struct rtl8192_tx_ring *ring = NULL;
523 519
524 ppsc->set_rfpowerstate_inprogress = true;
525 switch (rfpwr_state) { 520 switch (rfpwr_state) {
526 case ERFON:{ 521 case ERFON:{
527 if ((ppsc->rfpwr_state == ERFOFF) && 522 if ((ppsc->rfpwr_state == ERFOFF) &&
@@ -617,7 +612,6 @@ static bool _rtl92ce_phy_set_rf_power_state(struct ieee80211_hw *hw,
617 } 612 }
618 if (bresult) 613 if (bresult)
619 ppsc->rfpwr_state = rfpwr_state; 614 ppsc->rfpwr_state = rfpwr_state;
620 ppsc->set_rfpowerstate_inprogress = false;
621 return bresult; 615 return bresult;
622} 616}
623 617
diff --git a/drivers/net/wireless/rtlwifi/rtl8192ce/trx.c b/drivers/net/wireless/rtlwifi/rtl8192ce/trx.c
index 54b2bd53d36a..2492cc234c03 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192ce/trx.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192ce/trx.c
@@ -592,7 +592,6 @@ static void _rtl92ce_translate_rx_signal_stuff(struct ieee80211_hw *hw,
592 struct ieee80211_hdr *hdr; 592 struct ieee80211_hdr *hdr;
593 u8 *tmp_buf; 593 u8 *tmp_buf;
594 u8 *praddr; 594 u8 *praddr;
595 u8 *psaddr;
596 __le16 fc; 595 __le16 fc;
597 u16 type, c_fc; 596 u16 type, c_fc;
598 bool packet_matchbssid, packet_toself, packet_beacon; 597 bool packet_matchbssid, packet_toself, packet_beacon;
@@ -604,7 +603,6 @@ static void _rtl92ce_translate_rx_signal_stuff(struct ieee80211_hw *hw,
604 c_fc = le16_to_cpu(fc); 603 c_fc = le16_to_cpu(fc);
605 type = WLAN_FC_GET_TYPE(fc); 604 type = WLAN_FC_GET_TYPE(fc);
606 praddr = hdr->addr1; 605 praddr = hdr->addr1;
607 psaddr = hdr->addr2;
608 606
609 packet_matchbssid = 607 packet_matchbssid =
610 ((IEEE80211_FTYPE_CTL != type) && 608 ((IEEE80211_FTYPE_CTL != type) &&
@@ -932,6 +930,7 @@ void rtl92ce_set_desc(u8 *pdesc, bool istx, u8 desc_name, u8 *val)
932 if (istx == true) { 930 if (istx == true) {
933 switch (desc_name) { 931 switch (desc_name) {
934 case HW_DESC_OWN: 932 case HW_DESC_OWN:
933 wmb();
935 SET_TX_DESC_OWN(pdesc, 1); 934 SET_TX_DESC_OWN(pdesc, 1);
936 break; 935 break;
937 case HW_DESC_TX_NEXTDESC_ADDR: 936 case HW_DESC_TX_NEXTDESC_ADDR:
@@ -945,6 +944,7 @@ void rtl92ce_set_desc(u8 *pdesc, bool istx, u8 desc_name, u8 *val)
945 } else { 944 } else {
946 switch (desc_name) { 945 switch (desc_name) {
947 case HW_DESC_RXOWN: 946 case HW_DESC_RXOWN:
947 wmb();
948 SET_RX_DESC_OWN(pdesc, 1); 948 SET_RX_DESC_OWN(pdesc, 1);
949 break; 949 break;
950 case HW_DESC_RXBUFF_ADDR: 950 case HW_DESC_RXBUFF_ADDR:
diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/mac.c b/drivers/net/wireless/rtlwifi/rtl8192cu/mac.c
index f8514cba17b6..4e057df6f488 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192cu/mac.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192cu/mac.c
@@ -1113,7 +1113,6 @@ void rtl92c_translate_rx_signal_stuff(struct ieee80211_hw *hw,
1113 struct ieee80211_hdr *hdr; 1113 struct ieee80211_hdr *hdr;
1114 u8 *tmp_buf; 1114 u8 *tmp_buf;
1115 u8 *praddr; 1115 u8 *praddr;
1116 u8 *psaddr;
1117 __le16 fc; 1116 __le16 fc;
1118 u16 type, cpu_fc; 1117 u16 type, cpu_fc;
1119 bool packet_matchbssid, packet_toself, packet_beacon; 1118 bool packet_matchbssid, packet_toself, packet_beacon;
@@ -1124,7 +1123,6 @@ void rtl92c_translate_rx_signal_stuff(struct ieee80211_hw *hw,
1124 cpu_fc = le16_to_cpu(fc); 1123 cpu_fc = le16_to_cpu(fc);
1125 type = WLAN_FC_GET_TYPE(fc); 1124 type = WLAN_FC_GET_TYPE(fc);
1126 praddr = hdr->addr1; 1125 praddr = hdr->addr1;
1127 psaddr = hdr->addr2;
1128 packet_matchbssid = 1126 packet_matchbssid =
1129 ((IEEE80211_FTYPE_CTL != type) && 1127 ((IEEE80211_FTYPE_CTL != type) &&
1130 (!compare_ether_addr(mac->bssid, 1128 (!compare_ether_addr(mac->bssid,
diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/phy.c b/drivers/net/wireless/rtlwifi/rtl8192cu/phy.c
index 9a3d0239e27e..72852900df84 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192cu/phy.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192cu/phy.c
@@ -470,7 +470,6 @@ static bool _rtl92cu_phy_set_rf_power_state(struct ieee80211_hw *hw,
470 u8 i, queue_id; 470 u8 i, queue_id;
471 struct rtl8192_tx_ring *ring = NULL; 471 struct rtl8192_tx_ring *ring = NULL;
472 472
473 ppsc->set_rfpowerstate_inprogress = true;
474 switch (rfpwr_state) { 473 switch (rfpwr_state) {
475 case ERFON: 474 case ERFON:
476 if ((ppsc->rfpwr_state == ERFOFF) && 475 if ((ppsc->rfpwr_state == ERFOFF) &&
@@ -590,7 +589,6 @@ static bool _rtl92cu_phy_set_rf_power_state(struct ieee80211_hw *hw,
590 } 589 }
591 if (bresult) 590 if (bresult)
592 ppsc->rfpwr_state = rfpwr_state; 591 ppsc->rfpwr_state = rfpwr_state;
593 ppsc->set_rfpowerstate_inprogress = false;
594 return bresult; 592 return bresult;
595} 593}
596 594
diff --git a/drivers/net/wireless/rtlwifi/rtl8192se/dm.c b/drivers/net/wireless/rtlwifi/rtl8192se/dm.c
index da86db86fa4a..609c7ec7e66a 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192se/dm.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192se/dm.c
@@ -222,7 +222,6 @@ static void _rtl92s_dm_refresh_rateadaptive_mask(struct ieee80211_hw *hw)
222 u32 low_rssi_thresh = 0; 222 u32 low_rssi_thresh = 0;
223 u32 middle_rssi_thresh = 0; 223 u32 middle_rssi_thresh = 0;
224 u32 high_rssi_thresh = 0; 224 u32 high_rssi_thresh = 0;
225 u8 rssi_level;
226 struct ieee80211_sta *sta = NULL; 225 struct ieee80211_sta *sta = NULL;
227 226
228 if (is_hal_stop(rtlhal)) 227 if (is_hal_stop(rtlhal))
@@ -272,18 +271,14 @@ static void _rtl92s_dm_refresh_rateadaptive_mask(struct ieee80211_hw *hw)
272 if (rtlpriv->dm.undecorated_smoothed_pwdb > 271 if (rtlpriv->dm.undecorated_smoothed_pwdb >
273 (long)high_rssi_thresh) { 272 (long)high_rssi_thresh) {
274 ra->ratr_state = DM_RATR_STA_HIGH; 273 ra->ratr_state = DM_RATR_STA_HIGH;
275 rssi_level = 1;
276 } else if (rtlpriv->dm.undecorated_smoothed_pwdb > 274 } else if (rtlpriv->dm.undecorated_smoothed_pwdb >
277 (long)middle_rssi_thresh) { 275 (long)middle_rssi_thresh) {
278 ra->ratr_state = DM_RATR_STA_LOW; 276 ra->ratr_state = DM_RATR_STA_LOW;
279 rssi_level = 3;
280 } else if (rtlpriv->dm.undecorated_smoothed_pwdb > 277 } else if (rtlpriv->dm.undecorated_smoothed_pwdb >
281 (long)low_rssi_thresh) { 278 (long)low_rssi_thresh) {
282 ra->ratr_state = DM_RATR_STA_LOW; 279 ra->ratr_state = DM_RATR_STA_LOW;
283 rssi_level = 5;
284 } else { 280 } else {
285 ra->ratr_state = DM_RATR_STA_ULTRALOW; 281 ra->ratr_state = DM_RATR_STA_ULTRALOW;
286 rssi_level = 6;
287 } 282 }
288 283
289 if (ra->pre_ratr_state != ra->ratr_state) { 284 if (ra->pre_ratr_state != ra->ratr_state) {
diff --git a/drivers/net/wireless/rtlwifi/rtl8192se/fw.c b/drivers/net/wireless/rtlwifi/rtl8192se/fw.c
index 3b5af0113d7f..6f91a148c222 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192se/fw.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192se/fw.c
@@ -358,7 +358,6 @@ int rtl92s_download_fw(struct ieee80211_hw *hw)
358 struct fw_priv *pfw_priv = NULL; 358 struct fw_priv *pfw_priv = NULL;
359 u8 *puc_mappedfile = NULL; 359 u8 *puc_mappedfile = NULL;
360 u32 ul_filelength = 0; 360 u32 ul_filelength = 0;
361 u32 file_length = 0;
362 u8 fwhdr_size = RT_8192S_FIRMWARE_HDR_SIZE; 361 u8 fwhdr_size = RT_8192S_FIRMWARE_HDR_SIZE;
363 u8 fwstatus = FW_STATUS_INIT; 362 u8 fwstatus = FW_STATUS_INIT;
364 bool rtstatus = true; 363 bool rtstatus = true;
@@ -370,7 +369,6 @@ int rtl92s_download_fw(struct ieee80211_hw *hw)
370 firmware->fwstatus = FW_STATUS_INIT; 369 firmware->fwstatus = FW_STATUS_INIT;
371 370
372 puc_mappedfile = firmware->sz_fw_tmpbuffer; 371 puc_mappedfile = firmware->sz_fw_tmpbuffer;
373 file_length = firmware->sz_fw_tmpbufferlen;
374 372
375 /* 1. Retrieve FW header. */ 373 /* 1. Retrieve FW header. */
376 firmware->pfwheader = (struct fw_hdr *) puc_mappedfile; 374 firmware->pfwheader = (struct fw_hdr *) puc_mappedfile;
diff --git a/drivers/net/wireless/rtlwifi/rtl8192se/hw.c b/drivers/net/wireless/rtlwifi/rtl8192se/hw.c
index 2e9005d0454b..35dd12d0dcf3 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192se/hw.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192se/hw.c
@@ -884,12 +884,10 @@ static void _rtl92se_hw_configure(struct ieee80211_hw *hw)
884 struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); 884 struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw));
885 885
886 u8 reg_bw_opmode = 0; 886 u8 reg_bw_opmode = 0;
887 u32 reg_ratr = 0, reg_rrsr = 0; 887 u32 reg_rrsr = 0;
888 u8 regtmp = 0; 888 u8 regtmp = 0;
889 889
890 reg_bw_opmode = BW_OPMODE_20MHZ; 890 reg_bw_opmode = BW_OPMODE_20MHZ;
891 reg_ratr = RATE_ALL_CCK | RATE_ALL_OFDM_AG | RATE_ALL_OFDM_1SS |
892 RATE_ALL_OFDM_2SS;
893 reg_rrsr = RATE_ALL_CCK | RATE_ALL_OFDM_AG; 891 reg_rrsr = RATE_ALL_CCK | RATE_ALL_OFDM_AG;
894 892
895 regtmp = rtl_read_byte(rtlpriv, INIRTSMCS_SEL); 893 regtmp = rtl_read_byte(rtlpriv, INIRTSMCS_SEL);
@@ -1122,14 +1120,12 @@ static int _rtl92se_set_media_status(struct ieee80211_hw *hw,
1122{ 1120{
1123 struct rtl_priv *rtlpriv = rtl_priv(hw); 1121 struct rtl_priv *rtlpriv = rtl_priv(hw);
1124 u8 bt_msr = rtl_read_byte(rtlpriv, MSR); 1122 u8 bt_msr = rtl_read_byte(rtlpriv, MSR);
1125 enum led_ctl_mode ledaction = LED_CTL_NO_LINK;
1126 u32 temp; 1123 u32 temp;
1127 bt_msr &= ~MSR_LINK_MASK; 1124 bt_msr &= ~MSR_LINK_MASK;
1128 1125
1129 switch (type) { 1126 switch (type) {
1130 case NL80211_IFTYPE_UNSPECIFIED: 1127 case NL80211_IFTYPE_UNSPECIFIED:
1131 bt_msr |= (MSR_LINK_NONE << MSR_LINK_SHIFT); 1128 bt_msr |= (MSR_LINK_NONE << MSR_LINK_SHIFT);
1132 ledaction = LED_CTL_LINK;
1133 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, 1129 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
1134 ("Set Network type to NO LINK!\n")); 1130 ("Set Network type to NO LINK!\n"));
1135 break; 1131 break;
@@ -1140,7 +1136,6 @@ static int _rtl92se_set_media_status(struct ieee80211_hw *hw,
1140 break; 1136 break;
1141 case NL80211_IFTYPE_STATION: 1137 case NL80211_IFTYPE_STATION:
1142 bt_msr |= (MSR_LINK_MANAGED << MSR_LINK_SHIFT); 1138 bt_msr |= (MSR_LINK_MANAGED << MSR_LINK_SHIFT);
1143 ledaction = LED_CTL_LINK;
1144 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, 1139 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
1145 ("Set Network type to STA!\n")); 1140 ("Set Network type to STA!\n"));
1146 break; 1141 break;
@@ -1231,6 +1226,7 @@ void rtl92se_disable_interrupt(struct ieee80211_hw *hw)
1231 rtl_write_dword(rtlpriv, INTA_MASK + 4, 0); 1226 rtl_write_dword(rtlpriv, INTA_MASK + 4, 0);
1232 1227
1233 rtlpci->irq_enabled = false; 1228 rtlpci->irq_enabled = false;
1229 synchronize_irq(rtlpci->pdev->irq);
1234} 1230}
1235 1231
1236 1232
@@ -2271,7 +2267,7 @@ bool rtl92se_gpio_radio_on_off_checking(struct ieee80211_hw *hw, u8 *valid)
2271 struct rtl_priv *rtlpriv = rtl_priv(hw); 2267 struct rtl_priv *rtlpriv = rtl_priv(hw);
2272 struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); 2268 struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw));
2273 struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); 2269 struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw));
2274 enum rf_pwrstate rfpwr_toset, cur_rfstate; 2270 enum rf_pwrstate rfpwr_toset /*, cur_rfstate */;
2275 unsigned long flag = 0; 2271 unsigned long flag = 0;
2276 bool actuallyset = false; 2272 bool actuallyset = false;
2277 bool turnonbypowerdomain = false; 2273 bool turnonbypowerdomain = false;
@@ -2292,7 +2288,7 @@ bool rtl92se_gpio_radio_on_off_checking(struct ieee80211_hw *hw, u8 *valid)
2292 spin_unlock_irqrestore(&rtlpriv->locks.rf_ps_lock, flag); 2288 spin_unlock_irqrestore(&rtlpriv->locks.rf_ps_lock, flag);
2293 } 2289 }
2294 2290
2295 cur_rfstate = ppsc->rfpwr_state; 2291 /* cur_rfstate = ppsc->rfpwr_state;*/
2296 2292
2297 /* because after _rtl92s_phy_set_rfhalt, all power 2293 /* because after _rtl92s_phy_set_rfhalt, all power
2298 * closed, so we must open some power for GPIO check, 2294 * closed, so we must open some power for GPIO check,
diff --git a/drivers/net/wireless/rtlwifi/rtl8192se/phy.c b/drivers/net/wireless/rtlwifi/rtl8192se/phy.c
index 63b45e60a95e..7ee2daccd7d5 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192se/phy.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192se/phy.c
@@ -180,19 +180,18 @@ u32 rtl92s_phy_query_rf_reg(struct ieee80211_hw *hw, enum radio_path rfpath,
180{ 180{
181 struct rtl_priv *rtlpriv = rtl_priv(hw); 181 struct rtl_priv *rtlpriv = rtl_priv(hw);
182 u32 original_value, readback_value, bitshift; 182 u32 original_value, readback_value, bitshift;
183 unsigned long flags;
184 183
185 RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE, ("regaddr(%#x), rfpath(%#x), " 184 RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE, ("regaddr(%#x), rfpath(%#x), "
186 "bitmask(%#x)\n", regaddr, rfpath, bitmask)); 185 "bitmask(%#x)\n", regaddr, rfpath, bitmask));
187 186
188 spin_lock_irqsave(&rtlpriv->locks.rf_lock, flags); 187 spin_lock(&rtlpriv->locks.rf_lock);
189 188
190 original_value = _rtl92s_phy_rf_serial_read(hw, rfpath, regaddr); 189 original_value = _rtl92s_phy_rf_serial_read(hw, rfpath, regaddr);
191 190
192 bitshift = _rtl92s_phy_calculate_bit_shift(bitmask); 191 bitshift = _rtl92s_phy_calculate_bit_shift(bitmask);
193 readback_value = (original_value & bitmask) >> bitshift; 192 readback_value = (original_value & bitmask) >> bitshift;
194 193
195 spin_unlock_irqrestore(&rtlpriv->locks.rf_lock, flags); 194 spin_unlock(&rtlpriv->locks.rf_lock);
196 195
197 RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE, ("regaddr(%#x), rfpath(%#x), " 196 RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE, ("regaddr(%#x), rfpath(%#x), "
198 "bitmask(%#x), original_value(%#x)\n", regaddr, rfpath, 197 "bitmask(%#x), original_value(%#x)\n", regaddr, rfpath,
@@ -207,7 +206,6 @@ void rtl92s_phy_set_rf_reg(struct ieee80211_hw *hw, enum radio_path rfpath,
207 struct rtl_priv *rtlpriv = rtl_priv(hw); 206 struct rtl_priv *rtlpriv = rtl_priv(hw);
208 struct rtl_phy *rtlphy = &(rtlpriv->phy); 207 struct rtl_phy *rtlphy = &(rtlpriv->phy);
209 u32 original_value, bitshift; 208 u32 original_value, bitshift;
210 unsigned long flags;
211 209
212 if (!((rtlphy->rf_pathmap >> rfpath) & 0x1)) 210 if (!((rtlphy->rf_pathmap >> rfpath) & 0x1))
213 return; 211 return;
@@ -215,7 +213,7 @@ void rtl92s_phy_set_rf_reg(struct ieee80211_hw *hw, enum radio_path rfpath,
215 RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE, ("regaddr(%#x), bitmask(%#x)," 213 RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE, ("regaddr(%#x), bitmask(%#x),"
216 " data(%#x), rfpath(%#x)\n", regaddr, bitmask, data, rfpath)); 214 " data(%#x), rfpath(%#x)\n", regaddr, bitmask, data, rfpath));
217 215
218 spin_lock_irqsave(&rtlpriv->locks.rf_lock, flags); 216 spin_lock(&rtlpriv->locks.rf_lock);
219 217
220 if (bitmask != RFREG_OFFSET_MASK) { 218 if (bitmask != RFREG_OFFSET_MASK) {
221 original_value = _rtl92s_phy_rf_serial_read(hw, rfpath, 219 original_value = _rtl92s_phy_rf_serial_read(hw, rfpath,
@@ -226,7 +224,7 @@ void rtl92s_phy_set_rf_reg(struct ieee80211_hw *hw, enum radio_path rfpath,
226 224
227 _rtl92s_phy_rf_serial_write(hw, rfpath, regaddr, data); 225 _rtl92s_phy_rf_serial_write(hw, rfpath, regaddr, data);
228 226
229 spin_unlock_irqrestore(&rtlpriv->locks.rf_lock, flags); 227 spin_unlock(&rtlpriv->locks.rf_lock);
230 228
231 RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE, ("regaddr(%#x), bitmask(%#x), " 229 RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE, ("regaddr(%#x), bitmask(%#x), "
232 "data(%#x), rfpath(%#x)\n", regaddr, bitmask, data, rfpath)); 230 "data(%#x), rfpath(%#x)\n", regaddr, bitmask, data, rfpath));
@@ -263,7 +261,6 @@ void rtl92s_phy_set_bw_mode(struct ieee80211_hw *hw,
263 struct rtl_phy *rtlphy = &(rtlpriv->phy); 261 struct rtl_phy *rtlphy = &(rtlpriv->phy);
264 struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); 262 struct rtl_mac *mac = rtl_mac(rtl_priv(hw));
265 u8 reg_bw_opmode; 263 u8 reg_bw_opmode;
266 u8 reg_prsr_rsc;
267 264
268 RT_TRACE(rtlpriv, COMP_SCAN, DBG_TRACE, ("Switch to %s bandwidth\n", 265 RT_TRACE(rtlpriv, COMP_SCAN, DBG_TRACE, ("Switch to %s bandwidth\n",
269 rtlphy->current_chan_bw == HT_CHANNEL_WIDTH_20 ? 266 rtlphy->current_chan_bw == HT_CHANNEL_WIDTH_20 ?
@@ -277,7 +274,8 @@ void rtl92s_phy_set_bw_mode(struct ieee80211_hw *hw,
277 rtlphy->set_bwmode_inprogress = true; 274 rtlphy->set_bwmode_inprogress = true;
278 275
279 reg_bw_opmode = rtl_read_byte(rtlpriv, BW_OPMODE); 276 reg_bw_opmode = rtl_read_byte(rtlpriv, BW_OPMODE);
280 reg_prsr_rsc = rtl_read_byte(rtlpriv, RRSR + 2); 277 /* dummy read */
278 rtl_read_byte(rtlpriv, RRSR + 2);
281 279
282 switch (rtlphy->current_chan_bw) { 280 switch (rtlphy->current_chan_bw) {
283 case HT_CHANNEL_WIDTH_20: 281 case HT_CHANNEL_WIDTH_20:
@@ -546,8 +544,6 @@ bool rtl92s_phy_set_rf_power_state(struct ieee80211_hw *hw,
546 if (rfpwr_state == ppsc->rfpwr_state) 544 if (rfpwr_state == ppsc->rfpwr_state)
547 return false; 545 return false;
548 546
549 ppsc->set_rfpowerstate_inprogress = true;
550
551 switch (rfpwr_state) { 547 switch (rfpwr_state) {
552 case ERFON:{ 548 case ERFON:{
553 if ((ppsc->rfpwr_state == ERFOFF) && 549 if ((ppsc->rfpwr_state == ERFOFF) &&
@@ -659,8 +655,6 @@ bool rtl92s_phy_set_rf_power_state(struct ieee80211_hw *hw,
659 if (bresult) 655 if (bresult)
660 ppsc->rfpwr_state = rfpwr_state; 656 ppsc->rfpwr_state = rfpwr_state;
661 657
662 ppsc->set_rfpowerstate_inprogress = false;
663
664 return bresult; 658 return bresult;
665} 659}
666 660
diff --git a/drivers/net/wireless/rtlwifi/rtl8192se/trx.c b/drivers/net/wireless/rtlwifi/rtl8192se/trx.c
index 5cf442373d46..d509cf6a1e4d 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192se/trx.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192se/trx.c
@@ -581,7 +581,6 @@ static void _rtl92se_translate_rx_signal_stuff(struct ieee80211_hw *hw,
581 struct ieee80211_hdr *hdr; 581 struct ieee80211_hdr *hdr;
582 u8 *tmp_buf; 582 u8 *tmp_buf;
583 u8 *praddr; 583 u8 *praddr;
584 u8 *psaddr;
585 __le16 fc; 584 __le16 fc;
586 u16 type, cfc; 585 u16 type, cfc;
587 bool packet_matchbssid, packet_toself, packet_beacon; 586 bool packet_matchbssid, packet_toself, packet_beacon;
@@ -593,7 +592,6 @@ static void _rtl92se_translate_rx_signal_stuff(struct ieee80211_hw *hw,
593 cfc = le16_to_cpu(fc); 592 cfc = le16_to_cpu(fc);
594 type = WLAN_FC_GET_TYPE(fc); 593 type = WLAN_FC_GET_TYPE(fc);
595 praddr = hdr->addr1; 594 praddr = hdr->addr1;
596 psaddr = hdr->addr2;
597 595
598 packet_matchbssid = ((IEEE80211_FTYPE_CTL != type) && 596 packet_matchbssid = ((IEEE80211_FTYPE_CTL != type) &&
599 (!compare_ether_addr(mac->bssid, (cfc & IEEE80211_FCTL_TODS) ? 597 (!compare_ether_addr(mac->bssid, (cfc & IEEE80211_FCTL_TODS) ?
@@ -875,6 +873,7 @@ void rtl92se_tx_fill_cmddesc(struct ieee80211_hw *hw, u8 *pdesc,
875 SET_TX_DESC_TX_BUFFER_SIZE(pdesc, (u16)(skb->len)); 873 SET_TX_DESC_TX_BUFFER_SIZE(pdesc, (u16)(skb->len));
876 SET_TX_DESC_TX_BUFFER_ADDRESS(pdesc, cpu_to_le32(mapping)); 874 SET_TX_DESC_TX_BUFFER_ADDRESS(pdesc, cpu_to_le32(mapping));
877 875
876 wmb();
878 SET_TX_DESC_OWN(pdesc, 1); 877 SET_TX_DESC_OWN(pdesc, 1);
879 } else { /* H2C Command Desc format (Host TXCMD) */ 878 } else { /* H2C Command Desc format (Host TXCMD) */
880 /* 92SE must set as 1 for firmware download HW DMA error */ 879 /* 92SE must set as 1 for firmware download HW DMA error */
@@ -893,6 +892,7 @@ void rtl92se_tx_fill_cmddesc(struct ieee80211_hw *hw, u8 *pdesc,
893 SET_TX_DESC_TX_BUFFER_SIZE(pdesc, (u16)(skb->len)); 892 SET_TX_DESC_TX_BUFFER_SIZE(pdesc, (u16)(skb->len));
894 SET_TX_DESC_TX_BUFFER_ADDRESS(pdesc, cpu_to_le32(mapping)); 893 SET_TX_DESC_TX_BUFFER_ADDRESS(pdesc, cpu_to_le32(mapping));
895 894
895 wmb();
896 SET_TX_DESC_OWN(pdesc, 1); 896 SET_TX_DESC_OWN(pdesc, 1);
897 897
898 } 898 }
@@ -903,6 +903,7 @@ void rtl92se_set_desc(u8 *pdesc, bool istx, u8 desc_name, u8 *val)
903 if (istx == true) { 903 if (istx == true) {
904 switch (desc_name) { 904 switch (desc_name) {
905 case HW_DESC_OWN: 905 case HW_DESC_OWN:
906 wmb();
906 SET_TX_DESC_OWN(pdesc, 1); 907 SET_TX_DESC_OWN(pdesc, 1);
907 break; 908 break;
908 case HW_DESC_TX_NEXTDESC_ADDR: 909 case HW_DESC_TX_NEXTDESC_ADDR:
@@ -916,6 +917,7 @@ void rtl92se_set_desc(u8 *pdesc, bool istx, u8 desc_name, u8 *val)
916 } else { 917 } else {
917 switch (desc_name) { 918 switch (desc_name) {
918 case HW_DESC_RXOWN: 919 case HW_DESC_RXOWN:
920 wmb();
919 SET_RX_STATUS_DESC_OWN(pdesc, 1); 921 SET_RX_STATUS_DESC_OWN(pdesc, 1);
920 break; 922 break;
921 case HW_DESC_RXBUFF_ADDR: 923 case HW_DESC_RXBUFF_ADDR:
diff --git a/drivers/net/wireless/rtlwifi/wifi.h b/drivers/net/wireless/rtlwifi/wifi.h
index 693395ee98f9..9d003e0864f5 100644
--- a/drivers/net/wireless/rtlwifi/wifi.h
+++ b/drivers/net/wireless/rtlwifi/wifi.h
@@ -1188,7 +1188,6 @@ struct rtl_efuse {
1188 1188
1189struct rtl_ps_ctl { 1189struct rtl_ps_ctl {
1190 bool pwrdomain_protect; 1190 bool pwrdomain_protect;
1191 bool set_rfpowerstate_inprogress;
1192 bool in_powersavemode; 1191 bool in_powersavemode;
1193 bool rfchange_inprogress; 1192 bool rfchange_inprogress;
1194 bool swrf_processing; 1193 bool swrf_processing;
@@ -1536,6 +1535,7 @@ struct rtl_works {
1536 /* For SW LPS */ 1535 /* For SW LPS */
1537 struct delayed_work ps_work; 1536 struct delayed_work ps_work;
1538 struct delayed_work ps_rfon_wq; 1537 struct delayed_work ps_rfon_wq;
1538 struct tasklet_struct ips_leave_tasklet;
1539}; 1539};
1540 1540
1541struct rtl_debug { 1541struct rtl_debug {