diff options
author | Helmut Schaa <helmut.schaa@googlemail.com> | 2009-07-23 06:14:04 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-07-27 15:24:16 -0400 |
commit | fbe9c429f195111bbf7f1630efa19aee295fd8e7 (patch) | |
tree | 80556ac48bfa0e7d60db63e6c71b0bbf58143263 /net/mac80211/scan.c | |
parent | 2fb3f028a9a46bd344329766257699b4acb36525 (diff) |
mac80211: Replace {sw, hw}_scanning variables with a bitfield
Use a bitfield to store the current scan mode instead of two boolean
variables {sw,hw}_scanning. This patch does not introduce functional
changes but allows us to enhance the scan flags later (for example
for background scanning).
Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211/scan.c')
-rw-r--r-- | net/mac80211/scan.c | 23 |
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) |