rtlwifi: rf_lock use non-irqsave spin_lock
rf_lock is used to protect RF register access, but they will not called from interrupt context, so *_irqsave version isn't necessary. Then, these delays don't affect IRQ services. The old code holds spin_lock_irqsave() that will be detected a long delay as below: kworker/-276 4d... 0us : _raw_spin_lock_irqsave kworker/-276 4d... 0us : rtl8723_phy_rf_serial_read <-rtl8723de_phy_set_rf_reg kworker/-276 4d... 1us : rtl8723_phy_query_bb_reg <-rtl8723_phy_rf_serial_read kworker/-276 4d... 3us : rtl8723_phy_set_bb_reg <-rtl8723_phy_rf_serial_read kworker/-276 4d... 4us : __const_udelay <-rtl8723_phy_rf_serial_read kworker/-276 4d... 4us!: delay_mwaitx <-rtl8723_phy_rf_serial_read kworker/-276 4d... 1004us : rtl8723_phy_set_bb_reg <-rtl8723_phy_rf_serial_read [...] Reported-by: Lucas Stach <dev@lynxeye.de> Signed-off-by: Ping-Ke Shih <pkshih@realtek.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
This commit is contained in:
parent
f89f1aefff
commit
92541dd9dd
|
@ -85,20 +85,19 @@ u32 rtl88e_phy_query_rf_reg(struct ieee80211_hw *hw,
|
|||
{
|
||||
struct rtl_priv *rtlpriv = rtl_priv(hw);
|
||||
u32 original_value, readback_value, bitshift;
|
||||
unsigned long flags;
|
||||
|
||||
RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE,
|
||||
"regaddr(%#x), rfpath(%#x), bitmask(%#x)\n",
|
||||
regaddr, rfpath, bitmask);
|
||||
|
||||
spin_lock_irqsave(&rtlpriv->locks.rf_lock, flags);
|
||||
spin_lock(&rtlpriv->locks.rf_lock);
|
||||
|
||||
|
||||
original_value = _rtl88e_phy_rf_serial_read(hw, rfpath, regaddr);
|
||||
bitshift = _rtl88e_phy_calculate_bit_shift(bitmask);
|
||||
readback_value = (original_value & bitmask) >> bitshift;
|
||||
|
||||
spin_unlock_irqrestore(&rtlpriv->locks.rf_lock, flags);
|
||||
spin_unlock(&rtlpriv->locks.rf_lock);
|
||||
|
||||
RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE,
|
||||
"regaddr(%#x), rfpath(%#x), bitmask(%#x), original_value(%#x)\n",
|
||||
|
@ -112,13 +111,12 @@ void rtl88e_phy_set_rf_reg(struct ieee80211_hw *hw,
|
|||
{
|
||||
struct rtl_priv *rtlpriv = rtl_priv(hw);
|
||||
u32 original_value, bitshift;
|
||||
unsigned long flags;
|
||||
|
||||
RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE,
|
||||
"regaddr(%#x), bitmask(%#x), data(%#x), rfpath(%#x)\n",
|
||||
regaddr, bitmask, data, rfpath);
|
||||
|
||||
spin_lock_irqsave(&rtlpriv->locks.rf_lock, flags);
|
||||
spin_lock(&rtlpriv->locks.rf_lock);
|
||||
|
||||
if (bitmask != RFREG_OFFSET_MASK) {
|
||||
original_value = _rtl88e_phy_rf_serial_read(hw,
|
||||
|
@ -133,7 +131,7 @@ void rtl88e_phy_set_rf_reg(struct ieee80211_hw *hw,
|
|||
_rtl88e_phy_rf_serial_write(hw, rfpath, regaddr, data);
|
||||
|
||||
|
||||
spin_unlock_irqrestore(&rtlpriv->locks.rf_lock, flags);
|
||||
spin_unlock(&rtlpriv->locks.rf_lock);
|
||||
|
||||
RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE,
|
||||
"regaddr(%#x), bitmask(%#x), data(%#x), rfpath(%#x)\n",
|
||||
|
|
|
@ -307,16 +307,15 @@ u32 rtl92d_phy_query_rf_reg(struct ieee80211_hw *hw,
|
|||
{
|
||||
struct rtl_priv *rtlpriv = rtl_priv(hw);
|
||||
u32 original_value, readback_value, bitshift;
|
||||
unsigned long flags;
|
||||
|
||||
RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE,
|
||||
"regaddr(%#x), rfpath(%#x), bitmask(%#x)\n",
|
||||
regaddr, rfpath, bitmask);
|
||||
spin_lock_irqsave(&rtlpriv->locks.rf_lock, flags);
|
||||
spin_lock(&rtlpriv->locks.rf_lock);
|
||||
original_value = _rtl92d_phy_rf_serial_read(hw, rfpath, regaddr);
|
||||
bitshift = _rtl92d_phy_calculate_bit_shift(bitmask);
|
||||
readback_value = (original_value & bitmask) >> bitshift;
|
||||
spin_unlock_irqrestore(&rtlpriv->locks.rf_lock, flags);
|
||||
spin_unlock(&rtlpriv->locks.rf_lock);
|
||||
RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE,
|
||||
"regaddr(%#x), rfpath(%#x), bitmask(%#x), original_value(%#x)\n",
|
||||
regaddr, rfpath, bitmask, original_value);
|
||||
|
@ -329,14 +328,13 @@ void rtl92d_phy_set_rf_reg(struct ieee80211_hw *hw, enum radio_path rfpath,
|
|||
struct rtl_priv *rtlpriv = rtl_priv(hw);
|
||||
struct rtl_phy *rtlphy = &(rtlpriv->phy);
|
||||
u32 original_value, bitshift;
|
||||
unsigned long flags;
|
||||
|
||||
RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE,
|
||||
"regaddr(%#x), bitmask(%#x), data(%#x), rfpath(%#x)\n",
|
||||
regaddr, bitmask, data, rfpath);
|
||||
if (bitmask == 0)
|
||||
return;
|
||||
spin_lock_irqsave(&rtlpriv->locks.rf_lock, flags);
|
||||
spin_lock(&rtlpriv->locks.rf_lock);
|
||||
if (rtlphy->rf_mode != RF_OP_BY_FW) {
|
||||
if (bitmask != RFREG_OFFSET_MASK) {
|
||||
original_value = _rtl92d_phy_rf_serial_read(hw,
|
||||
|
@ -347,7 +345,7 @@ void rtl92d_phy_set_rf_reg(struct ieee80211_hw *hw, enum radio_path rfpath,
|
|||
}
|
||||
_rtl92d_phy_rf_serial_write(hw, rfpath, regaddr, data);
|
||||
}
|
||||
spin_unlock_irqrestore(&rtlpriv->locks.rf_lock, flags);
|
||||
spin_unlock(&rtlpriv->locks.rf_lock);
|
||||
RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE,
|
||||
"regaddr(%#x), bitmask(%#x), data(%#x), rfpath(%#x)\n",
|
||||
regaddr, bitmask, data, rfpath);
|
||||
|
|
|
@ -84,19 +84,18 @@ u32 rtl92ee_phy_query_rf_reg(struct ieee80211_hw *hw,
|
|||
{
|
||||
struct rtl_priv *rtlpriv = rtl_priv(hw);
|
||||
u32 original_value, readback_value, bitshift;
|
||||
unsigned long flags;
|
||||
|
||||
RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE,
|
||||
"regaddr(%#x), rfpath(%#x), bitmask(%#x)\n",
|
||||
regaddr, rfpath, bitmask);
|
||||
|
||||
spin_lock_irqsave(&rtlpriv->locks.rf_lock, flags);
|
||||
spin_lock(&rtlpriv->locks.rf_lock);
|
||||
|
||||
original_value = _rtl92ee_phy_rf_serial_read(hw , rfpath, regaddr);
|
||||
bitshift = _rtl92ee_phy_calculate_bit_shift(bitmask);
|
||||
readback_value = (original_value & bitmask) >> bitshift;
|
||||
|
||||
spin_unlock_irqrestore(&rtlpriv->locks.rf_lock, flags);
|
||||
spin_unlock(&rtlpriv->locks.rf_lock);
|
||||
|
||||
RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE,
|
||||
"regaddr(%#x),rfpath(%#x),bitmask(%#x),original_value(%#x)\n",
|
||||
|
@ -111,13 +110,12 @@ void rtl92ee_phy_set_rf_reg(struct ieee80211_hw *hw,
|
|||
{
|
||||
struct rtl_priv *rtlpriv = rtl_priv(hw);
|
||||
u32 original_value, bitshift;
|
||||
unsigned long flags;
|
||||
|
||||
RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE,
|
||||
"regaddr(%#x), bitmask(%#x), data(%#x), rfpath(%#x)\n",
|
||||
addr, bitmask, data, rfpath);
|
||||
|
||||
spin_lock_irqsave(&rtlpriv->locks.rf_lock, flags);
|
||||
spin_lock(&rtlpriv->locks.rf_lock);
|
||||
|
||||
if (bitmask != RFREG_OFFSET_MASK) {
|
||||
original_value = _rtl92ee_phy_rf_serial_read(hw, rfpath, addr);
|
||||
|
@ -127,7 +125,7 @@ void rtl92ee_phy_set_rf_reg(struct ieee80211_hw *hw,
|
|||
|
||||
_rtl92ee_phy_rf_serial_write(hw, rfpath, addr, data);
|
||||
|
||||
spin_unlock_irqrestore(&rtlpriv->locks.rf_lock, flags);
|
||||
spin_unlock(&rtlpriv->locks.rf_lock);
|
||||
|
||||
RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE,
|
||||
"regaddr(%#x), bitmask(%#x), data(%#x), rfpath(%#x)\n",
|
||||
|
|
|
@ -37,13 +37,12 @@ u32 rtl8723e_phy_query_rf_reg(struct ieee80211_hw *hw,
|
|||
struct rtl_priv *rtlpriv = rtl_priv(hw);
|
||||
u32 original_value = 0, readback_value, bitshift;
|
||||
struct rtl_phy *rtlphy = &rtlpriv->phy;
|
||||
unsigned long flags;
|
||||
|
||||
RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE,
|
||||
"regaddr(%#x), rfpath(%#x), bitmask(%#x)\n",
|
||||
regaddr, rfpath, bitmask);
|
||||
|
||||
spin_lock_irqsave(&rtlpriv->locks.rf_lock, flags);
|
||||
spin_lock(&rtlpriv->locks.rf_lock);
|
||||
|
||||
if (rtlphy->rf_mode != RF_OP_BY_FW) {
|
||||
original_value = rtl8723_phy_rf_serial_read(hw,
|
||||
|
@ -53,7 +52,7 @@ u32 rtl8723e_phy_query_rf_reg(struct ieee80211_hw *hw,
|
|||
bitshift = rtl8723_phy_calculate_bit_shift(bitmask);
|
||||
readback_value = (original_value & bitmask) >> bitshift;
|
||||
|
||||
spin_unlock_irqrestore(&rtlpriv->locks.rf_lock, flags);
|
||||
spin_unlock(&rtlpriv->locks.rf_lock);
|
||||
|
||||
RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE,
|
||||
"regaddr(%#x), rfpath(%#x), bitmask(%#x), original_value(%#x)\n",
|
||||
|
@ -69,13 +68,12 @@ void rtl8723e_phy_set_rf_reg(struct ieee80211_hw *hw,
|
|||
struct rtl_priv *rtlpriv = rtl_priv(hw);
|
||||
struct rtl_phy *rtlphy = &rtlpriv->phy;
|
||||
u32 original_value = 0, bitshift;
|
||||
unsigned long flags;
|
||||
|
||||
RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE,
|
||||
"regaddr(%#x), bitmask(%#x), data(%#x), rfpath(%#x)\n",
|
||||
regaddr, bitmask, data, rfpath);
|
||||
|
||||
spin_lock_irqsave(&rtlpriv->locks.rf_lock, flags);
|
||||
spin_lock(&rtlpriv->locks.rf_lock);
|
||||
|
||||
if (rtlphy->rf_mode != RF_OP_BY_FW) {
|
||||
if (bitmask != RFREG_OFFSET_MASK) {
|
||||
|
@ -99,7 +97,7 @@ void rtl8723e_phy_set_rf_reg(struct ieee80211_hw *hw,
|
|||
_rtl8723e_phy_fw_rf_serial_write(hw, rfpath, regaddr, data);
|
||||
}
|
||||
|
||||
spin_unlock_irqrestore(&rtlpriv->locks.rf_lock, flags);
|
||||
spin_unlock(&rtlpriv->locks.rf_lock);
|
||||
|
||||
RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE,
|
||||
"regaddr(%#x), bitmask(%#x), data(%#x), rfpath(%#x)\n",
|
||||
|
|
|
@ -33,19 +33,18 @@ u32 rtl8723be_phy_query_rf_reg(struct ieee80211_hw *hw, enum radio_path rfpath,
|
|||
{
|
||||
struct rtl_priv *rtlpriv = rtl_priv(hw);
|
||||
u32 original_value, readback_value, bitshift;
|
||||
unsigned long flags;
|
||||
|
||||
RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE,
|
||||
"regaddr(%#x), rfpath(%#x), bitmask(%#x)\n",
|
||||
regaddr, rfpath, bitmask);
|
||||
|
||||
spin_lock_irqsave(&rtlpriv->locks.rf_lock, flags);
|
||||
spin_lock(&rtlpriv->locks.rf_lock);
|
||||
|
||||
original_value = rtl8723_phy_rf_serial_read(hw, rfpath, regaddr);
|
||||
bitshift = rtl8723_phy_calculate_bit_shift(bitmask);
|
||||
readback_value = (original_value & bitmask) >> bitshift;
|
||||
|
||||
spin_unlock_irqrestore(&rtlpriv->locks.rf_lock, flags);
|
||||
spin_unlock(&rtlpriv->locks.rf_lock);
|
||||
|
||||
RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE,
|
||||
"regaddr(%#x), rfpath(%#x), bitmask(%#x), original_value(%#x)\n",
|
||||
|
@ -59,13 +58,12 @@ void rtl8723be_phy_set_rf_reg(struct ieee80211_hw *hw, enum radio_path path,
|
|||
{
|
||||
struct rtl_priv *rtlpriv = rtl_priv(hw);
|
||||
u32 original_value, bitshift;
|
||||
unsigned long flags;
|
||||
|
||||
RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE,
|
||||
"regaddr(%#x), bitmask(%#x), data(%#x), rfpath(%#x)\n",
|
||||
regaddr, bitmask, data, path);
|
||||
|
||||
spin_lock_irqsave(&rtlpriv->locks.rf_lock, flags);
|
||||
spin_lock(&rtlpriv->locks.rf_lock);
|
||||
|
||||
if (bitmask != RFREG_OFFSET_MASK) {
|
||||
original_value = rtl8723_phy_rf_serial_read(hw, path,
|
||||
|
@ -77,7 +75,7 @@ void rtl8723be_phy_set_rf_reg(struct ieee80211_hw *hw, enum radio_path path,
|
|||
|
||||
rtl8723_phy_rf_serial_write(hw, path, regaddr, data);
|
||||
|
||||
spin_unlock_irqrestore(&rtlpriv->locks.rf_lock, flags);
|
||||
spin_unlock(&rtlpriv->locks.rf_lock);
|
||||
|
||||
RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE,
|
||||
"regaddr(%#x), bitmask(%#x), data(%#x), rfpath(%#x)\n",
|
||||
|
|
|
@ -139,19 +139,18 @@ u32 rtl8821ae_phy_query_rf_reg(struct ieee80211_hw *hw,
|
|||
{
|
||||
struct rtl_priv *rtlpriv = rtl_priv(hw);
|
||||
u32 original_value, readback_value, bitshift;
|
||||
unsigned long flags;
|
||||
|
||||
RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE,
|
||||
"regaddr(%#x), rfpath(%#x), bitmask(%#x)\n",
|
||||
regaddr, rfpath, bitmask);
|
||||
|
||||
spin_lock_irqsave(&rtlpriv->locks.rf_lock, flags);
|
||||
spin_lock(&rtlpriv->locks.rf_lock);
|
||||
|
||||
original_value = _rtl8821ae_phy_rf_serial_read(hw, rfpath, regaddr);
|
||||
bitshift = _rtl8821ae_phy_calculate_bit_shift(bitmask);
|
||||
readback_value = (original_value & bitmask) >> bitshift;
|
||||
|
||||
spin_unlock_irqrestore(&rtlpriv->locks.rf_lock, flags);
|
||||
spin_unlock(&rtlpriv->locks.rf_lock);
|
||||
|
||||
RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE,
|
||||
"regaddr(%#x), rfpath(%#x), bitmask(%#x), original_value(%#x)\n",
|
||||
|
@ -166,13 +165,12 @@ void rtl8821ae_phy_set_rf_reg(struct ieee80211_hw *hw,
|
|||
{
|
||||
struct rtl_priv *rtlpriv = rtl_priv(hw);
|
||||
u32 original_value, bitshift;
|
||||
unsigned long flags;
|
||||
|
||||
RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE,
|
||||
"regaddr(%#x), bitmask(%#x), data(%#x), rfpath(%#x)\n",
|
||||
regaddr, bitmask, data, rfpath);
|
||||
|
||||
spin_lock_irqsave(&rtlpriv->locks.rf_lock, flags);
|
||||
spin_lock(&rtlpriv->locks.rf_lock);
|
||||
|
||||
if (bitmask != RFREG_OFFSET_MASK) {
|
||||
original_value =
|
||||
|
@ -183,7 +181,7 @@ void rtl8821ae_phy_set_rf_reg(struct ieee80211_hw *hw,
|
|||
|
||||
_rtl8821ae_phy_rf_serial_write(hw, rfpath, regaddr, data);
|
||||
|
||||
spin_unlock_irqrestore(&rtlpriv->locks.rf_lock, flags);
|
||||
spin_unlock(&rtlpriv->locks.rf_lock);
|
||||
|
||||
RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE,
|
||||
"regaddr(%#x), bitmask(%#x), data(%#x), rfpath(%#x)\n",
|
||||
|
|
Loading…
Reference in New Issue