aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/rtlwifi
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2011-06-24 17:21:00 -0400
committerDavid S. Miller <davem@davemloft.net>2011-06-24 17:21:00 -0400
commitcd5f3e2064ea21e1cbe140728a1b04e7d32f68eb (patch)
treec2d924b975bdf6fd294546ffb800116c508878e7 /drivers/net/wireless/rtlwifi
parent95cb3656c09fcf6577138337216c27744ebc91e2 (diff)
parent36099365c7cc64e5184b66b6eb094950a13f540c (diff)
Merge branch 'for-davem' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next-2.6
Diffstat (limited to 'drivers/net/wireless/rtlwifi')
-rw-r--r--drivers/net/wireless/rtlwifi/base.c2
-rw-r--r--drivers/net/wireless/rtlwifi/core.c12
-rw-r--r--drivers/net/wireless/rtlwifi/core.h2
-rw-r--r--drivers/net/wireless/rtlwifi/efuse.c8
-rw-r--r--drivers/net/wireless/rtlwifi/pci.c200
-rw-r--r--drivers/net/wireless/rtlwifi/ps.c65
-rw-r--r--drivers/net/wireless/rtlwifi/ps.h3
-rw-r--r--drivers/net/wireless/rtlwifi/rc.c2
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192c/dm_common.c4
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192ce/hw.c10
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192ce/led.c2
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192ce/rf.c2
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192ce/trx.c8
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192cu/hw.c8
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192cu/led.c2
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192cu/rf.c2
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192cu/trx.c2
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192se/dm.c2
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192se/hw.c11
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192se/led.c2
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192se/phy.c4
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192se/reg.h6
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192se/rf.c2
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192se/trx.c6
-rw-r--r--drivers/net/wireless/rtlwifi/wifi.h4
25 files changed, 149 insertions, 222 deletions
diff --git a/drivers/net/wireless/rtlwifi/base.c b/drivers/net/wireless/rtlwifi/base.c
index fb5e43bd7c3c..bc13533a5418 100644
--- a/drivers/net/wireless/rtlwifi/base.c
+++ b/drivers/net/wireless/rtlwifi/base.c
@@ -523,7 +523,7 @@ static void _rtl_query_shortgi(struct ieee80211_hw *hw,
523 mac->opmode == NL80211_IFTYPE_ADHOC) 523 mac->opmode == NL80211_IFTYPE_ADHOC)
524 bw_40 = sta->ht_cap.cap & IEEE80211_HT_CAP_SUP_WIDTH_20_40; 524 bw_40 = sta->ht_cap.cap & IEEE80211_HT_CAP_SUP_WIDTH_20_40;
525 525
526 if ((bw_40 == true) && sgi_40) 526 if (bw_40 && sgi_40)
527 tcb_desc->use_shortgi = true; 527 tcb_desc->use_shortgi = true;
528 else if ((bw_40 == false) && sgi_20) 528 else if ((bw_40 == false) && sgi_20)
529 tcb_desc->use_shortgi = true; 529 tcb_desc->use_shortgi = true;
diff --git a/drivers/net/wireless/rtlwifi/core.c b/drivers/net/wireless/rtlwifi/core.c
index d2ec2535aa3c..03ce69660b26 100644
--- a/drivers/net/wireless/rtlwifi/core.c
+++ b/drivers/net/wireless/rtlwifi/core.c
@@ -335,8 +335,8 @@ static int rtl_op_config(struct ieee80211_hw *hw, u32 changed)
335 * before going offchannel, or dis-association or delete BA will 335 * before going offchannel, or dis-association or delete BA will
336 * happen by AP 336 * happen by AP
337 */ 337 */
338 if (rtlpriv->mac80211.offchan_deley) { 338 if (rtlpriv->mac80211.offchan_delay) {
339 rtlpriv->mac80211.offchan_deley = false; 339 rtlpriv->mac80211.offchan_delay = false;
340 mdelay(50); 340 mdelay(50);
341 } 341 }
342 rtlphy->current_channel = wide_chan; 342 rtlphy->current_channel = wide_chan;
@@ -443,11 +443,11 @@ static int rtl_op_sta_add(struct ieee80211_hw *hw,
443 sta_entry->wireless_mode = WIRELESS_MODE_G; 443 sta_entry->wireless_mode = WIRELESS_MODE_G;
444 if (sta->supp_rates[0] <= 0xf) 444 if (sta->supp_rates[0] <= 0xf)
445 sta_entry->wireless_mode = WIRELESS_MODE_B; 445 sta_entry->wireless_mode = WIRELESS_MODE_B;
446 if (sta->ht_cap.ht_supported == true) 446 if (sta->ht_cap.ht_supported)
447 sta_entry->wireless_mode = WIRELESS_MODE_N_24G; 447 sta_entry->wireless_mode = WIRELESS_MODE_N_24G;
448 } else if (rtlhal->current_bandtype == BAND_ON_5G) { 448 } else if (rtlhal->current_bandtype == BAND_ON_5G) {
449 sta_entry->wireless_mode = WIRELESS_MODE_A; 449 sta_entry->wireless_mode = WIRELESS_MODE_A;
450 if (sta->ht_cap.ht_supported == true) 450 if (sta->ht_cap.ht_supported)
451 sta_entry->wireless_mode = WIRELESS_MODE_N_24G; 451 sta_entry->wireless_mode = WIRELESS_MODE_N_24G;
452 } 452 }
453 453
@@ -650,7 +650,7 @@ static void rtl_op_bss_info_changed(struct ieee80211_hw *hw,
650 RT_TRACE(rtlpriv, COMP_MAC80211, DBG_TRACE, 650 RT_TRACE(rtlpriv, COMP_MAC80211, DBG_TRACE,
651 ("BSS_CHANGED_HT\n")); 651 ("BSS_CHANGED_HT\n"));
652 rcu_read_lock(); 652 rcu_read_lock();
653 sta = get_sta(hw, vif, (u8 *)bss_conf->bssid); 653 sta = get_sta(hw, vif, bss_conf->bssid);
654 if (sta) { 654 if (sta) {
655 if (sta->ht_cap.ampdu_density > 655 if (sta->ht_cap.ampdu_density >
656 mac->current_ampdu_density) 656 mac->current_ampdu_density)
@@ -685,7 +685,7 @@ static void rtl_op_bss_info_changed(struct ieee80211_hw *hw,
685 rtlpriv->cfg->ops->set_network_type(hw, vif->type); 685 rtlpriv->cfg->ops->set_network_type(hw, vif->type);
686 686
687 rcu_read_lock(); 687 rcu_read_lock();
688 sta = get_sta(hw, vif, (u8 *)bss_conf->bssid); 688 sta = get_sta(hw, vif, bss_conf->bssid);
689 if (!sta) { 689 if (!sta) {
690 rcu_read_unlock(); 690 rcu_read_unlock();
691 goto out; 691 goto out;
diff --git a/drivers/net/wireless/rtlwifi/core.h b/drivers/net/wireless/rtlwifi/core.h
index 4b247db2861d..f02824a3b747 100644
--- a/drivers/net/wireless/rtlwifi/core.h
+++ b/drivers/net/wireless/rtlwifi/core.h
@@ -30,6 +30,8 @@
30#ifndef __RTL_CORE_H__ 30#ifndef __RTL_CORE_H__
31#define __RTL_CORE_H__ 31#define __RTL_CORE_H__
32 32
33#include <net/mac80211.h>
34
33#define RTL_SUPPORTED_FILTERS \ 35#define RTL_SUPPORTED_FILTERS \
34 (FIF_PROMISC_IN_BSS | \ 36 (FIF_PROMISC_IN_BSS | \
35 FIF_ALLMULTI | FIF_CONTROL | \ 37 FIF_ALLMULTI | FIF_CONTROL | \
diff --git a/drivers/net/wireless/rtlwifi/efuse.c b/drivers/net/wireless/rtlwifi/efuse.c
index 0b562322f138..3fc21f60bb04 100644
--- a/drivers/net/wireless/rtlwifi/efuse.c
+++ b/drivers/net/wireless/rtlwifi/efuse.c
@@ -382,7 +382,7 @@ bool efuse_shadow_update_chk(struct ieee80211_hw *hw)
382 } 382 }
383 } 383 }
384 384
385 if (wordchanged == true) 385 if (wordchanged)
386 hdr_num++; 386 hdr_num++;
387 } 387 }
388 388
@@ -453,7 +453,7 @@ bool efuse_shadow_update(struct ieee80211_hw *hw)
453 base = offset * 8; 453 base = offset * 8;
454 454
455 for (i = 0; i < 8; i++) { 455 for (i = 0; i < 8; i++) {
456 if (first_pg == true) { 456 if (first_pg) {
457 457
458 word_en &= ~(BIT(i / 2)); 458 word_en &= ~(BIT(i / 2));
459 459
@@ -505,7 +505,7 @@ void rtl_efuse_shadow_map_update(struct ieee80211_hw *hw)
505 struct rtl_priv *rtlpriv = rtl_priv(hw); 505 struct rtl_priv *rtlpriv = rtl_priv(hw);
506 struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); 506 struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw));
507 507
508 if (rtlefuse->autoload_failflag == true) 508 if (rtlefuse->autoload_failflag)
509 memset(&rtlefuse->efuse_map[EFUSE_INIT_MAP][0], 0xFF, 509 memset(&rtlefuse->efuse_map[EFUSE_INIT_MAP][0], 0xFF,
510 rtlpriv->cfg->maps[EFUSE_HWSET_MAX_SIZE]); 510 rtlpriv->cfg->maps[EFUSE_HWSET_MAX_SIZE]);
511 else 511 else
@@ -690,7 +690,7 @@ static void efuse_read_data_case1(struct ieee80211_hw *hw, u16 *efuse_addr,
690 } 690 }
691 } 691 }
692 692
693 if (dataempty == true) { 693 if (dataempty) {
694 *readstate = PG_STATE_DATA; 694 *readstate = PG_STATE_DATA;
695 } else { 695 } else {
696 *efuse_addr = *efuse_addr + (word_cnts * 2) + 1; 696 *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 e502db0532e5..ad39af462f87 100644
--- a/drivers/net/wireless/rtlwifi/pci.c
+++ b/drivers/net/wireless/rtlwifi/pci.c
@@ -581,7 +581,7 @@ static void _rtl_pci_tx_isr(struct ieee80211_hw *hw, int prio)
581 fc = rtl_get_fc(skb); 581 fc = rtl_get_fc(skb);
582 if (ieee80211_is_nullfunc(fc)) { 582 if (ieee80211_is_nullfunc(fc)) {
583 if (ieee80211_has_pm(fc)) { 583 if (ieee80211_has_pm(fc)) {
584 rtlpriv->mac80211.offchan_deley = true; 584 rtlpriv->mac80211.offchan_delay = true;
585 rtlpriv->psc.state_inap = 1; 585 rtlpriv->psc.state_inap = 1;
586 } else { 586 } else {
587 rtlpriv->psc.state_inap = 0; 587 rtlpriv->psc.state_inap = 0;
@@ -626,6 +626,56 @@ tx_status_ok:
626 } 626 }
627} 627}
628 628
629static void _rtl_receive_one(struct ieee80211_hw *hw, struct sk_buff *skb,
630 struct ieee80211_rx_status rx_status)
631{
632 struct rtl_priv *rtlpriv = rtl_priv(hw);
633 struct ieee80211_hdr *hdr = rtl_get_hdr(skb);
634 __le16 fc = rtl_get_fc(skb);
635 bool unicast = false;
636 struct sk_buff *uskb = NULL;
637 u8 *pdata;
638
639
640 memcpy(IEEE80211_SKB_RXCB(skb), &rx_status, sizeof(rx_status));
641
642 if (is_broadcast_ether_addr(hdr->addr1)) {
643 ;/*TODO*/
644 } else if (is_multicast_ether_addr(hdr->addr1)) {
645 ;/*TODO*/
646 } else {
647 unicast = true;
648 rtlpriv->stats.rxbytesunicast += skb->len;
649 }
650
651 rtl_is_special_data(hw, skb, false);
652
653 if (ieee80211_is_data(fc)) {
654 rtlpriv->cfg->ops->led_control(hw, LED_CTL_RX);
655
656 if (unicast)
657 rtlpriv->link_info.num_rx_inperiod++;
658 }
659
660 /* for sw lps */
661 rtl_swlps_beacon(hw, (void *)skb->data, skb->len);
662 rtl_recognize_peer(hw, (void *)skb->data, skb->len);
663 if ((rtlpriv->mac80211.opmode == NL80211_IFTYPE_AP) &&
664 (rtlpriv->rtlhal.current_bandtype == BAND_ON_2_4G) &&
665 (ieee80211_is_beacon(fc) || ieee80211_is_probe_resp(fc)))
666 return;
667
668 if (unlikely(!rtl_action_proc(hw, skb, false)))
669 return;
670
671 uskb = dev_alloc_skb(skb->len + 128);
672 memcpy(IEEE80211_SKB_RXCB(uskb), &rx_status, sizeof(rx_status));
673 pdata = (u8 *)skb_put(uskb, skb->len);
674 memcpy(pdata, skb->data, skb->len);
675
676 ieee80211_rx_irqsafe(hw, uskb);
677}
678
629static void _rtl_pci_rx_interrupt(struct ieee80211_hw *hw) 679static void _rtl_pci_rx_interrupt(struct ieee80211_hw *hw)
630{ 680{
631 struct rtl_priv *rtlpriv = rtl_priv(hw); 681 struct rtl_priv *rtlpriv = rtl_priv(hw);
@@ -637,7 +687,6 @@ static void _rtl_pci_rx_interrupt(struct ieee80211_hw *hw)
637 u8 own; 687 u8 own;
638 u8 tmp_one; 688 u8 tmp_one;
639 u32 bufferaddress; 689 u32 bufferaddress;
640 bool unicast = false;
641 690
642 struct rtl_stats stats = { 691 struct rtl_stats stats = {
643 .signal = 0, 692 .signal = 0,
@@ -654,128 +703,63 @@ static void _rtl_pci_rx_interrupt(struct ieee80211_hw *hw)
654 /*rx pkt */ 703 /*rx pkt */
655 struct sk_buff *skb = rtlpci->rx_ring[rx_queue_idx].rx_buf[ 704 struct sk_buff *skb = rtlpci->rx_ring[rx_queue_idx].rx_buf[
656 index]; 705 index];
706 struct sk_buff *new_skb = NULL;
657 707
658 own = (u8) rtlpriv->cfg->ops->get_desc((u8 *) pdesc, 708 own = (u8) rtlpriv->cfg->ops->get_desc((u8 *) pdesc,
659 false, HW_DESC_OWN); 709 false, HW_DESC_OWN);
660 710
661 if (own) { 711 /*wait data to be filled by hardware */
662 /*wait data to be filled by hardware */ 712 if (own)
663 break; 713 break;
664 } else {
665 struct ieee80211_hdr *hdr;
666 __le16 fc;
667 struct sk_buff *new_skb = NULL;
668
669 rtlpriv->cfg->ops->query_rx_desc(hw, &stats,
670 &rx_status,
671 (u8 *) pdesc, skb);
672
673 new_skb = dev_alloc_skb(rtlpci->rxbuffersize);
674 if (unlikely(!new_skb)) {
675 RT_TRACE(rtlpriv, (COMP_INTR | COMP_RECV),
676 DBG_DMESG,
677 ("can't alloc skb for rx\n"));
678 goto done;
679 }
680 714
681 pci_unmap_single(rtlpci->pdev, 715 rtlpriv->cfg->ops->query_rx_desc(hw, &stats,
682 *((dma_addr_t *) skb->cb), 716 &rx_status,
683 rtlpci->rxbuffersize, 717 (u8 *) pdesc, skb);
684 PCI_DMA_FROMDEVICE);
685 718
686 skb_put(skb, rtlpriv->cfg->ops->get_desc((u8 *) pdesc, 719 if (stats.crc || stats.hwerror)
687 false, 720 goto done;
688 HW_DESC_RXPKT_LEN));
689 skb_reserve(skb,
690 stats.rx_drvinfo_size + stats.rx_bufshift);
691 721
692 /* 722 new_skb = dev_alloc_skb(rtlpci->rxbuffersize);
693 *NOTICE This can not be use for mac80211, 723 if (unlikely(!new_skb)) {
694 *this is done in mac80211 code, 724 RT_TRACE(rtlpriv, (COMP_INTR | COMP_RECV),
695 *if you done here sec DHCP will fail 725 DBG_DMESG,
696 *skb_trim(skb, skb->len - 4); 726 ("can't alloc skb for rx\n"));
697 */ 727 goto done;
728 }
698 729
699 hdr = rtl_get_hdr(skb); 730 pci_unmap_single(rtlpci->pdev,
700 fc = rtl_get_fc(skb); 731 *((dma_addr_t *) skb->cb),
701 732 rtlpci->rxbuffersize,
702 if (!stats.crc && !stats.hwerror) { 733 PCI_DMA_FROMDEVICE);
703 memcpy(IEEE80211_SKB_RXCB(skb), &rx_status,
704 sizeof(rx_status));
705
706 if (is_broadcast_ether_addr(hdr->addr1)) {
707 ;/*TODO*/
708 } else if (is_multicast_ether_addr(hdr->addr1)) {
709 ;/*TODO*/
710 } else {
711 unicast = true;
712 rtlpriv->stats.rxbytesunicast +=
713 skb->len;
714 }
715
716 rtl_is_special_data(hw, skb, false);
717
718 if (ieee80211_is_data(fc)) {
719 rtlpriv->cfg->ops->led_control(hw,
720 LED_CTL_RX);
721
722 if (unicast)
723 rtlpriv->link_info.
724 num_rx_inperiod++;
725 }
726
727 /* for sw lps */
728 rtl_swlps_beacon(hw, (void *)skb->data,
729 skb->len);
730 rtl_recognize_peer(hw, (void *)skb->data,
731 skb->len);
732 if ((rtlpriv->mac80211.opmode ==
733 NL80211_IFTYPE_AP) &&
734 (rtlpriv->rtlhal.current_bandtype ==
735 BAND_ON_2_4G) &&
736 (ieee80211_is_beacon(fc) ||
737 ieee80211_is_probe_resp(fc))) {
738 dev_kfree_skb_any(skb);
739 } else {
740 if (unlikely(!rtl_action_proc(hw, skb,
741 false))) {
742 dev_kfree_skb_any(skb);
743 } else {
744 struct sk_buff *uskb = NULL;
745 u8 *pdata;
746 uskb = dev_alloc_skb(skb->len
747 + 128);
748 memcpy(IEEE80211_SKB_RXCB(uskb),
749 &rx_status,
750 sizeof(rx_status));
751 pdata = (u8 *)skb_put(uskb,
752 skb->len);
753 memcpy(pdata, skb->data,
754 skb->len);
755 dev_kfree_skb_any(skb);
756
757 ieee80211_rx_irqsafe(hw, uskb);
758 }
759 }
760 } else {
761 dev_kfree_skb_any(skb);
762 }
763 734
764 if (((rtlpriv->link_info.num_rx_inperiod + 735 skb_put(skb, rtlpriv->cfg->ops->get_desc((u8 *) pdesc, false,
765 rtlpriv->link_info.num_tx_inperiod) > 8) || 736 HW_DESC_RXPKT_LEN));
766 (rtlpriv->link_info.num_rx_inperiod > 2)) { 737 skb_reserve(skb, stats.rx_drvinfo_size + stats.rx_bufshift);
767 tasklet_schedule(&rtlpriv->works.ips_leave_tasklet);
768 }
769 738
770 skb = new_skb; 739 /*
740 * NOTICE This can not be use for mac80211,
741 * this is done in mac80211 code,
742 * if you done here sec DHCP will fail
743 * skb_trim(skb, skb->len - 4);
744 */
771 745
772 rtlpci->rx_ring[rx_queue_idx].rx_buf[index] = skb; 746 _rtl_receive_one(hw, skb, rx_status);
773 *((dma_addr_t *) skb->cb) = 747
748 if (((rtlpriv->link_info.num_rx_inperiod +
749 rtlpriv->link_info.num_tx_inperiod) > 8) ||
750 (rtlpriv->link_info.num_rx_inperiod > 2)) {
751 tasklet_schedule(&rtlpriv->works.ips_leave_tasklet);
752 }
753
754 dev_kfree_skb_any(skb);
755 skb = new_skb;
756
757 rtlpci->rx_ring[rx_queue_idx].rx_buf[index] = skb;
758 *((dma_addr_t *) skb->cb) =
774 pci_map_single(rtlpci->pdev, skb_tail_pointer(skb), 759 pci_map_single(rtlpci->pdev, skb_tail_pointer(skb),
775 rtlpci->rxbuffersize, 760 rtlpci->rxbuffersize,
776 PCI_DMA_FROMDEVICE); 761 PCI_DMA_FROMDEVICE);
777 762
778 }
779done: 763done:
780 bufferaddress = (*((dma_addr_t *)skb->cb)); 764 bufferaddress = (*((dma_addr_t *)skb->cb));
781 tmp_one = 1; 765 tmp_one = 1;
diff --git a/drivers/net/wireless/rtlwifi/ps.c b/drivers/net/wireless/rtlwifi/ps.c
index d14c13d02177..a693feffbe72 100644
--- a/drivers/net/wireless/rtlwifi/ps.c
+++ b/drivers/net/wireless/rtlwifi/ps.c
@@ -79,59 +79,18 @@ EXPORT_SYMBOL(rtl_ps_disable_nic);
79 79
80bool rtl_ps_set_rf_state(struct ieee80211_hw *hw, 80bool rtl_ps_set_rf_state(struct ieee80211_hw *hw,
81 enum rf_pwrstate state_toset, 81 enum rf_pwrstate state_toset,
82 u32 changesource, bool protect_or_not) 82 u32 changesource)
83{ 83{
84 struct rtl_priv *rtlpriv = rtl_priv(hw); 84 struct rtl_priv *rtlpriv = rtl_priv(hw);
85 struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); 85 struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw));
86 bool actionallowed = false; 86 bool actionallowed = false;
87 u16 rfwait_cnt = 0;
88 87
89 /*protect_or_not = true; */
90
91 if (protect_or_not)
92 goto no_protect;
93
94 /*
95 *Only one thread can change
96 *the RF state at one time, and others
97 *should wait to be executed.
98 */
99 while (true) {
100 spin_lock(&rtlpriv->locks.rf_ps_lock);
101 if (ppsc->rfchange_inprogress) {
102 spin_unlock(&rtlpriv->locks.rf_ps_lock);
103
104 RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING,
105 ("RF Change in progress!"
106 "Wait to set..state_toset(%d).\n",
107 state_toset));
108
109 /* Set RF after the previous action is done. */
110 while (ppsc->rfchange_inprogress) {
111 rfwait_cnt++;
112 mdelay(1);
113
114 /*
115 *Wait too long, return false to avoid
116 *to be stuck here.
117 */
118 if (rfwait_cnt > 100)
119 return false;
120 }
121 } else {
122 ppsc->rfchange_inprogress = true;
123 spin_unlock(&rtlpriv->locks.rf_ps_lock);
124 break;
125 }
126 }
127
128no_protect:
129 switch (state_toset) { 88 switch (state_toset) {
130 case ERFON: 89 case ERFON:
131 ppsc->rfoff_reason &= (~changesource); 90 ppsc->rfoff_reason &= (~changesource);
132 91
133 if ((changesource == RF_CHANGE_BY_HW) && 92 if ((changesource == RF_CHANGE_BY_HW) &&
134 (ppsc->hwradiooff == true)) { 93 (ppsc->hwradiooff)) {
135 ppsc->hwradiooff = false; 94 ppsc->hwradiooff = false;
136 } 95 }
137 96
@@ -167,12 +126,6 @@ no_protect:
167 if (actionallowed) 126 if (actionallowed)
168 rtlpriv->cfg->ops->set_rf_power_state(hw, state_toset); 127 rtlpriv->cfg->ops->set_rf_power_state(hw, state_toset);
169 128
170 if (!protect_or_not) {
171 spin_lock(&rtlpriv->locks.rf_ps_lock);
172 ppsc->rfchange_inprogress = false;
173 spin_unlock(&rtlpriv->locks.rf_ps_lock);
174 }
175
176 return actionallowed; 129 return actionallowed;
177} 130}
178EXPORT_SYMBOL(rtl_ps_set_rf_state); 131EXPORT_SYMBOL(rtl_ps_set_rf_state);
@@ -195,8 +148,7 @@ static void _rtl_ps_inactive_ps(struct ieee80211_hw *hw)
195 } 148 }
196 } 149 }
197 150
198 rtl_ps_set_rf_state(hw, ppsc->inactive_pwrstate, 151 rtl_ps_set_rf_state(hw, ppsc->inactive_pwrstate, RF_CHANGE_BY_IPS);
199 RF_CHANGE_BY_IPS, false);
200 152
201 if (ppsc->inactive_pwrstate == ERFOFF && 153 if (ppsc->inactive_pwrstate == ERFOFF &&
202 rtlhal->interface == INTF_PCI) { 154 rtlhal->interface == INTF_PCI) {
@@ -587,7 +539,7 @@ void rtl_swlps_rf_awake(struct ieee80211_hw *hw)
587 } 539 }
588 540
589 spin_lock(&rtlpriv->locks.lps_lock); 541 spin_lock(&rtlpriv->locks.lps_lock);
590 rtl_ps_set_rf_state(hw, ERFON, RF_CHANGE_BY_PS, false); 542 rtl_ps_set_rf_state(hw, ERFON, RF_CHANGE_BY_PS);
591 spin_unlock(&rtlpriv->locks.lps_lock); 543 spin_unlock(&rtlpriv->locks.lps_lock);
592} 544}
593 545
@@ -621,15 +573,8 @@ void rtl_swlps_rf_sleep(struct ieee80211_hw *hw)
621 if (rtlpriv->link_info.busytraffic) 573 if (rtlpriv->link_info.busytraffic)
622 return; 574 return;
623 575
624 spin_lock(&rtlpriv->locks.rf_ps_lock);
625 if (rtlpriv->psc.rfchange_inprogress) {
626 spin_unlock(&rtlpriv->locks.rf_ps_lock);
627 return;
628 }
629 spin_unlock(&rtlpriv->locks.rf_ps_lock);
630
631 spin_lock(&rtlpriv->locks.lps_lock); 576 spin_lock(&rtlpriv->locks.lps_lock);
632 rtl_ps_set_rf_state(hw, ERFSLEEP, RF_CHANGE_BY_PS, false); 577 rtl_ps_set_rf_state(hw, ERFSLEEP, RF_CHANGE_BY_PS);
633 spin_unlock(&rtlpriv->locks.lps_lock); 578 spin_unlock(&rtlpriv->locks.lps_lock);
634 579
635 if (ppsc->reg_rfps_level & RT_RF_OFF_LEVL_ASPM && 580 if (ppsc->reg_rfps_level & RT_RF_OFF_LEVL_ASPM &&
diff --git a/drivers/net/wireless/rtlwifi/ps.h b/drivers/net/wireless/rtlwifi/ps.h
index e3bf89840370..84628e6041c7 100644
--- a/drivers/net/wireless/rtlwifi/ps.h
+++ b/drivers/net/wireless/rtlwifi/ps.h
@@ -33,8 +33,7 @@
33#define MAX_SW_LPS_SLEEP_INTV 5 33#define MAX_SW_LPS_SLEEP_INTV 5
34 34
35bool rtl_ps_set_rf_state(struct ieee80211_hw *hw, 35bool rtl_ps_set_rf_state(struct ieee80211_hw *hw,
36 enum rf_pwrstate state_toset, u32 changesource, 36 enum rf_pwrstate state_toset, u32 changesource);
37 bool protect_or_not);
38bool rtl_ps_enable_nic(struct ieee80211_hw *hw); 37bool rtl_ps_enable_nic(struct ieee80211_hw *hw);
39bool rtl_ps_disable_nic(struct ieee80211_hw *hw); 38bool rtl_ps_disable_nic(struct ieee80211_hw *hw);
40void rtl_ips_nic_off(struct ieee80211_hw *hw); 39void rtl_ips_nic_off(struct ieee80211_hw *hw);
diff --git a/drivers/net/wireless/rtlwifi/rc.c b/drivers/net/wireless/rtlwifi/rc.c
index 30da68a77786..539df66dce0a 100644
--- a/drivers/net/wireless/rtlwifi/rc.c
+++ b/drivers/net/wireless/rtlwifi/rc.c
@@ -200,7 +200,7 @@ static void rtl_tx_status(void *ppriv,
200 if (sta) { 200 if (sta) {
201 /* Check if aggregation has to be enabled for this tid */ 201 /* Check if aggregation has to be enabled for this tid */
202 sta_entry = (struct rtl_sta_info *) sta->drv_priv; 202 sta_entry = (struct rtl_sta_info *) sta->drv_priv;
203 if ((sta->ht_cap.ht_supported == true) && 203 if ((sta->ht_cap.ht_supported) &&
204 !(skb->protocol == cpu_to_be16(ETH_P_PAE))) { 204 !(skb->protocol == cpu_to_be16(ETH_P_PAE))) {
205 if (ieee80211_is_data_qos(fc)) { 205 if (ieee80211_is_data_qos(fc)) {
206 u8 tid = rtl_get_tid(skb); 206 u8 tid = rtl_get_tid(skb);
diff --git a/drivers/net/wireless/rtlwifi/rtl8192c/dm_common.c b/drivers/net/wireless/rtlwifi/rtl8192c/dm_common.c
index 97183829b9be..a00774e7090d 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192c/dm_common.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192c/dm_common.c
@@ -474,7 +474,7 @@ static void rtl92c_dm_ctrl_initgain_by_twoport(struct ieee80211_hw *hw)
474{ 474{
475 struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); 475 struct rtl_mac *mac = rtl_mac(rtl_priv(hw));
476 476
477 if (mac->act_scanning == true) 477 if (mac->act_scanning)
478 return; 478 return;
479 479
480 if (mac->link_state >= MAC80211_LINKED) 480 if (mac->link_state >= MAC80211_LINKED)
@@ -670,7 +670,7 @@ static void rtl92c_dm_txpower_tracking_callback_thermalmeter(struct ieee80211_hw
670 u8 ofdm_index[2], cck_index = 0, ofdm_index_old[2], cck_index_old = 0; 670 u8 ofdm_index[2], cck_index = 0, ofdm_index_old[2], cck_index_old = 0;
671 int i; 671 int i;
672 bool is2t = IS_92C_SERIAL(rtlhal->version); 672 bool is2t = IS_92C_SERIAL(rtlhal->version);
673 u8 txpwr_level[2] = {0, 0}; 673 s8 txpwr_level[2] = {0, 0};
674 u8 ofdm_min_index = 6, rf; 674 u8 ofdm_min_index = 6, rf;
675 675
676 rtlpriv->dm.txpower_trackinginit = true; 676 rtlpriv->dm.txpower_trackinginit = true;
diff --git a/drivers/net/wireless/rtlwifi/rtl8192ce/hw.c b/drivers/net/wireless/rtlwifi/rtl8192ce/hw.c
index 944f55e9d316..bc6ae9dcf940 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192ce/hw.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192ce/hw.c
@@ -488,7 +488,7 @@ void rtl92ce_set_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val)
488 case HW_VAR_CORRECT_TSF:{ 488 case HW_VAR_CORRECT_TSF:{
489 u8 btype_ibss = ((u8 *) (val))[0]; 489 u8 btype_ibss = ((u8 *) (val))[0];
490 490
491 if (btype_ibss == true) 491 if (btype_ibss)
492 _rtl92ce_stop_tx_beacon(hw); 492 _rtl92ce_stop_tx_beacon(hw);
493 493
494 _rtl92ce_set_bcn_ctrl_reg(hw, 0, BIT(3)); 494 _rtl92ce_set_bcn_ctrl_reg(hw, 0, BIT(3));
@@ -500,7 +500,7 @@ void rtl92ce_set_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val)
500 500
501 _rtl92ce_set_bcn_ctrl_reg(hw, BIT(3), 0); 501 _rtl92ce_set_bcn_ctrl_reg(hw, BIT(3), 0);
502 502
503 if (btype_ibss == true) 503 if (btype_ibss)
504 _rtl92ce_resume_tx_beacon(hw); 504 _rtl92ce_resume_tx_beacon(hw);
505 505
506 break; 506 break;
@@ -1121,7 +1121,7 @@ void rtl92ce_set_check_bssid(struct ieee80211_hw *hw, bool check_bssid)
1121 if (rtlpriv->psc.rfpwr_state != ERFON) 1121 if (rtlpriv->psc.rfpwr_state != ERFON)
1122 return; 1122 return;
1123 1123
1124 if (check_bssid == true) { 1124 if (check_bssid) {
1125 reg_rcr |= (RCR_CBSSID_DATA | RCR_CBSSID_BCN); 1125 reg_rcr |= (RCR_CBSSID_DATA | RCR_CBSSID_BCN);
1126 rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_RCR, 1126 rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_RCR,
1127 (u8 *) (&reg_rcr)); 1127 (u8 *) (&reg_rcr));
@@ -1585,7 +1585,7 @@ static void _rtl92ce_read_adapter_info(struct ieee80211_hw *hw)
1585 rtlefuse->autoload_failflag = false; 1585 rtlefuse->autoload_failflag = false;
1586 } 1586 }
1587 1587
1588 if (rtlefuse->autoload_failflag == true) 1588 if (rtlefuse->autoload_failflag)
1589 return; 1589 return;
1590 1590
1591 for (i = 0; i < 6; i += 2) { 1591 for (i = 0; i < 6; i += 2) {
@@ -1994,7 +1994,7 @@ bool rtl92ce_gpio_radio_on_off_checking(struct ieee80211_hw *hw, u8 *valid)
1994 u1tmp = rtl_read_byte(rtlpriv, REG_GPIO_IO_SEL); 1994 u1tmp = rtl_read_byte(rtlpriv, REG_GPIO_IO_SEL);
1995 e_rfpowerstate_toset = (u1tmp & BIT(3)) ? ERFON : ERFOFF; 1995 e_rfpowerstate_toset = (u1tmp & BIT(3)) ? ERFON : ERFOFF;
1996 1996
1997 if ((ppsc->hwradiooff == true) && (e_rfpowerstate_toset == ERFON)) { 1997 if ((ppsc->hwradiooff) && (e_rfpowerstate_toset == ERFON)) {
1998 RT_TRACE(rtlpriv, COMP_RF, DBG_DMESG, 1998 RT_TRACE(rtlpriv, COMP_RF, DBG_DMESG,
1999 ("GPIOChangeRF - HW Radio ON, RF ON\n")); 1999 ("GPIOChangeRF - HW Radio ON, RF ON\n"));
2000 2000
diff --git a/drivers/net/wireless/rtlwifi/rtl8192ce/led.c b/drivers/net/wireless/rtlwifi/rtl8192ce/led.c
index 9dd1ed7b6422..28a1a707d09c 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192ce/led.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192ce/led.c
@@ -84,7 +84,7 @@ void rtl92ce_sw_led_off(struct ieee80211_hw *hw, struct rtl_led *pled)
84 break; 84 break;
85 case LED_PIN_LED0: 85 case LED_PIN_LED0:
86 ledcfg &= 0xf0; 86 ledcfg &= 0xf0;
87 if (pcipriv->ledctl.led_opendrain == true) 87 if (pcipriv->ledctl.led_opendrain)
88 rtl_write_byte(rtlpriv, REG_LEDCFG2, 88 rtl_write_byte(rtlpriv, REG_LEDCFG2,
89 (ledcfg | BIT(1) | BIT(5) | BIT(6))); 89 (ledcfg | BIT(1) | BIT(5) | BIT(6)));
90 else 90 else
diff --git a/drivers/net/wireless/rtlwifi/rtl8192ce/rf.c b/drivers/net/wireless/rtlwifi/rtl8192ce/rf.c
index 90d0f2cf3b27..d3b01e6023ba 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192ce/rf.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192ce/rf.c
@@ -76,7 +76,7 @@ void rtl92ce_phy_rf6052_set_cck_txpower(struct ieee80211_hw *hw,
76 if (rtlefuse->eeprom_regulatory != 0) 76 if (rtlefuse->eeprom_regulatory != 0)
77 turbo_scanoff = true; 77 turbo_scanoff = true;
78 78
79 if (mac->act_scanning == true) { 79 if (mac->act_scanning) {
80 tx_agc[RF90_PATH_A] = 0x3f3f3f3f; 80 tx_agc[RF90_PATH_A] = 0x3f3f3f3f;
81 tx_agc[RF90_PATH_B] = 0x3f3f3f3f; 81 tx_agc[RF90_PATH_B] = 0x3f3f3f3f;
82 82
diff --git a/drivers/net/wireless/rtlwifi/rtl8192ce/trx.c b/drivers/net/wireless/rtlwifi/rtl8192ce/trx.c
index 2492cc234c03..230bbe900d8d 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192ce/trx.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192ce/trx.c
@@ -225,7 +225,7 @@ static void _rtl92ce_query_rxphystatus(struct ieee80211_hw *hw,
225{ 225{
226 struct rtl_priv *rtlpriv = rtl_priv(hw); 226 struct rtl_priv *rtlpriv = rtl_priv(hw);
227 struct phy_sts_cck_8192s_t *cck_buf; 227 struct phy_sts_cck_8192s_t *cck_buf;
228 s8 rx_pwr_all, rx_pwr[4]; 228 s8 rx_pwr_all = 0, rx_pwr[4];
229 u8 evm, pwdb_all, rf_rx_num = 0; 229 u8 evm, pwdb_all, rf_rx_num = 0;
230 u8 i, max_spatial_stream; 230 u8 i, max_spatial_stream;
231 u32 rssi, total_rssi = 0; 231 u32 rssi, total_rssi = 0;
@@ -678,7 +678,7 @@ bool rtl92ce_rx_query_desc(struct ieee80211_hw *hw,
678 GET_RX_DESC_PAGGR(pdesc)); 678 GET_RX_DESC_PAGGR(pdesc));
679 679
680 rx_status->mactime = GET_RX_DESC_TSFL(pdesc); 680 rx_status->mactime = GET_RX_DESC_TSFL(pdesc);
681 if (phystatus == true) { 681 if (phystatus) {
682 p_drvinfo = (struct rx_fwinfo_92c *)(skb->data + 682 p_drvinfo = (struct rx_fwinfo_92c *)(skb->data +
683 stats->rx_bufshift); 683 stats->rx_bufshift);
684 684
@@ -927,7 +927,7 @@ void rtl92ce_tx_fill_cmddesc(struct ieee80211_hw *hw,
927 927
928void rtl92ce_set_desc(u8 *pdesc, bool istx, u8 desc_name, u8 *val) 928void rtl92ce_set_desc(u8 *pdesc, bool istx, u8 desc_name, u8 *val)
929{ 929{
930 if (istx == true) { 930 if (istx) {
931 switch (desc_name) { 931 switch (desc_name) {
932 case HW_DESC_OWN: 932 case HW_DESC_OWN:
933 wmb(); 933 wmb();
@@ -968,7 +968,7 @@ u32 rtl92ce_get_desc(u8 *p_desc, bool istx, u8 desc_name)
968{ 968{
969 u32 ret = 0; 969 u32 ret = 0;
970 970
971 if (istx == true) { 971 if (istx) {
972 switch (desc_name) { 972 switch (desc_name) {
973 case HW_DESC_OWN: 973 case HW_DESC_OWN:
974 ret = GET_TX_DESC_OWN(p_desc); 974 ret = GET_TX_DESC_OWN(p_desc);
diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/hw.c b/drivers/net/wireless/rtlwifi/rtl8192cu/hw.c
index 52e2af58c1ed..2b34764fbf73 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192cu/hw.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192cu/hw.c
@@ -520,7 +520,7 @@ static void _rtl92cu_read_adapter_info(struct ieee80211_hw *hw)
520 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, ("Autoload OK\n")); 520 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, ("Autoload OK\n"));
521 rtlefuse->autoload_failflag = false; 521 rtlefuse->autoload_failflag = false;
522 } 522 }
523 if (rtlefuse->autoload_failflag == true) 523 if (rtlefuse->autoload_failflag)
524 return; 524 return;
525 for (i = 0; i < 6; i += 2) { 525 for (i = 0; i < 6; i += 2) {
526 usvalue = *(u16 *)&hwinfo[EEPROM_MAC_ADDR + i]; 526 usvalue = *(u16 *)&hwinfo[EEPROM_MAC_ADDR + i];
@@ -1594,7 +1594,7 @@ static void _rtl92cu_set_check_bssid(struct ieee80211_hw *hw,
1594 default: 1594 default:
1595 break; 1595 break;
1596 } 1596 }
1597 if (filterout_non_associated_bssid == true) { 1597 if (filterout_non_associated_bssid) {
1598 if (IS_NORMAL_CHIP(rtlhal->version)) { 1598 if (IS_NORMAL_CHIP(rtlhal->version)) {
1599 switch (rtlphy->current_io_type) { 1599 switch (rtlphy->current_io_type) {
1600 case IO_CMD_RESUME_DM_BY_SCAN: 1600 case IO_CMD_RESUME_DM_BY_SCAN:
@@ -2155,7 +2155,7 @@ void rtl92cu_set_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val)
2155 case HW_VAR_CORRECT_TSF:{ 2155 case HW_VAR_CORRECT_TSF:{
2156 u8 btype_ibss = ((u8 *) (val))[0]; 2156 u8 btype_ibss = ((u8 *) (val))[0];
2157 2157
2158 if (btype_ibss == true) 2158 if (btype_ibss)
2159 _rtl92cu_stop_tx_beacon(hw); 2159 _rtl92cu_stop_tx_beacon(hw);
2160 _rtl92cu_set_bcn_ctrl_reg(hw, 0, BIT(3)); 2160 _rtl92cu_set_bcn_ctrl_reg(hw, 0, BIT(3));
2161 rtl_write_dword(rtlpriv, REG_TSFTR, (u32)(mac->tsf & 2161 rtl_write_dword(rtlpriv, REG_TSFTR, (u32)(mac->tsf &
@@ -2163,7 +2163,7 @@ void rtl92cu_set_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val)
2163 rtl_write_dword(rtlpriv, REG_TSFTR + 4, 2163 rtl_write_dword(rtlpriv, REG_TSFTR + 4,
2164 (u32)((mac->tsf >> 32) & 0xffffffff)); 2164 (u32)((mac->tsf >> 32) & 0xffffffff));
2165 _rtl92cu_set_bcn_ctrl_reg(hw, BIT(3), 0); 2165 _rtl92cu_set_bcn_ctrl_reg(hw, BIT(3), 0);
2166 if (btype_ibss == true) 2166 if (btype_ibss)
2167 _rtl92cu_resume_tx_beacon(hw); 2167 _rtl92cu_resume_tx_beacon(hw);
2168 break; 2168 break;
2169 } 2169 }
diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/led.c b/drivers/net/wireless/rtlwifi/rtl8192cu/led.c
index 332c74348a69..2ff9d8314e7b 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192cu/led.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192cu/led.c
@@ -82,7 +82,7 @@ void rtl92cu_sw_led_off(struct ieee80211_hw *hw, struct rtl_led *pled)
82 break; 82 break;
83 case LED_PIN_LED0: 83 case LED_PIN_LED0:
84 ledcfg &= 0xf0; 84 ledcfg &= 0xf0;
85 if (usbpriv->ledctl.led_opendrain == true) 85 if (usbpriv->ledctl.led_opendrain)
86 rtl_write_byte(rtlpriv, REG_LEDCFG2, 86 rtl_write_byte(rtlpriv, REG_LEDCFG2,
87 (ledcfg | BIT(1) | BIT(5) | BIT(6))); 87 (ledcfg | BIT(1) | BIT(5) | BIT(6)));
88 else 88 else
diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/rf.c b/drivers/net/wireless/rtlwifi/rtl8192cu/rf.c
index c7576ec4744e..1e851aae58db 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192cu/rf.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192cu/rf.c
@@ -82,7 +82,7 @@ void rtl92cu_phy_rf6052_set_cck_txpower(struct ieee80211_hw *hw,
82 (rtlefuse->external_pa)) 82 (rtlefuse->external_pa))
83 turbo_scanoff = true; 83 turbo_scanoff = true;
84 } 84 }
85 if (mac->act_scanning == true) { 85 if (mac->act_scanning) {
86 tx_agc[RF90_PATH_A] = 0x3f3f3f3f; 86 tx_agc[RF90_PATH_A] = 0x3f3f3f3f;
87 tx_agc[RF90_PATH_B] = 0x3f3f3f3f; 87 tx_agc[RF90_PATH_B] = 0x3f3f3f3f;
88 if (turbo_scanoff) { 88 if (turbo_scanoff) {
diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/trx.c b/drivers/net/wireless/rtlwifi/rtl8192cu/trx.c
index 3a92ba3c4a1e..906e7aa55bc3 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192cu/trx.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192cu/trx.c
@@ -342,7 +342,7 @@ bool rtl92cu_rx_query_desc(struct ieee80211_hw *hw,
342 (u8)GET_RX_DESC_RX_MCS(pdesc), 342 (u8)GET_RX_DESC_RX_MCS(pdesc),
343 (bool)GET_RX_DESC_PAGGR(pdesc)); 343 (bool)GET_RX_DESC_PAGGR(pdesc));
344 rx_status->mactime = GET_RX_DESC_TSFL(pdesc); 344 rx_status->mactime = GET_RX_DESC_TSFL(pdesc);
345 if (phystatus == true) { 345 if (phystatus) {
346 p_drvinfo = (struct rx_fwinfo_92c *)(pdesc + RTL_RX_DESC_SIZE); 346 p_drvinfo = (struct rx_fwinfo_92c *)(pdesc + RTL_RX_DESC_SIZE);
347 rtl92c_translate_rx_signal_stuff(hw, skb, stats, pdesc, 347 rtl92c_translate_rx_signal_stuff(hw, skb, stats, pdesc,
348 p_drvinfo); 348 p_drvinfo);
diff --git a/drivers/net/wireless/rtlwifi/rtl8192se/dm.c b/drivers/net/wireless/rtlwifi/rtl8192se/dm.c
index 609c7ec7e66a..4203a8531ca0 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192se/dm.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192se/dm.c
@@ -452,7 +452,7 @@ static void _rtl92s_dm_initial_gain_sta_beforeconnect(struct ieee80211_hw *hw)
452 if (rtlpriv->psc.rfpwr_state != ERFON) 452 if (rtlpriv->psc.rfpwr_state != ERFON)
453 return; 453 return;
454 454
455 if (digtable.backoff_enable_flag == true) 455 if (digtable.backoff_enable_flag)
456 rtl92s_backoff_enable_flag(hw); 456 rtl92s_backoff_enable_flag(hw);
457 else 457 else
458 digtable.backoff_val = DM_DIG_BACKOFF; 458 digtable.backoff_val = DM_DIG_BACKOFF;
diff --git a/drivers/net/wireless/rtlwifi/rtl8192se/hw.c b/drivers/net/wireless/rtlwifi/rtl8192se/hw.c
index 35dd12d0dcf3..13da7b3c0202 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192se/hw.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192se/hw.c
@@ -516,7 +516,7 @@ static u8 _rtl92se_rf_onoff_detect(struct ieee80211_hw *hw)
516 mdelay(10); 516 mdelay(10);
517 517
518 /* check GPIO3 */ 518 /* check GPIO3 */
519 u1tmp = rtl_read_byte(rtlpriv, GPIO_IN); 519 u1tmp = rtl_read_byte(rtlpriv, GPIO_IN_SE);
520 retval = (u1tmp & HAL_8192S_HW_GPIO_OFF_BIT) ? ERFON : ERFOFF; 520 retval = (u1tmp & HAL_8192S_HW_GPIO_OFF_BIT) ? ERFON : ERFOFF;
521 521
522 return retval; 522 return retval;
@@ -994,7 +994,8 @@ int rtl92se_hw_init(struct ieee80211_hw *hw)
994 994
995 rtlpriv->psc.rfoff_reason = RF_CHANGE_BY_INIT; 995 rtlpriv->psc.rfoff_reason = RF_CHANGE_BY_INIT;
996 rtlpriv->psc.rfpwr_state = ERFON; 996 rtlpriv->psc.rfpwr_state = ERFON;
997 rtl_ps_set_rf_state(hw, ERFOFF, rfoffreason, true); 997 /* FIXME: check spinlocks if this block is uncommented */
998 rtl_ps_set_rf_state(hw, ERFOFF, rfoffreason);
998 } else { 999 } else {
999 /* gpio radio on/off is out of adapter start */ 1000 /* gpio radio on/off is out of adapter start */
1000 if (rtlpriv->psc.hwradiooff == false) { 1001 if (rtlpriv->psc.hwradiooff == false) {
@@ -1105,7 +1106,7 @@ void rtl92se_set_check_bssid(struct ieee80211_hw *hw, bool check_bssid)
1105 if (rtlpriv->psc.rfpwr_state != ERFON) 1106 if (rtlpriv->psc.rfpwr_state != ERFON)
1106 return; 1107 return;
1107 1108
1108 if (check_bssid == true) { 1109 if (check_bssid) {
1109 reg_rcr |= (RCR_CBSSID); 1110 reg_rcr |= (RCR_CBSSID);
1110 rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_RCR, (u8 *)(&reg_rcr)); 1111 rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_RCR, (u8 *)(&reg_rcr));
1111 } else if (check_bssid == false) { 1112 } else if (check_bssid == false) {
@@ -1651,7 +1652,7 @@ static void _rtl92se_read_adapter_info(struct ieee80211_hw *hw)
1651 rtlefuse->autoload_failflag = false; 1652 rtlefuse->autoload_failflag = false;
1652 } 1653 }
1653 1654
1654 if (rtlefuse->autoload_failflag == true) 1655 if (rtlefuse->autoload_failflag)
1655 return; 1656 return;
1656 1657
1657 _rtl8192se_get_IC_Inferiority(hw); 1658 _rtl8192se_get_IC_Inferiority(hw);
@@ -2301,7 +2302,7 @@ bool rtl92se_gpio_radio_on_off_checking(struct ieee80211_hw *hw, u8 *valid)
2301 2302
2302 rfpwr_toset = _rtl92se_rf_onoff_detect(hw); 2303 rfpwr_toset = _rtl92se_rf_onoff_detect(hw);
2303 2304
2304 if ((ppsc->hwradiooff == true) && (rfpwr_toset == ERFON)) { 2305 if ((ppsc->hwradiooff) && (rfpwr_toset == ERFON)) {
2305 RT_TRACE(rtlpriv, COMP_RF, DBG_DMESG, 2306 RT_TRACE(rtlpriv, COMP_RF, DBG_DMESG,
2306 ("RFKILL-HW Radio ON, RF ON\n")); 2307 ("RFKILL-HW Radio ON, RF ON\n"));
2307 2308
diff --git a/drivers/net/wireless/rtlwifi/rtl8192se/led.c b/drivers/net/wireless/rtlwifi/rtl8192se/led.c
index 6d4f66616680..e3fe7c90ebf4 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192se/led.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192se/led.c
@@ -90,7 +90,7 @@ void rtl92se_sw_led_off(struct ieee80211_hw *hw, struct rtl_led *pled)
90 break; 90 break;
91 case LED_PIN_LED0: 91 case LED_PIN_LED0:
92 ledcfg &= 0xf0; 92 ledcfg &= 0xf0;
93 if (pcipriv->ledctl.led_opendrain == true) 93 if (pcipriv->ledctl.led_opendrain)
94 rtl_write_byte(rtlpriv, LEDCFG, (ledcfg | BIT(1))); 94 rtl_write_byte(rtlpriv, LEDCFG, (ledcfg | BIT(1)));
95 else 95 else
96 rtl_write_byte(rtlpriv, LEDCFG, (ledcfg | BIT(3))); 96 rtl_write_byte(rtlpriv, LEDCFG, (ledcfg | BIT(3)));
diff --git a/drivers/net/wireless/rtlwifi/rtl8192se/phy.c b/drivers/net/wireless/rtlwifi/rtl8192se/phy.c
index 7ee2daccd7d5..81a5aa4370cf 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192se/phy.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192se/phy.c
@@ -1416,7 +1416,7 @@ static void _rtl92s_phy_set_fwcmd_io(struct ieee80211_hw *hw)
1416 break; 1416 break;
1417 case FW_CMD_HIGH_PWR_ENABLE: 1417 case FW_CMD_HIGH_PWR_ENABLE:
1418 if ((rtlpriv->dm.dm_flag & HAL_DM_HIPWR_DISABLE) || 1418 if ((rtlpriv->dm.dm_flag & HAL_DM_HIPWR_DISABLE) ||
1419 (rtlpriv->dm.dynamic_txpower_enable == true)) 1419 rtlpriv->dm.dynamic_txpower_enable)
1420 break; 1420 break;
1421 1421
1422 /* CCA threshold */ 1422 /* CCA threshold */
@@ -1608,7 +1608,7 @@ bool rtl92s_phy_set_fw_cmd(struct ieee80211_hw *hw, enum fwcmd_iotype fw_cmdio)
1608 fw_cmdmap &= ~FW_DIG_ENABLE_CTL; 1608 fw_cmdmap &= ~FW_DIG_ENABLE_CTL;
1609 1609
1610 if ((rtlpriv->dm.dm_flag & HAL_DM_HIPWR_DISABLE) || 1610 if ((rtlpriv->dm.dm_flag & HAL_DM_HIPWR_DISABLE) ||
1611 (rtlpriv->dm.dynamic_txpower_enable == true)) 1611 rtlpriv->dm.dynamic_txpower_enable)
1612 fw_cmdmap &= ~FW_HIGH_PWR_ENABLE_CTL; 1612 fw_cmdmap &= ~FW_HIGH_PWR_ENABLE_CTL;
1613 1613
1614 if ((digtable.dig_ext_port_stage == 1614 if ((digtable.dig_ext_port_stage ==
diff --git a/drivers/net/wireless/rtlwifi/rtl8192se/reg.h b/drivers/net/wireless/rtlwifi/rtl8192se/reg.h
index 0116eaddbfac..ea32ef2d4098 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192se/reg.h
+++ b/drivers/net/wireless/rtlwifi/rtl8192se/reg.h
@@ -248,12 +248,8 @@
248#define PSTIME 0x02E0 248#define PSTIME 0x02E0
249#define TIMER0 0x02E4 249#define TIMER0 0x02E4
250#define TIMER1 0x02E8 250#define TIMER1 0x02E8
251#define GPIO_CTRL 0x02EC 251#define GPIO_IN_SE 0x02EC
252#define GPIO_IN 0x02EC
253#define GPIO_OUT 0x02ED
254#define GPIO_IO_SEL 0x02EE 252#define GPIO_IO_SEL 0x02EE
255#define GPIO_MOD 0x02EF
256#define GPIO_INTCTRL 0x02F0
257#define MAC_PINMUX_CFG 0x02F1 253#define MAC_PINMUX_CFG 0x02F1
258#define LEDCFG 0x02F2 254#define LEDCFG 0x02F2
259#define PHY_REG 0x02F3 255#define PHY_REG 0x02F3
diff --git a/drivers/net/wireless/rtlwifi/rtl8192se/rf.c b/drivers/net/wireless/rtlwifi/rtl8192se/rf.c
index 1d3a48330399..c6e3a4ca42f9 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192se/rf.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192se/rf.c
@@ -410,7 +410,7 @@ void rtl92s_phy_rf6052_set_ccktxpower(struct ieee80211_hw *hw, u8 pwrlevel)
410 (rtlefuse->eeprom_regulatory != 0))) 410 (rtlefuse->eeprom_regulatory != 0)))
411 dont_inc_cck_or_turboscanoff = true; 411 dont_inc_cck_or_turboscanoff = true;
412 412
413 if (mac->act_scanning == true) { 413 if (mac->act_scanning) {
414 txagc = 0x3f; 414 txagc = 0x3f;
415 if (dont_inc_cck_or_turboscanoff) 415 if (dont_inc_cck_or_turboscanoff)
416 txagc = pwrlevel; 416 txagc = pwrlevel;
diff --git a/drivers/net/wireless/rtlwifi/rtl8192se/trx.c b/drivers/net/wireless/rtlwifi/rtl8192se/trx.c
index d509cf6a1e4d..cffe30851f79 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192se/trx.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192se/trx.c
@@ -661,7 +661,7 @@ bool rtl92se_rx_query_desc(struct ieee80211_hw *hw, struct rtl_stats *stats,
661 661
662 662
663 rx_status->mactime = GET_RX_STATUS_DESC_TSFL(pdesc); 663 rx_status->mactime = GET_RX_STATUS_DESC_TSFL(pdesc);
664 if (phystatus == true) { 664 if (phystatus) {
665 p_drvinfo = (struct rx_fwinfo *)(skb->data + 665 p_drvinfo = (struct rx_fwinfo *)(skb->data +
666 stats->rx_bufshift); 666 stats->rx_bufshift);
667 _rtl92se_translate_rx_signal_stuff(hw, skb, stats, pdesc, 667 _rtl92se_translate_rx_signal_stuff(hw, skb, stats, pdesc,
@@ -900,7 +900,7 @@ void rtl92se_tx_fill_cmddesc(struct ieee80211_hw *hw, u8 *pdesc,
900 900
901void rtl92se_set_desc(u8 *pdesc, bool istx, u8 desc_name, u8 *val) 901void rtl92se_set_desc(u8 *pdesc, bool istx, u8 desc_name, u8 *val)
902{ 902{
903 if (istx == true) { 903 if (istx) {
904 switch (desc_name) { 904 switch (desc_name) {
905 case HW_DESC_OWN: 905 case HW_DESC_OWN:
906 wmb(); 906 wmb();
@@ -941,7 +941,7 @@ u32 rtl92se_get_desc(u8 *desc, bool istx, u8 desc_name)
941{ 941{
942 u32 ret = 0; 942 u32 ret = 0;
943 943
944 if (istx == true) { 944 if (istx) {
945 switch (desc_name) { 945 switch (desc_name) {
946 case HW_DESC_OWN: 946 case HW_DESC_OWN:
947 ret = GET_TX_DESC_OWN(desc); 947 ret = GET_TX_DESC_OWN(desc);
diff --git a/drivers/net/wireless/rtlwifi/wifi.h b/drivers/net/wireless/rtlwifi/wifi.h
index 75dff1e095f6..6890e197155b 100644
--- a/drivers/net/wireless/rtlwifi/wifi.h
+++ b/drivers/net/wireless/rtlwifi/wifi.h
@@ -937,7 +937,7 @@ struct rtl_mac {
937 int n_channels; 937 int n_channels;
938 int n_bitrates; 938 int n_bitrates;
939 939
940 bool offchan_deley; 940 bool offchan_delay;
941 941
942 /*filters */ 942 /*filters */
943 u32 rx_conf; 943 u32 rx_conf;
@@ -1982,7 +1982,7 @@ static inline u16 rtl_get_tid(struct sk_buff *skb)
1982 1982
1983static inline struct ieee80211_sta *get_sta(struct ieee80211_hw *hw, 1983static inline struct ieee80211_sta *get_sta(struct ieee80211_hw *hw,
1984 struct ieee80211_vif *vif, 1984 struct ieee80211_vif *vif,
1985 u8 *bssid) 1985 const u8 *bssid)
1986{ 1986{
1987 return ieee80211_find_sta(vif, bssid); 1987 return ieee80211_find_sta(vif, bssid);
1988} 1988}