Beispiel #1
0
/**
 * iwl_scan_cancel_timeout - Cancel any currently executing HW scan
 * @ms: amount of time to wait (in milliseconds) for scan to abort
 *
 */
void iwl_scan_cancel_timeout(struct iwl_priv *priv, unsigned long ms)
{
    unsigned long timeout = jiffies + msecs_to_jiffies(ms);

    lockdep_assert_held(&priv->mutex);

    IWL_DEBUG_SCAN(priv, "Scan cancel timeout\n");

    iwl_do_scan_abort(priv);

    while (time_before_eq(jiffies, timeout)) {
        if (!test_bit(STATUS_SCAN_HW, &priv->status))
            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);
}
Beispiel #2
0
/**
 * iwl_scan_cancel_timeout - Cancel any currently executing HW scan
 * @ms: amount of time to wait (in milliseconds) for scan to abort
 *
 */
int iwl_scan_cancel_timeout(struct iwl_priv *priv, unsigned long ms)
{
	unsigned long timeout = jiffies + msecs_to_jiffies(ms);

	lockdep_assert_held(&priv->mutex);

	IWL_DEBUG_SCAN(priv, "Scan cancel timeout\n");

	iwl_do_scan_abort(priv);

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

	return test_bit(STATUS_SCAN_HW, &priv->status);
}