Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 266386
b: refs/heads/master
c: 84b1bec
h: refs/heads/master
v: v3
  • Loading branch information
Johannes Berg authored and John W. Linville committed Sep 27, 2011
1 parent a0e1124 commit 9b75966
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 5 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: a2fa2462f05115722beb2443d081a72f4f4450ea
refs/heads/master: 84b1bec6d716fc8c289e2530cab109a6e097455b
36 changes: 32 additions & 4 deletions trunk/drivers/net/wireless/iwlwifi/iwl-scan.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,11 @@ static void iwl_process_scan_complete(struct iwl_priv *priv)
{
bool aborted;

lockdep_assert_held(&priv->shrd->mutex);

if (!test_and_clear_bit(STATUS_SCAN_COMPLETE, &priv->shrd->status))
return;

IWL_DEBUG_SCAN(priv, "Completed scan.\n");

cancel_delayed_work(&priv->scan_check);
Expand Down Expand Up @@ -181,6 +186,7 @@ void iwl_force_scan_end(struct iwl_priv *priv)
clear_bit(STATUS_SCANNING, &priv->shrd->status);
clear_bit(STATUS_SCAN_HW, &priv->shrd->status);
clear_bit(STATUS_SCAN_ABORTING, &priv->shrd->status);
clear_bit(STATUS_SCAN_COMPLETE, &priv->shrd->status);
iwl_complete_scan(priv, true);
}

Expand Down Expand Up @@ -235,9 +241,24 @@ void iwl_scan_cancel_timeout(struct iwl_priv *priv, unsigned long ms)

while (time_before_eq(jiffies, timeout)) {
if (!test_bit(STATUS_SCAN_HW, &priv->shrd->status))
break;
goto finished;
msleep(20);
}

return;

finished:
/*
* Now STATUS_SCAN_HW is clear. This means that the
* device finished, but the background work is going
* to execute at best as soon as we release the mutex.
* Since we need to be able to issue a new scan right
* after this function returns, run the complete here.
* The STATUS_SCAN_COMPLETE bit will then be cleared
* and prevent the background work from "completing"
* a possible new scan.
*/
iwl_process_scan_complete(priv);
}

/* Service response to REPLY_SCAN_CMD (0x80) */
Expand Down Expand Up @@ -321,13 +342,20 @@ static int iwl_rx_scan_complete_notif(struct iwl_priv *priv,
scan_notif->tsf_low,
scan_notif->tsf_high, scan_notif->status);

/* The HW is no longer scanning */
clear_bit(STATUS_SCAN_HW, &priv->shrd->status);

IWL_DEBUG_SCAN(priv, "Scan on %sGHz took %dms\n",
(priv->scan_band == IEEE80211_BAND_2GHZ) ? "2.4" : "5.2",
jiffies_to_msecs(jiffies - priv->scan_start));

/*
* When aborting, we run the scan completed background work inline
* and the background work must then do nothing. The SCAN_COMPLETE
* bit helps implement that logic and thus needs to be set before
* queueing the work. Also, since the scan abort waits for SCAN_HW
* to clear, we need to set SCAN_COMPLETE before clearing SCAN_HW
* to avoid a race there.
*/
set_bit(STATUS_SCAN_COMPLETE, &priv->shrd->status);
clear_bit(STATUS_SCAN_HW, &priv->shrd->status);
queue_work(priv->shrd->workqueue, &priv->scan_completed);

if (priv->iw_mode != NL80211_IFTYPE_ADHOC &&
Expand Down
1 change: 1 addition & 0 deletions trunk/drivers/net/wireless/iwlwifi/iwl-shared.h
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,7 @@ static inline void iwl_print_rx_config_cmd(struct iwl_priv *priv,
#define STATUS_FW_ERROR 17
#define STATUS_DEVICE_ENABLED 18
#define STATUS_CHANNEL_SWITCH_PENDING 19
#define STATUS_SCAN_COMPLETE 20

static inline int iwl_is_ready(struct iwl_shared *shrd)
{
Expand Down

0 comments on commit 9b75966

Please sign in to comment.