aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl3945-base.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl3945-base.c')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl3945-base.c74
1 files changed, 10 insertions, 64 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index be1e75e3be55..fc553bacef17 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -2816,7 +2816,7 @@ static void iwl3945_rfkill_poll(struct work_struct *data)
2816 2816
2817} 2817}
2818 2818
2819void iwl3945_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif) 2819int iwl3945_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif)
2820{ 2820{
2821 struct iwl_host_cmd cmd = { 2821 struct iwl_host_cmd cmd = {
2822 .id = REPLY_SCAN_CMD, 2822 .id = REPLY_SCAN_CMD,
@@ -2827,55 +2827,16 @@ void iwl3945_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif)
2827 u8 n_probes = 0; 2827 u8 n_probes = 0;
2828 enum ieee80211_band band; 2828 enum ieee80211_band band;
2829 bool is_active = false; 2829 bool is_active = false;
2830 int ret;
2830 2831
2831 cancel_delayed_work(&priv->scan_check); 2832 lockdep_assert_held(&priv->mutex);
2832
2833 if (!iwl_is_ready(priv)) {
2834 IWL_WARN(priv, "request scan called when driver not ready.\n");
2835 goto done;
2836 }
2837
2838 /* Make sure the scan wasn't canceled before this queued work
2839 * was given the chance to run... */
2840 if (!test_bit(STATUS_SCANNING, &priv->status))
2841 goto done;
2842
2843 /* This should never be called or scheduled if there is currently
2844 * a scan active in the hardware. */
2845 if (test_bit(STATUS_SCAN_HW, &priv->status)) {
2846 IWL_DEBUG_INFO(priv, "Multiple concurrent scan requests "
2847 "Ignoring second request.\n");
2848 goto done;
2849 }
2850
2851 if (test_bit(STATUS_EXIT_PENDING, &priv->status)) {
2852 IWL_DEBUG_SCAN(priv, "Aborting scan due to device shutdown\n");
2853 goto done;
2854 }
2855
2856 if (test_bit(STATUS_SCAN_ABORTING, &priv->status)) {
2857 IWL_DEBUG_HC(priv,
2858 "Scan request while abort pending. Queuing.\n");
2859 goto done;
2860 }
2861
2862 if (iwl_is_rfkill(priv)) {
2863 IWL_DEBUG_HC(priv, "Aborting scan due to RF Kill activation\n");
2864 goto done;
2865 }
2866
2867 if (!test_bit(STATUS_READY, &priv->status)) {
2868 IWL_DEBUG_HC(priv,
2869 "Scan request while uninitialized. Queuing.\n");
2870 goto done;
2871 }
2872 2833
2873 if (!priv->scan_cmd) { 2834 if (!priv->scan_cmd) {
2874 priv->scan_cmd = kmalloc(sizeof(struct iwl3945_scan_cmd) + 2835 priv->scan_cmd = kmalloc(sizeof(struct iwl3945_scan_cmd) +
2875 IWL_MAX_SCAN_SIZE, GFP_KERNEL); 2836 IWL_MAX_SCAN_SIZE, GFP_KERNEL);
2876 if (!priv->scan_cmd) { 2837 if (!priv->scan_cmd) {
2877 IWL_DEBUG_SCAN(priv, "Fail to allocate scan memory\n"); 2838 IWL_DEBUG_SCAN(priv, "Fail to allocate scan memory\n");
2878 goto done; 2839 return -ENOMEM;
2879 } 2840 }
2880 } 2841 }
2881 scan = priv->scan_cmd; 2842 scan = priv->scan_cmd;
@@ -2970,7 +2931,7 @@ void iwl3945_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif)
2970 break; 2931 break;
2971 default: 2932 default:
2972 IWL_WARN(priv, "Invalid scan band\n"); 2933 IWL_WARN(priv, "Invalid scan band\n");
2973 goto done; 2934 return -EIO;
2974 } 2935 }
2975 2936
2976 if (!priv->is_internal_short_scan) { 2937 if (!priv->is_internal_short_scan) {
@@ -3005,7 +2966,7 @@ void iwl3945_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif)
3005 2966
3006 if (scan->channel_count == 0) { 2967 if (scan->channel_count == 0) {
3007 IWL_DEBUG_SCAN(priv, "channel count %d\n", scan->channel_count); 2968 IWL_DEBUG_SCAN(priv, "channel count %d\n", scan->channel_count);
3008 goto done; 2969 return -EIO;
3009 } 2970 }
3010 2971
3011 cmd.len += le16_to_cpu(scan->tx_cmd.len) + 2972 cmd.len += le16_to_cpu(scan->tx_cmd.len) +
@@ -3014,25 +2975,10 @@ void iwl3945_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif)
3014 scan->len = cpu_to_le16(cmd.len); 2975 scan->len = cpu_to_le16(cmd.len);
3015 2976
3016 set_bit(STATUS_SCAN_HW, &priv->status); 2977 set_bit(STATUS_SCAN_HW, &priv->status);
3017 if (iwl_send_cmd_sync(priv, &cmd)) 2978 ret = iwl_send_cmd_sync(priv, &cmd);
3018 goto done; 2979 if (ret)
3019 2980 clear_bit(STATUS_SCAN_HW, &priv->status);
3020 queue_delayed_work(priv->workqueue, &priv->scan_check, 2981 return ret;
3021 IWL_SCAN_CHECK_WATCHDOG);
3022
3023 return;
3024
3025 done:
3026 /* can not perform scan make sure we clear scanning
3027 * bits from status so next scan request can be performed.
3028 * if we dont clear scanning status bit here all next scan
3029 * will fail
3030 */
3031 clear_bit(STATUS_SCAN_HW, &priv->status);
3032 clear_bit(STATUS_SCANNING, &priv->status);
3033
3034 /* inform mac80211 scan aborted */
3035 queue_work(priv->workqueue, &priv->scan_completed);
3036} 2982}
3037 2983
3038static void iwl3945_bg_restart(struct work_struct *data) 2984static void iwl3945_bg_restart(struct work_struct *data)