aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/scan.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/mac80211/scan.c')
-rw-r--r--net/mac80211/scan.c23
1 files changed, 10 insertions, 13 deletions
diff --git a/net/mac80211/scan.c b/net/mac80211/scan.c
index 48f910ae95c0..4233c3d700ce 100644
--- a/net/mac80211/scan.c
+++ b/net/mac80211/scan.c
@@ -265,7 +265,7 @@ void ieee80211_scan_completed(struct ieee80211_hw *hw, bool aborted)
265 265
266 mutex_lock(&local->scan_mtx); 266 mutex_lock(&local->scan_mtx);
267 267
268 if (WARN_ON(!local->hw_scanning && !local->sw_scanning)) { 268 if (WARN_ON(!local->scanning)) {
269 mutex_unlock(&local->scan_mtx); 269 mutex_unlock(&local->scan_mtx);
270 return; 270 return;
271 } 271 }
@@ -275,16 +275,15 @@ void ieee80211_scan_completed(struct ieee80211_hw *hw, bool aborted)
275 return; 275 return;
276 } 276 }
277 277
278 if (local->hw_scanning) 278 if (test_bit(SCAN_HW_SCANNING, &local->scanning))
279 ieee80211_restore_scan_ies(local); 279 ieee80211_restore_scan_ies(local);
280 280
281 if (local->scan_req != &local->int_scan_req) 281 if (local->scan_req != &local->int_scan_req)
282 cfg80211_scan_done(local->scan_req, aborted); 282 cfg80211_scan_done(local->scan_req, aborted);
283 local->scan_req = NULL; 283 local->scan_req = NULL;
284 284
285 was_hw_scan = local->hw_scanning; 285 was_hw_scan = test_bit(SCAN_HW_SCANNING, &local->scanning);
286 local->hw_scanning = false; 286 local->scanning = 0;
287 local->sw_scanning = false;
288 local->scan_channel = NULL; 287 local->scan_channel = NULL;
289 288
290 /* we only have to protect scan_req and hw/sw scan */ 289 /* we only have to protect scan_req and hw/sw scan */
@@ -434,9 +433,9 @@ static int __ieee80211_start_scan(struct ieee80211_sub_if_data *sdata,
434 } 433 }
435 434
436 if (local->ops->hw_scan) 435 if (local->ops->hw_scan)
437 local->hw_scanning = true; 436 __set_bit(SCAN_HW_SCANNING, &local->scanning);
438 else 437 else
439 local->sw_scanning = true; 438 __set_bit(SCAN_SW_SCANNING, &local->scanning);
440 /* 439 /*
441 * Kicking off the scan need not be protected, 440 * Kicking off the scan need not be protected,
442 * only the scan variable stuff, since now 441 * only the scan variable stuff, since now
@@ -459,11 +458,9 @@ static int __ieee80211_start_scan(struct ieee80211_sub_if_data *sdata,
459 mutex_lock(&local->scan_mtx); 458 mutex_lock(&local->scan_mtx);
460 459
461 if (rc) { 460 if (rc) {
462 if (local->ops->hw_scan) { 461 if (local->ops->hw_scan)
463 local->hw_scanning = false;
464 ieee80211_restore_scan_ies(local); 462 ieee80211_restore_scan_ies(local);
465 } else 463 local->scanning = 0;
466 local->sw_scanning = false;
467 464
468 ieee80211_recalc_idle(local); 465 ieee80211_recalc_idle(local);
469 466
@@ -572,7 +569,7 @@ void ieee80211_scan_work(struct work_struct *work)
572 return; 569 return;
573 } 570 }
574 571
575 if (local->scan_req && !(local->sw_scanning || local->hw_scanning)) { 572 if (local->scan_req && !local->scanning) {
576 struct cfg80211_scan_request *req = local->scan_req; 573 struct cfg80211_scan_request *req = local->scan_req;
577 int rc; 574 int rc;
578 575
@@ -663,7 +660,7 @@ void ieee80211_scan_cancel(struct ieee80211_local *local)
663 * queued -- mostly at suspend under RTNL. 660 * queued -- mostly at suspend under RTNL.
664 */ 661 */
665 mutex_lock(&local->scan_mtx); 662 mutex_lock(&local->scan_mtx);
666 swscan = local->sw_scanning; 663 swscan = test_bit(SCAN_SW_SCANNING, &local->scanning);
667 mutex_unlock(&local->scan_mtx); 664 mutex_unlock(&local->scan_mtx);
668 665
669 if (swscan) 666 if (swscan)