Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 215085
b: refs/heads/master
c: 259b62e
h: refs/heads/master
i:
  215083: 644175a
v: v3
  • Loading branch information
Stanislaw Gruszka authored and John W. Linville committed Oct 6, 2010
1 parent 4c03e87 commit 5ce6e0c
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 23 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 78159788e1d0909ffa6beb714dcca7f3aa4574a2
refs/heads/master: 259b62e35bf44a97983f275de569929a7d2bd5dd
51 changes: 29 additions & 22 deletions trunk/net/mac80211/scan.c
Original file line number Diff line number Diff line change
Expand Up @@ -651,27 +651,25 @@ void ieee80211_scan_work(struct work_struct *work)
container_of(work, struct ieee80211_local, scan_work.work);
struct ieee80211_sub_if_data *sdata = local->scan_sdata;
unsigned long next_delay = 0;
bool aborted;

if (test_and_clear_bit(SCAN_COMPLETED, &local->scanning)) {
bool aborted;
mutex_lock(&local->mtx);

if (test_and_clear_bit(SCAN_COMPLETED, &local->scanning)) {
aborted = test_and_clear_bit(SCAN_ABORTED, &local->scanning);
__ieee80211_scan_completed(&local->hw, aborted);
return;
goto out_complete;
}

mutex_lock(&local->mtx);
if (!sdata || !local->scan_req) {
mutex_unlock(&local->mtx);
return;
}
if (!sdata || !local->scan_req)
goto out;

if (local->hw_scan_req) {
int rc = drv_hw_scan(local, sdata, local->hw_scan_req);
mutex_unlock(&local->mtx);
if (rc)
__ieee80211_scan_completed(&local->hw, true);
return;
if (rc) {
aborted = true;
goto out_complete;
} else
goto out;
}

if (local->scan_req && !local->scanning) {
Expand All @@ -682,23 +680,23 @@ void ieee80211_scan_work(struct work_struct *work)
local->scan_sdata = NULL;

rc = __ieee80211_start_scan(sdata, req);
mutex_unlock(&local->mtx);

if (rc)
__ieee80211_scan_completed(&local->hw, true);
return;
if (rc) {
aborted = true;
goto out_complete;
} else
goto out;
}

mutex_unlock(&local->mtx);

/*
* Avoid re-scheduling when the sdata is going away.
*/
if (!ieee80211_sdata_running(sdata)) {
__ieee80211_scan_completed(&local->hw, true);
return;
aborted = true;
goto out_complete;
}

mutex_unlock(&local->mtx);

/*
* as long as no delay is required advance immediately
* without scheduling a new work
Expand All @@ -725,6 +723,15 @@ void ieee80211_scan_work(struct work_struct *work)
} while (next_delay == 0);

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,
Expand Down

0 comments on commit 5ce6e0c

Please sign in to comment.