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>
This commit is contained in:
committed by
John W. Linville
parent
2fb3f028a9
commit
fbe9c429f1
@@ -265,7 +265,7 @@ void ieee80211_scan_completed(struct ieee80211_hw *hw, bool aborted)
|
||||
|
||||
mutex_lock(&local->scan_mtx);
|
||||
|
||||
if (WARN_ON(!local->hw_scanning && !local->sw_scanning)) {
|
||||
if (WARN_ON(!local->scanning)) {
|
||||
mutex_unlock(&local->scan_mtx);
|
||||
return;
|
||||
}
|
||||
@@ -275,16 +275,15 @@ void ieee80211_scan_completed(struct ieee80211_hw *hw, bool aborted)
|
||||
return;
|
||||
}
|
||||
|
||||
if (local->hw_scanning)
|
||||
if (test_bit(SCAN_HW_SCANNING, &local->scanning))
|
||||
ieee80211_restore_scan_ies(local);
|
||||
|
||||
if (local->scan_req != &local->int_scan_req)
|
||||
cfg80211_scan_done(local->scan_req, aborted);
|
||||
local->scan_req = NULL;
|
||||
|
||||
was_hw_scan = local->hw_scanning;
|
||||
local->hw_scanning = false;
|
||||
local->sw_scanning = false;
|
||||
was_hw_scan = test_bit(SCAN_HW_SCANNING, &local->scanning);
|
||||
local->scanning = 0;
|
||||
local->scan_channel = NULL;
|
||||
|
||||
/* 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,
|
||||
}
|
||||
|
||||
if (local->ops->hw_scan)
|
||||
local->hw_scanning = true;
|
||||
__set_bit(SCAN_HW_SCANNING, &local->scanning);
|
||||
else
|
||||
local->sw_scanning = true;
|
||||
__set_bit(SCAN_SW_SCANNING, &local->scanning);
|
||||
/*
|
||||
* Kicking off the scan need not be protected,
|
||||
* only the scan variable stuff, since now
|
||||
@@ -459,11 +458,9 @@ static int __ieee80211_start_scan(struct ieee80211_sub_if_data *sdata,
|
||||
mutex_lock(&local->scan_mtx);
|
||||
|
||||
if (rc) {
|
||||
if (local->ops->hw_scan) {
|
||||
local->hw_scanning = false;
|
||||
if (local->ops->hw_scan)
|
||||
ieee80211_restore_scan_ies(local);
|
||||
} else
|
||||
local->sw_scanning = false;
|
||||
local->scanning = 0;
|
||||
|
||||
ieee80211_recalc_idle(local);
|
||||
|
||||
@@ -572,7 +569,7 @@ void ieee80211_scan_work(struct work_struct *work)
|
||||
return;
|
||||
}
|
||||
|
||||
if (local->scan_req && !(local->sw_scanning || local->hw_scanning)) {
|
||||
if (local->scan_req && !local->scanning) {
|
||||
struct cfg80211_scan_request *req = local->scan_req;
|
||||
int rc;
|
||||
|
||||
@@ -663,7 +660,7 @@ void ieee80211_scan_cancel(struct ieee80211_local *local)
|
||||
* queued -- mostly at suspend under RTNL.
|
||||
*/
|
||||
mutex_lock(&local->scan_mtx);
|
||||
swscan = local->sw_scanning;
|
||||
swscan = test_bit(SCAN_SW_SCANNING, &local->scanning);
|
||||
mutex_unlock(&local->scan_mtx);
|
||||
|
||||
if (swscan)
|
||||
|
||||
Reference in New Issue
Block a user