{
struct iwl_priv *priv = hw->priv;
struct iwl_rxon_context *ctx = iwl_rxon_ctx_from_vif(vif);
- bool scan_completed = false;
IWL_DEBUG_MAC80211(priv, "enter\n");
WARN_ON(ctx->vif != vif);
ctx->vif = NULL;
- iwl_scan_cancel_timeout(priv, 100);
+ if (priv->scan_vif == vif)
+ iwl_scan_cancel_timeout(priv, 100);
iwl_set_mode(priv, vif);
if (!ctx->always_active)
ctx->is_active = false;
- if (priv->scan_vif == vif) {
- scan_completed = true;
- priv->scan_vif = NULL;
- priv->scan_request = NULL;
- }
-
/*
* When removing the IBSS interface, overwrite the
* BT traffic load with the stored one from the last
memset(priv->bssid, 0, ETH_ALEN);
mutex_unlock(&priv->mutex);
- if (scan_completed)
- ieee80211_scan_completed(priv->hw, true);
-
IWL_DEBUG_MAC80211(priv, "leave\n");
}
spin_unlock_irqrestore(&priv->lock, flags);
+ iwl_scan_cancel_timeout(priv, 100);
if (!iwl_is_ready_rf(priv)) {
IWL_DEBUG_MAC80211(priv, "leave - not ready\n");
mutex_unlock(&priv->mutex);
/* we are restarting association process
* clear RXON_FILTER_ASSOC_MSK bit
*/
- iwl_scan_cancel_timeout(priv, 100);
ctx->staging.filter_flags &= ~RXON_FILTER_ASSOC_MSK;
iwlcore_commit_rxon(priv, ctx);
priv->scan_request = NULL;
}
+static void iwl_force_scan_end(struct iwl_priv *priv)
+{
+ IWL_DEBUG_SCAN(priv, "Forcing scan end\n");
+ clear_bit(STATUS_SCANNING, &priv->status);
+ clear_bit(STATUS_SCAN_HW, &priv->status);
+ clear_bit(STATUS_SCAN_ABORTING, &priv->status);
+ iwl_complete_scan(priv, true);
+}
+
static void iwl_do_scan_abort(struct iwl_priv *priv)
{
int ret;
ret = iwl_send_scan_abort(priv);
if (ret) {
IWL_DEBUG_SCAN(priv, "Send scan abort failed %d\n", ret);
- clear_bit(STATUS_SCANNING, &priv->status);
- clear_bit(STATUS_SCAN_HW, &priv->status);
- clear_bit(STATUS_SCAN_ABORTING, &priv->status);
- iwl_complete_scan(priv, true);
+ iwl_force_scan_end(priv);
} else
IWL_DEBUG_SCAN(priv, "Sucessfully send scan abort\n");
}
*/
int iwl_scan_cancel_timeout(struct iwl_priv *priv, unsigned long ms)
{
+ int ret;
unsigned long timeout = jiffies + msecs_to_jiffies(ms);
lockdep_assert_held(&priv->mutex);
msleep(20);
}
- return test_bit(STATUS_SCAN_HW, &priv->status);
+ ret = test_bit(STATUS_SCAN_HW, &priv->status);
+ if (ret)
+ iwl_force_scan_end(priv);
+ return ret;
}
EXPORT_SYMBOL(iwl_scan_cancel_timeout);