diff mbox series

[21/34] wifi: iwlwifi: mvm: use the new lockdep-checking macros

Message ID 20230329100039.112df5c8dec2.I1a1008f5566e509953d988f254d15c9e58630418@changeid
State New
Headers show
Series [01/34] wifi: iwlwifi: mvm: make some HW flags conditional | expand

Commit Message

Greenman, Gregory March 29, 2023, 7:05 a.m. UTC
From: Johannes Berg <johannes.berg@intel.com>

Use the new macros from mac80211 that do lockdep checking
on the RCU dereferences, instead of hard-coding 1 as the
argument to rcu_dereference_protected().

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
---
 drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c  | 14 +++++++-------
 .../net/wireless/intel/iwlwifi/mvm/mld-mac80211.c  |  4 +---
 drivers/net/wireless/intel/iwlwifi/mvm/mld-sta.c   | 10 +++++-----
 3 files changed, 13 insertions(+), 15 deletions(-)
diff mbox series

Patch

diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
index 98c940271648..7fb00220e6cc 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
@@ -3591,9 +3591,9 @@  static void iwl_mvm_rs_rate_init_all_links(struct iwl_mvm *mvm,
 
 	for_each_mvm_vif_valid_link(mvmvif, link_id) {
 		struct ieee80211_bss_conf *conf =
-			rcu_dereference_protected(vif->link_conf[link_id], 1);
+			link_conf_dereference_protected(vif, link_id);
 		struct ieee80211_link_sta *link_sta =
-			rcu_dereference_protected(sta->link[link_id], 1);
+			link_sta_dereference_protected(sta, link_id);
 
 		if (!conf || !link_sta || !mvmvif->link[link_id]->phy_ctxt)
 			continue;
@@ -3622,9 +3622,9 @@  static bool iwl_mvm_vif_conf_from_sta(struct iwl_mvm *mvm,
 	for_each_set_bit(i, (unsigned long *)&sta->valid_links,
 			 IEEE80211_MLD_MAX_NUM_LINKS) {
 		struct ieee80211_link_sta *link_sta =
-			rcu_dereference_protected(sta->link[i], 1);
+			link_sta_dereference_protected(sta, i);
 		struct ieee80211_bss_conf *link_conf =
-			rcu_dereference_protected(vif->link_conf[i], 1);
+			link_conf_dereference_protected(vif, i);
 
 		if (!link_conf || !link_sta)
 			continue;
@@ -3653,9 +3653,9 @@  static void iwl_mvm_vif_set_he_support(struct ieee80211_hw *hw,
 	for_each_set_bit(i, (unsigned long *)&sta->valid_links,
 			 IEEE80211_MLD_MAX_NUM_LINKS) {
 		struct ieee80211_link_sta *link_sta =
-			rcu_dereference_protected(sta->link[i], 1);
+			link_sta_dereference_protected(sta, i);
 		struct ieee80211_bss_conf *link_conf =
-			rcu_dereference_protected(vif->link_conf[i], 1);
+			link_conf_dereference_protected(vif, i);
 
 		if (!link_conf || !link_sta || !mvmvif->link[i])
 			continue;
@@ -3753,7 +3753,7 @@  iwl_mvm_sta_state_auth_to_assoc(struct ieee80211_hw *hw,
 		for_each_set_bit(i, (unsigned long *)&sta->valid_links,
 				 IEEE80211_MLD_MAX_NUM_LINKS) {
 			struct ieee80211_bss_conf *link_conf =
-				rcu_dereference_protected(vif->link_conf[i], 1);
+				link_conf_dereference_protected(vif, i);
 
 			if (WARN_ON(!link_conf))
 				return -EINVAL;
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mld-mac80211.c b/drivers/net/wireless/intel/iwlwifi/mvm/mld-mac80211.c
index 8ed76fc83702..ddc09012549b 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/mld-mac80211.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mld-mac80211.c
@@ -921,9 +921,7 @@  iwl_mvm_mld_change_vif_links(struct ieee80211_hw *hw,
 		if (added & BIT(i)) {
 			struct ieee80211_bss_conf *link_conf;
 
-			/* FIXME: allow use of sdata_dereference()? */
-			link_conf = rcu_dereference_protected(vif->link_conf[i],
-							      1);
+			link_conf = link_conf_dereference_protected(vif, i);
 			if (WARN_ON(!link_conf))
 				continue;
 
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mld-sta.c b/drivers/net/wireless/intel/iwlwifi/mvm/mld-sta.c
index a713b8a10781..34b85a9a27af 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/mld-sta.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mld-sta.c
@@ -499,7 +499,7 @@  static int iwl_mvm_mld_alloc_sta_link(struct iwl_mvm *mvm,
 				      unsigned int link_id)
 {
 	struct ieee80211_link_sta *link_sta =
-		rcu_dereference_protected(sta->link[link_id], 1);
+		link_sta_dereference_protected(sta, link_id);
 	struct iwl_mvm_sta *mvm_sta = iwl_mvm_sta_from_mac80211(sta);
 	struct iwl_mvm_link_sta *link;
 	u32 sta_id = iwl_mvm_find_free_sta_id(mvm,
@@ -654,7 +654,7 @@  int iwl_mvm_mld_add_sta(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
 
 	for_each_sta_active_link(vif, sta, link_sta, link_id) {
 		struct ieee80211_bss_conf *link_conf =
-			rcu_dereference_protected(vif->link_conf[link_id], 1);
+			link_conf_dereference_protected(vif, link_id);
 		struct iwl_mvm_link_sta *mvm_link_sta =
 			rcu_dereference_protected(mvm_sta->link[link_id],
 						  lockdep_is_held(&mvm->mutex));
@@ -704,7 +704,7 @@  int iwl_mvm_mld_update_sta(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
 
 	for_each_sta_active_link(vif, sta, link_sta, link_id) {
 		struct ieee80211_bss_conf *link_conf =
-			rcu_dereference_protected(vif->link_conf[link_id], 1);
+			link_conf_dereference_protected(vif, link_id);
 		struct iwl_mvm_link_sta *mvm_link_sta =
 			rcu_dereference_protected(mvm_sta->link[link_id],
 						  lockdep_is_held(&mvm->mutex));
@@ -983,9 +983,9 @@  int iwl_mvm_mld_update_sta_links(struct iwl_mvm *mvm,
 
 	for_each_set_bit(link_id, &links_to_add, IEEE80211_MLD_MAX_NUM_LINKS) {
 		struct ieee80211_bss_conf *link_conf =
-			rcu_dereference_protected(vif->link_conf[link_id], 1);
+			link_conf_dereference_protected(vif, link_id);
 		struct ieee80211_link_sta *link_sta =
-			rcu_dereference_protected(sta->link[link_id], 1);
+			link_sta_dereference_protected(sta, link_id);
 		mvm_vif_link = mvm_vif->link[link_id];
 
 		if (WARN_ON(!mvm_vif_link || !link_conf || !link_sta ||