diff options
author | Stanislaw Gruszka <sgruszka@redhat.com> | 2010-09-13 08:46:37 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2010-09-14 16:08:04 -0400 |
commit | e693a802f06f538b711333a32a83e2732dc4773d (patch) | |
tree | 631e79a96476e98c67b7006a160f991fb3a9bc70 /drivers/net/wireless/iwlwifi/iwl-scan.c | |
parent | cd44600fdd89832c0bc898189270a81be0db01cd (diff) |
iwlwifi: rework iwl_scan_cancel_timeout
Since on timeout version of iwl_scan_cancel procedure we can sleep,
do not have to schedule abort_scan work to begin and perform scanning,
can do this directly. Also now, as we do not queue abort_scan from
restart work anymore, we can queue abort_scan to priv->workqueue.
Don't drop mutex when waiting for scan complete. Use STATUS_HW_SCAN bit
to check if scanning is currently pending, because STATUS_SCANNING will
be cleared only with priv->mutex taken.
Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Acked-by: Wey-Yi W Guy <wey-yi.w.guy@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-scan.c')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-scan.c | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-scan.c b/drivers/net/wireless/iwlwifi/iwl-scan.c index dbb07e8dfcd7..6d02f41e8caa 100644 --- a/drivers/net/wireless/iwlwifi/iwl-scan.c +++ b/drivers/net/wireless/iwlwifi/iwl-scan.c | |||
@@ -126,7 +126,7 @@ static void iwl_do_scan_abort(struct iwl_priv *priv) | |||
126 | int iwl_scan_cancel(struct iwl_priv *priv) | 126 | int iwl_scan_cancel(struct iwl_priv *priv) |
127 | { | 127 | { |
128 | IWL_DEBUG_SCAN(priv, "Queuing abort scan\n"); | 128 | IWL_DEBUG_SCAN(priv, "Queuing abort scan\n"); |
129 | schedule_work(&priv->abort_scan); | 129 | queue_work(priv->workqueue, &priv->abort_scan); |
130 | return 0; | 130 | return 0; |
131 | } | 131 | } |
132 | EXPORT_SYMBOL(iwl_scan_cancel); | 132 | EXPORT_SYMBOL(iwl_scan_cancel); |
@@ -135,25 +135,24 @@ EXPORT_SYMBOL(iwl_scan_cancel); | |||
135 | * iwl_scan_cancel_timeout - Cancel any currently executing HW scan | 135 | * iwl_scan_cancel_timeout - Cancel any currently executing HW scan |
136 | * @ms: amount of time to wait (in milliseconds) for scan to abort | 136 | * @ms: amount of time to wait (in milliseconds) for scan to abort |
137 | * | 137 | * |
138 | * NOTE: priv->mutex must be held before calling this function | ||
139 | */ | 138 | */ |
140 | int iwl_scan_cancel_timeout(struct iwl_priv *priv, unsigned long ms) | 139 | int iwl_scan_cancel_timeout(struct iwl_priv *priv, unsigned long ms) |
141 | { | 140 | { |
142 | unsigned long now = jiffies; | 141 | unsigned long timeout = jiffies + msecs_to_jiffies(ms); |
143 | int ret; | 142 | |
143 | lockdep_assert_held(&priv->mutex); | ||
144 | 144 | ||
145 | ret = iwl_scan_cancel(priv); | 145 | IWL_DEBUG_SCAN(priv, "Scan cancel timeout\n"); |
146 | if (ret && ms) { | ||
147 | mutex_unlock(&priv->mutex); | ||
148 | while (!time_after(jiffies, now + msecs_to_jiffies(ms)) && | ||
149 | test_bit(STATUS_SCANNING, &priv->status)) | ||
150 | msleep(1); | ||
151 | mutex_lock(&priv->mutex); | ||
152 | 146 | ||
153 | return test_bit(STATUS_SCANNING, &priv->status); | 147 | iwl_do_scan_abort(priv); |
148 | |||
149 | while (time_before_eq(jiffies, timeout)) { | ||
150 | if (!test_bit(STATUS_SCAN_HW, &priv->status)) | ||
151 | break; | ||
152 | msleep(20); | ||
154 | } | 153 | } |
155 | 154 | ||
156 | return ret; | 155 | return test_bit(STATUS_SCAN_HW, &priv->status); |
157 | } | 156 | } |
158 | EXPORT_SYMBOL(iwl_scan_cancel_timeout); | 157 | EXPORT_SYMBOL(iwl_scan_cancel_timeout); |
159 | 158 | ||