diff options
author | Reinette Chatre <reinette.chatre@intel.com> | 2010-04-16 13:43:40 -0700 |
---|---|---|
committer | Reinette Chatre <reinette.chatre@intel.com> | 2010-04-16 13:43:40 -0700 |
commit | 8715fa28fb4fad62f6004d276ec8e1aa5e664e76 (patch) | |
tree | 5e07f18c04f497833c6b5f043360f5ef58f1f028 /drivers/net/wireless/iwlwifi/iwl-scan.c | |
parent | a5e944f1d955f3819503348426763e21e0413ba6 (diff) | |
parent | f2fa1b015e9c199e45c836c769d94db595150731 (diff) | |
download | kernel_samsung_smdk4412-8715fa28fb4fad62f6004d276ec8e1aa5e664e76.zip kernel_samsung_smdk4412-8715fa28fb4fad62f6004d276ec8e1aa5e664e76.tar.gz kernel_samsung_smdk4412-8715fa28fb4fad62f6004d276ec8e1aa5e664e76.tar.bz2 |
Merge branch 'wireless-2.6' into wireless-next-2.6
Conflicts:
drivers/net/wireless/iwlwifi/iwl-6000.c
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-scan.c')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-scan.c | 31 |
1 files changed, 20 insertions, 11 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-scan.c b/drivers/net/wireless/iwlwifi/iwl-scan.c index d817c9c..c3b06c4 100644 --- a/drivers/net/wireless/iwlwifi/iwl-scan.c +++ b/drivers/net/wireless/iwlwifi/iwl-scan.c @@ -469,6 +469,8 @@ EXPORT_SYMBOL(iwl_init_scan_params); static int iwl_scan_initiate(struct iwl_priv *priv) { + WARN_ON(!mutex_is_locked(&priv->mutex)); + IWL_DEBUG_INFO(priv, "Starting scan...\n"); set_bit(STATUS_SCANNING, &priv->status); priv->is_internal_short_scan = false; @@ -546,24 +548,31 @@ EXPORT_SYMBOL(iwl_mac_hw_scan); * internal short scan, this function should only been called while associated. * It will reset and tune the radio to prevent possible RF related problem */ -int iwl_internal_short_hw_scan(struct iwl_priv *priv) +void iwl_internal_short_hw_scan(struct iwl_priv *priv) { - int ret = 0; + queue_work(priv->workqueue, &priv->start_internal_scan); +} + +static void iwl_bg_start_internal_scan(struct work_struct *work) +{ + struct iwl_priv *priv = + container_of(work, struct iwl_priv, start_internal_scan); + + mutex_lock(&priv->mutex); if (!iwl_is_ready_rf(priv)) { - ret = -EIO; IWL_DEBUG_SCAN(priv, "not ready or exit pending\n"); - goto out; + goto unlock; } + if (test_bit(STATUS_SCANNING, &priv->status)) { IWL_DEBUG_SCAN(priv, "Scan already in progress.\n"); - ret = -EAGAIN; - goto out; + goto unlock; } + if (test_bit(STATUS_SCAN_ABORTING, &priv->status)) { IWL_DEBUG_SCAN(priv, "Scan request while abort pending\n"); - ret = -EAGAIN; - goto out; + goto unlock; } priv->scan_bands = 0; @@ -576,9 +585,8 @@ int iwl_internal_short_hw_scan(struct iwl_priv *priv) set_bit(STATUS_SCANNING, &priv->status); priv->is_internal_short_scan = true; queue_work(priv->workqueue, &priv->request_scan); - -out: - return ret; + unlock: + mutex_unlock(&priv->mutex); } #define IWL_SCAN_CHECK_WATCHDOG (7 * HZ) @@ -962,6 +970,7 @@ void iwl_setup_scan_deferred_work(struct iwl_priv *priv) INIT_WORK(&priv->scan_completed, iwl_bg_scan_completed); INIT_WORK(&priv->request_scan, iwl_bg_request_scan); INIT_WORK(&priv->abort_scan, iwl_bg_abort_scan); + INIT_WORK(&priv->start_internal_scan, iwl_bg_start_internal_scan); INIT_DELAYED_WORK(&priv->scan_check, iwl_bg_scan_check); } EXPORT_SYMBOL(iwl_setup_scan_deferred_work); |