mirror of
https://github.com/linux-msm/laptops-kernel.git
synced 2026-08-13 14:19:53 -07:00
wifi: mac80211: check wiphy mutex in ops
Check that we hold the wiphy mutex in the ops when calling the driver, since we're now on our way to always hold it, and simplify the locking. Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
This commit is contained in:
@@ -15,6 +15,7 @@ int drv_start(struct ieee80211_local *local)
|
||||
int ret;
|
||||
|
||||
might_sleep();
|
||||
lockdep_assert_wiphy(local->hw.wiphy);
|
||||
|
||||
if (WARN_ON(local->started))
|
||||
return -EALREADY;
|
||||
@@ -35,6 +36,7 @@ int drv_start(struct ieee80211_local *local)
|
||||
void drv_stop(struct ieee80211_local *local)
|
||||
{
|
||||
might_sleep();
|
||||
lockdep_assert_wiphy(local->hw.wiphy);
|
||||
|
||||
if (WARN_ON(!local->started))
|
||||
return;
|
||||
@@ -58,6 +60,7 @@ int drv_add_interface(struct ieee80211_local *local,
|
||||
int ret;
|
||||
|
||||
might_sleep();
|
||||
lockdep_assert_wiphy(local->hw.wiphy);
|
||||
|
||||
if (WARN_ON(sdata->vif.type == NL80211_IFTYPE_AP_VLAN ||
|
||||
(sdata->vif.type == NL80211_IFTYPE_MONITOR &&
|
||||
@@ -82,6 +85,7 @@ int drv_change_interface(struct ieee80211_local *local,
|
||||
int ret;
|
||||
|
||||
might_sleep();
|
||||
lockdep_assert_wiphy(local->hw.wiphy);
|
||||
|
||||
if (!check_sdata_in_driver(sdata))
|
||||
return -EIO;
|
||||
@@ -96,6 +100,7 @@ void drv_remove_interface(struct ieee80211_local *local,
|
||||
struct ieee80211_sub_if_data *sdata)
|
||||
{
|
||||
might_sleep();
|
||||
lockdep_assert_wiphy(local->hw.wiphy);
|
||||
|
||||
if (!check_sdata_in_driver(sdata))
|
||||
return;
|
||||
@@ -116,6 +121,7 @@ int drv_sta_state(struct ieee80211_local *local,
|
||||
int ret = 0;
|
||||
|
||||
might_sleep();
|
||||
lockdep_assert_wiphy(local->hw.wiphy);
|
||||
|
||||
sdata = get_bss_sdata(sdata);
|
||||
if (!check_sdata_in_driver(sdata))
|
||||
@@ -149,6 +155,7 @@ int drv_sta_set_txpwr(struct ieee80211_local *local,
|
||||
int ret = -EOPNOTSUPP;
|
||||
|
||||
might_sleep();
|
||||
lockdep_assert_wiphy(local->hw.wiphy);
|
||||
|
||||
sdata = get_bss_sdata(sdata);
|
||||
if (!check_sdata_in_driver(sdata))
|
||||
@@ -190,6 +197,7 @@ int drv_conf_tx(struct ieee80211_local *local,
|
||||
int ret = -EOPNOTSUPP;
|
||||
|
||||
might_sleep();
|
||||
lockdep_assert_wiphy(local->hw.wiphy);
|
||||
|
||||
if (!check_sdata_in_driver(sdata))
|
||||
return -EIO;
|
||||
@@ -223,6 +231,7 @@ u64 drv_get_tsf(struct ieee80211_local *local,
|
||||
u64 ret = -1ULL;
|
||||
|
||||
might_sleep();
|
||||
lockdep_assert_wiphy(local->hw.wiphy);
|
||||
|
||||
if (!check_sdata_in_driver(sdata))
|
||||
return ret;
|
||||
@@ -239,6 +248,7 @@ void drv_set_tsf(struct ieee80211_local *local,
|
||||
u64 tsf)
|
||||
{
|
||||
might_sleep();
|
||||
lockdep_assert_wiphy(local->hw.wiphy);
|
||||
|
||||
if (!check_sdata_in_driver(sdata))
|
||||
return;
|
||||
@@ -254,6 +264,7 @@ void drv_offset_tsf(struct ieee80211_local *local,
|
||||
s64 offset)
|
||||
{
|
||||
might_sleep();
|
||||
lockdep_assert_wiphy(local->hw.wiphy);
|
||||
|
||||
if (!check_sdata_in_driver(sdata))
|
||||
return;
|
||||
@@ -268,6 +279,7 @@ void drv_reset_tsf(struct ieee80211_local *local,
|
||||
struct ieee80211_sub_if_data *sdata)
|
||||
{
|
||||
might_sleep();
|
||||
lockdep_assert_wiphy(local->hw.wiphy);
|
||||
|
||||
if (!check_sdata_in_driver(sdata))
|
||||
return;
|
||||
@@ -286,6 +298,7 @@ int drv_assign_vif_chanctx(struct ieee80211_local *local,
|
||||
int ret = 0;
|
||||
|
||||
might_sleep();
|
||||
lockdep_assert_wiphy(local->hw.wiphy);
|
||||
|
||||
drv_verify_link_exists(sdata, link_conf);
|
||||
if (!check_sdata_in_driver(sdata))
|
||||
@@ -314,6 +327,7 @@ void drv_unassign_vif_chanctx(struct ieee80211_local *local,
|
||||
struct ieee80211_chanctx *ctx)
|
||||
{
|
||||
might_sleep();
|
||||
lockdep_assert_wiphy(local->hw.wiphy);
|
||||
|
||||
drv_verify_link_exists(sdata, link_conf);
|
||||
if (!check_sdata_in_driver(sdata))
|
||||
@@ -342,6 +356,7 @@ int drv_switch_vif_chanctx(struct ieee80211_local *local,
|
||||
int i;
|
||||
|
||||
might_sleep();
|
||||
lockdep_assert_wiphy(local->hw.wiphy);
|
||||
|
||||
if (!local->ops->switch_vif_chanctx)
|
||||
return -EOPNOTSUPP;
|
||||
@@ -394,6 +409,7 @@ int drv_ampdu_action(struct ieee80211_local *local,
|
||||
int ret = -EOPNOTSUPP;
|
||||
|
||||
might_sleep();
|
||||
lockdep_assert_wiphy(local->hw.wiphy);
|
||||
|
||||
if (!sdata)
|
||||
return -EIO;
|
||||
@@ -418,6 +434,7 @@ void drv_link_info_changed(struct ieee80211_local *local,
|
||||
int link_id, u64 changed)
|
||||
{
|
||||
might_sleep();
|
||||
lockdep_assert_wiphy(local->hw.wiphy);
|
||||
|
||||
if (WARN_ON_ONCE(changed & (BSS_CHANGED_BEACON |
|
||||
BSS_CHANGED_BEACON_ENABLED) &&
|
||||
@@ -460,6 +477,7 @@ int drv_set_key(struct ieee80211_local *local,
|
||||
int ret;
|
||||
|
||||
might_sleep();
|
||||
lockdep_assert_wiphy(local->hw.wiphy);
|
||||
|
||||
sdata = get_bss_sdata(sdata);
|
||||
if (!check_sdata_in_driver(sdata))
|
||||
@@ -487,6 +505,7 @@ int drv_change_vif_links(struct ieee80211_local *local,
|
||||
int ret = -EOPNOTSUPP;
|
||||
|
||||
might_sleep();
|
||||
lockdep_assert_wiphy(local->hw.wiphy);
|
||||
|
||||
if (!check_sdata_in_driver(sdata))
|
||||
return -EIO;
|
||||
@@ -534,6 +553,7 @@ int drv_change_sta_links(struct ieee80211_local *local,
|
||||
int ret = -EOPNOTSUPP;
|
||||
|
||||
might_sleep();
|
||||
lockdep_assert_wiphy(local->hw.wiphy);
|
||||
|
||||
if (!check_sdata_in_driver(sdata))
|
||||
return -EIO;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user