Commit b0e2880b authored by Luis R. Rodriguez's avatar Luis R. Rodriguez Committed by John W. Linville

cfg80211: move mutex locking to reg_process_pending_hints()

This will be required in the next patch and it makes the
next patch easier to review.
Signed-off-by: default avatarLuis R. Rodriguez <lrodriguez@atheros.com>
Tested-by: default avatarMark Mentovai <mark@moxienet.com>
Tested-by: default avatarBruno Randolf <br1@einfach.org>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent f333a7a2
...@@ -1412,16 +1412,13 @@ static void reg_process_hint(struct regulatory_request *reg_request) ...@@ -1412,16 +1412,13 @@ static void reg_process_hint(struct regulatory_request *reg_request)
BUG_ON(!reg_request->alpha2); BUG_ON(!reg_request->alpha2);
mutex_lock(&cfg80211_mutex);
mutex_lock(&reg_mutex);
if (wiphy_idx_valid(reg_request->wiphy_idx)) if (wiphy_idx_valid(reg_request->wiphy_idx))
wiphy = wiphy_idx_to_wiphy(reg_request->wiphy_idx); wiphy = wiphy_idx_to_wiphy(reg_request->wiphy_idx);
if (reg_request->initiator == NL80211_REGDOM_SET_BY_DRIVER && if (reg_request->initiator == NL80211_REGDOM_SET_BY_DRIVER &&
!wiphy) { !wiphy) {
kfree(reg_request); kfree(reg_request);
goto out; return;
} }
r = __regulatory_hint(wiphy, reg_request); r = __regulatory_hint(wiphy, reg_request);
...@@ -1429,16 +1426,16 @@ static void reg_process_hint(struct regulatory_request *reg_request) ...@@ -1429,16 +1426,16 @@ static void reg_process_hint(struct regulatory_request *reg_request)
if (r == -EALREADY && wiphy && if (r == -EALREADY && wiphy &&
wiphy->flags & WIPHY_FLAG_STRICT_REGULATORY) wiphy->flags & WIPHY_FLAG_STRICT_REGULATORY)
wiphy_update_regulatory(wiphy, initiator); wiphy_update_regulatory(wiphy, initiator);
out:
mutex_unlock(&reg_mutex);
mutex_unlock(&cfg80211_mutex);
} }
/* Processes regulatory hints, this is all the NL80211_REGDOM_SET_BY_* */ /* Processes regulatory hints, this is all the NL80211_REGDOM_SET_BY_* */
static void reg_process_pending_hints(void) static void reg_process_pending_hints(void)
{ {
struct regulatory_request *reg_request; struct regulatory_request *reg_request;
mutex_lock(&cfg80211_mutex);
mutex_lock(&reg_mutex);
spin_lock(&reg_requests_lock); spin_lock(&reg_requests_lock);
while (!list_empty(&reg_requests_list)) { while (!list_empty(&reg_requests_list)) {
reg_request = list_first_entry(&reg_requests_list, reg_request = list_first_entry(&reg_requests_list,
...@@ -1451,6 +1448,9 @@ static void reg_process_pending_hints(void) ...@@ -1451,6 +1448,9 @@ static void reg_process_pending_hints(void)
spin_lock(&reg_requests_lock); spin_lock(&reg_requests_lock);
} }
spin_unlock(&reg_requests_lock); spin_unlock(&reg_requests_lock);
mutex_unlock(&reg_mutex);
mutex_unlock(&cfg80211_mutex);
} }
/* Processes beacon hints -- this has nothing to do with country IEs */ /* Processes beacon hints -- this has nothing to do with country IEs */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment