Skip to content

Commit ebfc919

Browse files
author
Ping-Ke Shih
committed
wifi: rtw89: add wiphy_lock() to work that isn't held wiphy_lock() yet
To ensure where are protected by driver mutex can also be protected by wiphy_lock(), so afterward we can remove driver mutex safely. Signed-off-by: Ping-Ke Shih <[email protected]> Link: https://patch.msgid.link/[email protected]
1 parent c281bdb commit ebfc919

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

drivers/net/wireless/realtek/rtw89/regd.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -744,6 +744,7 @@ void rtw89_regd_notifier(struct wiphy *wiphy, struct regulatory_request *request
744744
struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy);
745745
struct rtw89_dev *rtwdev = hw->priv;
746746

747+
wiphy_lock(wiphy);
747748
mutex_lock(&rtwdev->mutex);
748749
rtw89_leave_ps_mode(rtwdev);
749750

@@ -761,6 +762,7 @@ void rtw89_regd_notifier(struct wiphy *wiphy, struct regulatory_request *request
761762

762763
exit:
763764
mutex_unlock(&rtwdev->mutex);
765+
wiphy_unlock(wiphy);
764766
}
765767

766768
/* Maximum Transmit Power field (@raw) can be EIRP or PSD.

drivers/net/wireless/realtek/rtw89/ser.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,9 +156,11 @@ static void ser_state_run(struct rtw89_ser *ser, u8 evt)
156156
rtw89_debug(rtwdev, RTW89_DBG_SER, "ser: %s receive %s\n",
157157
ser_st_name(ser), ser_ev_name(ser, evt));
158158

159+
wiphy_lock(rtwdev->hw->wiphy);
159160
mutex_lock(&rtwdev->mutex);
160161
rtw89_leave_lps(rtwdev);
161162
mutex_unlock(&rtwdev->mutex);
163+
wiphy_unlock(rtwdev->hw->wiphy);
162164

163165
ser->st_tbl[ser->state].st_func(ser, evt);
164166
}
@@ -708,9 +710,11 @@ static void ser_l2_reset_st_hdl(struct rtw89_ser *ser, u8 evt)
708710

709711
switch (evt) {
710712
case SER_EV_STATE_IN:
713+
wiphy_lock(rtwdev->hw->wiphy);
711714
mutex_lock(&rtwdev->mutex);
712715
ser_l2_reset_st_pre_hdl(ser);
713716
mutex_unlock(&rtwdev->mutex);
717+
wiphy_unlock(rtwdev->hw->wiphy);
714718

715719
ieee80211_restart_hw(rtwdev->hw);
716720
ser_set_alarm(ser, SER_RECFG_TIMEOUT, SER_EV_L2_RECFG_TIMEOUT);

0 commit comments

Comments
 (0)