The driver mutex is to synchronize ieee80211_ops and works, but it isn't easy to mange and causes AB-BA locks problem, which we have adjusted to avoid but the code isn't smooth. Nowaday, wiphy lock can make thing simple and easy, and also switch to wiphy lock is easy by reference of ath12k [1]. The debugfs neeeds special treatments to use wiphy_lock [2], and debugfs_short_fops [3] can save some spaces. The plans in this patchset is to switch from (A) to (B) and to (C) as below. Current code has two patterns (A) and (B), so fist step is to change (A) to (B), and then just remove mutex_lock() of driver to get (C). (A) (B) (C) wiphy_lock() wiphy_lock() ... ... mutex_lock() mutex_lock() ... ... ... mutex_unlock() mutex_unlock() ... ... wiphy_unlock() wiphy_unlock() The patches 1/10 and 2/10 are to change (A) to (B) for the codes except to debugfs. The patches 3/10 to 6/10 are related to debugfs. Originally, rtw89 uses seq_file to output data, so we convert to use generic file_ops::read/write with scnprintf() to be compatible with wiphy_locked_debugfs_{read,write}(). This is also good to specify output buffer size to avoid duplicate IO during debugging. After patches 1/10 to 6/10, all have become (B), so remove driver mutex by patches 7/10 to 9/10. Among them, patch 8/10 is a manually comsmetic patch to be expected. The last one patch is a special deal to early_h2c, which is a list of H2C commands for debug purpose. This patchset has structural dependency with existing two patchset: - wifi: rtw89: enhance dynamic mechanism per PHY - wifi: rtw89: cleanup unused rtwdev::roc_work [1] ath12k switch to wiphy_lock: https://lore.kernel.org/linux-wireless/20240821153728.2121600-1-kvalo@xxxxxxxxxx/ [2] wiphy_lock for debugfs: https://lore.kernel.org/linux-wireless/33ea3a62b4257b6ef789c30fa8f7bf7e9f1865b5.camel@xxxxxxxxxxxxxxxx/ [3] debugfs_short_fops: https://lore.kernel.org/linux-wireless/20241009181339.0b1a6eaef573.Ia80b55e934bbfc45ce0df42a3233d34b35508046@changeid/ Ping-Ke Shih (10): wifi: rtw89: add wiphy_lock() to work that isn't held wiphy_lock() yet wifi: rtw89: use wiphy_work() to replace ieee802111_work() wifi: rtw89: debugfs: implement file_ops::read/write to replace seq_file wifi: rtw89: debugfs: specify buffer size allocated by devm_kazlloc() for reading wifi: rtw89: debugfs: use wiphy_locked_debugfs_{read,write}() if needed wifi: rtw89: debugfs: use debugfs_short_fops wifi: rtw89: remove consumers of driver mutex wifi: rtw89: manual cosmetic along lockdep_assert_wiphy() wifi: rtw89: remove definition of driver mutex wifi: rtw89: pci: not assert wiphy_lock to free early_h2c for PCI probe/remove drivers/net/wireless/realtek/rtw89/chan.c | 28 +- drivers/net/wireless/realtek/rtw89/chan.h | 2 +- drivers/net/wireless/realtek/rtw89/coex.c | 2805 +++++++++-------- drivers/net/wireless/realtek/rtw89/coex.h | 16 +- drivers/net/wireless/realtek/rtw89/core.c | 145 +- drivers/net/wireless/realtek/rtw89/core.h | 38 +- drivers/net/wireless/realtek/rtw89/debug.c | 2062 ++++++------ drivers/net/wireless/realtek/rtw89/fw.c | 23 +- drivers/net/wireless/realtek/rtw89/fw.h | 3 +- drivers/net/wireless/realtek/rtw89/mac80211.c | 281 +- drivers/net/wireless/realtek/rtw89/phy.c | 45 +- drivers/net/wireless/realtek/rtw89/phy.h | 8 +- drivers/net/wireless/realtek/rtw89/ps.c | 6 +- drivers/net/wireless/realtek/rtw89/regd.c | 6 +- drivers/net/wireless/realtek/rtw89/sar.c | 60 +- drivers/net/wireless/realtek/rtw89/sar.h | 5 +- drivers/net/wireless/realtek/rtw89/ser.c | 17 +- drivers/net/wireless/realtek/rtw89/util.c | 11 + drivers/net/wireless/realtek/rtw89/util.h | 5 +- drivers/net/wireless/realtek/rtw89/wow.c | 7 +- 20 files changed, 2988 insertions(+), 2585 deletions(-) -- 2.25.1