diff options
author | Mike McCormack <mikem@ring3k.org> | 2011-05-31 08:49:36 +0900 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2011-06-03 15:01:05 -0400 |
commit | 312d5479dcfaca2b8aa451201b5388fdb8c8684a (patch) | |
tree | 2ffcf163f8d3ec1103e99263dd78b7ecaa8cc31f /drivers/net/wireless/rtlwifi/ps.c | |
parent | 67fc6052a49b781efbcfc138f3b68fe79ddd0c2f (diff) |
rtlwifi: Don't block interrupts in spinlocks
Now power state transitions are not called from an
interrupt context, there's no need to block interrupts.
This code appears to block interrupts for too long,
causing my trackpad to lose sync occasionally.
Signed-off-by: Mike McCormack <mikem@ring3k.org>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/rtlwifi/ps.c')
-rw-r--r-- | drivers/net/wireless/rtlwifi/ps.c | 44 |
1 files changed, 18 insertions, 26 deletions
diff --git a/drivers/net/wireless/rtlwifi/ps.c b/drivers/net/wireless/rtlwifi/ps.c index fd3b04f0843f..d14c13d02177 100644 --- a/drivers/net/wireless/rtlwifi/ps.c +++ b/drivers/net/wireless/rtlwifi/ps.c @@ -85,7 +85,6 @@ bool rtl_ps_set_rf_state(struct ieee80211_hw *hw, struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); bool actionallowed = false; u16 rfwait_cnt = 0; - unsigned long flag; /*protect_or_not = true; */ @@ -98,10 +97,9 @@ bool rtl_ps_set_rf_state(struct ieee80211_hw *hw, *should wait to be executed. */ while (true) { - spin_lock_irqsave(&rtlpriv->locks.rf_ps_lock, flag); + spin_lock(&rtlpriv->locks.rf_ps_lock); if (ppsc->rfchange_inprogress) { - spin_unlock_irqrestore(&rtlpriv->locks.rf_ps_lock, - flag); + spin_unlock(&rtlpriv->locks.rf_ps_lock); RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, ("RF Change in progress!" @@ -122,8 +120,7 @@ bool rtl_ps_set_rf_state(struct ieee80211_hw *hw, } } else { ppsc->rfchange_inprogress = true; - spin_unlock_irqrestore(&rtlpriv->locks.rf_ps_lock, - flag); + spin_unlock(&rtlpriv->locks.rf_ps_lock); break; } } @@ -171,9 +168,9 @@ no_protect: rtlpriv->cfg->ops->set_rf_power_state(hw, state_toset); if (!protect_or_not) { - spin_lock_irqsave(&rtlpriv->locks.rf_ps_lock, flag); + spin_lock(&rtlpriv->locks.rf_ps_lock); ppsc->rfchange_inprogress = false; - spin_unlock_irqrestore(&rtlpriv->locks.rf_ps_lock, flag); + spin_unlock(&rtlpriv->locks.rf_ps_lock); } return actionallowed; @@ -287,12 +284,11 @@ void rtl_ips_nic_on(struct ieee80211_hw *hw) struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); enum rf_pwrstate rtstate; - unsigned long flags; if (mac->opmode != NL80211_IFTYPE_STATION) return; - spin_lock_irqsave(&rtlpriv->locks.ips_lock, flags); + spin_lock(&rtlpriv->locks.ips_lock); if (ppsc->inactiveps) { rtstate = ppsc->rfpwr_state; @@ -308,7 +304,7 @@ void rtl_ips_nic_on(struct ieee80211_hw *hw) } } - spin_unlock_irqrestore(&rtlpriv->locks.ips_lock, flags); + spin_unlock(&rtlpriv->locks.ips_lock); } /*for FW LPS*/ @@ -426,7 +422,6 @@ void rtl_lps_enter(struct ieee80211_hw *hw) struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); struct rtl_priv *rtlpriv = rtl_priv(hw); - unsigned long flag; if (!ppsc->fwctrl_lps) return; @@ -447,7 +442,7 @@ void rtl_lps_enter(struct ieee80211_hw *hw) if (mac->link_state != MAC80211_LINKED) return; - spin_lock_irqsave(&rtlpriv->locks.lps_lock, flag); + spin_lock(&rtlpriv->locks.lps_lock); /* Idle for a while if we connect to AP a while ago. */ if (mac->cnt_after_linked >= 2) { @@ -459,7 +454,7 @@ void rtl_lps_enter(struct ieee80211_hw *hw) } } - spin_unlock_irqrestore(&rtlpriv->locks.lps_lock, flag); + spin_unlock(&rtlpriv->locks.lps_lock); } /*Leave the leisure power save mode.*/ @@ -468,9 +463,8 @@ void rtl_lps_leave(struct ieee80211_hw *hw) struct rtl_priv *rtlpriv = rtl_priv(hw); struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - unsigned long flag; - spin_lock_irqsave(&rtlpriv->locks.lps_lock, flag); + spin_lock(&rtlpriv->locks.lps_lock); if (ppsc->fwctrl_lps) { if (ppsc->dot11_psmode != EACTIVE) { @@ -491,7 +485,7 @@ void rtl_lps_leave(struct ieee80211_hw *hw) rtl_lps_set_psmode(hw, EACTIVE); } } - spin_unlock_irqrestore(&rtlpriv->locks.lps_lock, flag); + spin_unlock(&rtlpriv->locks.lps_lock); } /* For sw LPS*/ @@ -580,7 +574,6 @@ void rtl_swlps_rf_awake(struct ieee80211_hw *hw) struct rtl_priv *rtlpriv = rtl_priv(hw); struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - unsigned long flag; if (!rtlpriv->psc.swctrl_lps) return; @@ -593,9 +586,9 @@ void rtl_swlps_rf_awake(struct ieee80211_hw *hw) RT_CLEAR_PS_LEVEL(ppsc, RT_PS_LEVEL_ASPM); } - spin_lock_irqsave(&rtlpriv->locks.lps_lock, flag); + spin_lock(&rtlpriv->locks.lps_lock); rtl_ps_set_rf_state(hw, ERFON, RF_CHANGE_BY_PS, false); - spin_unlock_irqrestore(&rtlpriv->locks.lps_lock, flag); + spin_unlock(&rtlpriv->locks.lps_lock); } void rtl_swlps_rfon_wq_callback(void *data) @@ -612,7 +605,6 @@ void rtl_swlps_rf_sleep(struct ieee80211_hw *hw) struct rtl_priv *rtlpriv = rtl_priv(hw); struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); - unsigned long flag; u8 sleep_intv; if (!rtlpriv->psc.sw_ps_enabled) @@ -629,16 +621,16 @@ void rtl_swlps_rf_sleep(struct ieee80211_hw *hw) if (rtlpriv->link_info.busytraffic) return; - spin_lock_irqsave(&rtlpriv->locks.rf_ps_lock, flag); + spin_lock(&rtlpriv->locks.rf_ps_lock); if (rtlpriv->psc.rfchange_inprogress) { - spin_unlock_irqrestore(&rtlpriv->locks.rf_ps_lock, flag); + spin_unlock(&rtlpriv->locks.rf_ps_lock); return; } - spin_unlock_irqrestore(&rtlpriv->locks.rf_ps_lock, flag); + spin_unlock(&rtlpriv->locks.rf_ps_lock); - spin_lock_irqsave(&rtlpriv->locks.lps_lock, flag); + spin_lock(&rtlpriv->locks.lps_lock); rtl_ps_set_rf_state(hw, ERFSLEEP, RF_CHANGE_BY_PS, false); - spin_unlock_irqrestore(&rtlpriv->locks.lps_lock, flag); + spin_unlock(&rtlpriv->locks.lps_lock); if (ppsc->reg_rfps_level & RT_RF_OFF_LEVL_ASPM && !RT_IN_PS_LEVEL(ppsc, RT_PS_LEVEL_ASPM)) { |