Commit 259b62e3 authored by Stanislaw Gruszka's avatar Stanislaw Gruszka Committed by John W. Linville

mac80211: reduce number of __ieee80211_scan_completed calls

Use goto instruction to call __ieee80211_scan_completed only ones in
ieee80211_scan_work. This is prepare for the next patch.
Signed-off-by: default avatarStanislaw Gruszka <sgruszka@redhat.com>
Acked-by: default avatarJohannes Berg <johannes@sipsolutions.net>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 78159788
...@@ -651,27 +651,25 @@ void ieee80211_scan_work(struct work_struct *work) ...@@ -651,27 +651,25 @@ void ieee80211_scan_work(struct work_struct *work)
container_of(work, struct ieee80211_local, scan_work.work); container_of(work, struct ieee80211_local, scan_work.work);
struct ieee80211_sub_if_data *sdata = local->scan_sdata; struct ieee80211_sub_if_data *sdata = local->scan_sdata;
unsigned long next_delay = 0; unsigned long next_delay = 0;
bool aborted;
if (test_and_clear_bit(SCAN_COMPLETED, &local->scanning)) { mutex_lock(&local->mtx);
bool aborted;
if (test_and_clear_bit(SCAN_COMPLETED, &local->scanning)) {
aborted = test_and_clear_bit(SCAN_ABORTED, &local->scanning); aborted = test_and_clear_bit(SCAN_ABORTED, &local->scanning);
__ieee80211_scan_completed(&local->hw, aborted); goto out_complete;
return;
} }
mutex_lock(&local->mtx); if (!sdata || !local->scan_req)
if (!sdata || !local->scan_req) { goto out;
mutex_unlock(&local->mtx);
return;
}
if (local->hw_scan_req) { if (local->hw_scan_req) {
int rc = drv_hw_scan(local, sdata, local->hw_scan_req); int rc = drv_hw_scan(local, sdata, local->hw_scan_req);
mutex_unlock(&local->mtx); if (rc) {
if (rc) aborted = true;
__ieee80211_scan_completed(&local->hw, true); goto out_complete;
return; } else
goto out;
} }
if (local->scan_req && !local->scanning) { if (local->scan_req && !local->scanning) {
...@@ -682,23 +680,23 @@ void ieee80211_scan_work(struct work_struct *work) ...@@ -682,23 +680,23 @@ void ieee80211_scan_work(struct work_struct *work)
local->scan_sdata = NULL; local->scan_sdata = NULL;
rc = __ieee80211_start_scan(sdata, req); rc = __ieee80211_start_scan(sdata, req);
mutex_unlock(&local->mtx); if (rc) {
aborted = true;
if (rc) goto out_complete;
__ieee80211_scan_completed(&local->hw, true); } else
return; goto out;
} }
mutex_unlock(&local->mtx);
/* /*
* Avoid re-scheduling when the sdata is going away. * Avoid re-scheduling when the sdata is going away.
*/ */
if (!ieee80211_sdata_running(sdata)) { if (!ieee80211_sdata_running(sdata)) {
__ieee80211_scan_completed(&local->hw, true); aborted = true;
return; goto out_complete;
} }
mutex_unlock(&local->mtx);
/* /*
* as long as no delay is required advance immediately * as long as no delay is required advance immediately
* without scheduling a new work * without scheduling a new work
...@@ -725,6 +723,15 @@ void ieee80211_scan_work(struct work_struct *work) ...@@ -725,6 +723,15 @@ void ieee80211_scan_work(struct work_struct *work)
} while (next_delay == 0); } while (next_delay == 0);
ieee80211_queue_delayed_work(&local->hw, &local->scan_work, next_delay); ieee80211_queue_delayed_work(&local->hw, &local->scan_work, next_delay);
return;
out_complete:
mutex_unlock(&local->mtx);
__ieee80211_scan_completed(&local->hw, aborted);
return;
out:
mutex_unlock(&local->mtx);
} }
int ieee80211_request_scan(struct ieee80211_sub_if_data *sdata, int ieee80211_request_scan(struct ieee80211_sub_if_data *sdata,
......
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