aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMohamed Abbas <mabbas@linux.intel.com>2007-11-28 22:10:15 -0500
committerDavid S. Miller <davem@davemloft.net>2008-01-28 18:05:37 -0500
commitfde3571fd8613483f1203d11394ae316c6b79a03 (patch)
tree1cf86bcf3b5fc5cfd1990d0eeb96bc607093ac87
parent5c0eef960bdb87a53ba390aab7b069b2bc8d7f6d (diff)
iwlwifi: avoid firmware command sending if rfkill is enabled
This patch fixed a ucode timeout issue and worked code with suspend to disk. Signed-off-by: Mohamed Abbas <mabbas@linux.intel.com> Signed-off-by: Zhu Yi <yi.zhu@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r--drivers/net/wireless/iwlwifi/iwl3945-base.c54
-rw-r--r--drivers/net/wireless/iwlwifi/iwl4965-base.c54
2 files changed, 66 insertions, 42 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index 3272608ced83..dbb6eff7b8e6 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -2546,9 +2546,6 @@ static void iwl3945_connection_init_rx_config(struct iwl3945_priv *priv)
2546 2546
2547static int iwl3945_set_mode(struct iwl3945_priv *priv, int mode) 2547static int iwl3945_set_mode(struct iwl3945_priv *priv, int mode)
2548{ 2548{
2549 if (!iwl3945_is_ready_rf(priv))
2550 return -EAGAIN;
2551
2552 if (mode == IEEE80211_IF_TYPE_IBSS) { 2549 if (mode == IEEE80211_IF_TYPE_IBSS) {
2553 const struct iwl3945_channel_info *ch_info; 2550 const struct iwl3945_channel_info *ch_info;
2554 2551
@@ -2563,13 +2560,6 @@ static int iwl3945_set_mode(struct iwl3945_priv *priv, int mode)
2563 } 2560 }
2564 } 2561 }
2565 2562
2566 cancel_delayed_work(&priv->scan_check);
2567 if (iwl3945_scan_cancel_timeout(priv, 100)) {
2568 IWL_WARNING("Aborted scan still in progress after 100ms\n");
2569 IWL_DEBUG_MAC80211("leaving - scan abort failed.\n");
2570 return -EAGAIN;
2571 }
2572
2573 priv->iw_mode = mode; 2563 priv->iw_mode = mode;
2574 2564
2575 iwl3945_connection_init_rx_config(priv); 2565 iwl3945_connection_init_rx_config(priv);
@@ -2577,6 +2567,17 @@ static int iwl3945_set_mode(struct iwl3945_priv *priv, int mode)
2577 2567
2578 iwl3945_clear_stations_table(priv); 2568 iwl3945_clear_stations_table(priv);
2579 2569
2570 /* dont commit rxon if rf-kill is on*/
2571 if (!iwl3945_is_ready_rf(priv))
2572 return -EAGAIN;
2573
2574 cancel_delayed_work(&priv->scan_check);
2575 if (iwl3945_scan_cancel_timeout(priv, 100)) {
2576 IWL_WARNING("Aborted scan still in progress after 100ms\n");
2577 IWL_DEBUG_MAC80211("leaving - scan abort failed.\n");
2578 return -EAGAIN;
2579 }
2580
2580 iwl3945_commit_rxon(priv); 2581 iwl3945_commit_rxon(priv);
2581 2582
2582 return 0; 2583 return 0;
@@ -7020,6 +7021,12 @@ static void iwl3945_mac_stop(struct ieee80211_hw *hw)
7020 * RXON_FILTER_ASSOC_MSK BIT 7021 * RXON_FILTER_ASSOC_MSK BIT
7021 */ 7022 */
7022 priv->is_open = 0; 7023 priv->is_open = 0;
7024 if (!iwl3945_is_ready_rf(priv)) {
7025 IWL_DEBUG_MAC80211("leave - RF not ready\n");
7026 mutex_unlock(&priv->mutex);
7027 return;
7028 }
7029
7023 iwl3945_scan_cancel_timeout(priv, 100); 7030 iwl3945_scan_cancel_timeout(priv, 100);
7024 cancel_delayed_work(&priv->post_associate); 7031 cancel_delayed_work(&priv->post_associate);
7025 priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; 7032 priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK;
@@ -7291,6 +7298,9 @@ static int iwl3945_mac_config_interface(struct ieee80211_hw *hw, int if_id,
7291 priv->ibss_beacon = conf->beacon; 7298 priv->ibss_beacon = conf->beacon;
7292 } 7299 }
7293 7300
7301 if (iwl3945_is_rfkill(priv))
7302 goto done;
7303
7294 if (conf->bssid && !is_zero_ether_addr(conf->bssid) && 7304 if (conf->bssid && !is_zero_ether_addr(conf->bssid) &&
7295 !is_multicast_ether_addr(conf->bssid)) { 7305 !is_multicast_ether_addr(conf->bssid)) {
7296 /* If there is currently a HW scan going on in the background 7306 /* If there is currently a HW scan going on in the background
@@ -7325,6 +7335,7 @@ static int iwl3945_mac_config_interface(struct ieee80211_hw *hw, int if_id,
7325 iwl3945_commit_rxon(priv); 7335 iwl3945_commit_rxon(priv);
7326 } 7336 }
7327 7337
7338 done:
7328 spin_lock_irqsave(&priv->lock, flags); 7339 spin_lock_irqsave(&priv->lock, flags);
7329 if (!conf->ssid_len) 7340 if (!conf->ssid_len)
7330 memset(priv->essid, 0, IW_ESSID_MAX_SIZE); 7341 memset(priv->essid, 0, IW_ESSID_MAX_SIZE);
@@ -7361,11 +7372,12 @@ static void iwl3945_mac_remove_interface(struct ieee80211_hw *hw,
7361 7372
7362 mutex_lock(&priv->mutex); 7373 mutex_lock(&priv->mutex);
7363 7374
7364 iwl3945_scan_cancel_timeout(priv, 100); 7375 if (iwl3945_is_ready_rf(priv)) {
7365 cancel_delayed_work(&priv->post_associate); 7376 iwl3945_scan_cancel_timeout(priv, 100);
7366 priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; 7377 cancel_delayed_work(&priv->post_associate);
7367 iwl3945_commit_rxon(priv); 7378 priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK;
7368 7379 iwl3945_commit_rxon(priv);
7380 }
7369 if (priv->interface_id == conf->if_id) { 7381 if (priv->interface_id == conf->if_id) {
7370 priv->interface_id = 0; 7382 priv->interface_id = 0;
7371 memset(priv->bssid, 0, ETH_ALEN); 7383 memset(priv->bssid, 0, ETH_ALEN);
@@ -7636,6 +7648,12 @@ static void iwl3945_mac_reset_tsf(struct ieee80211_hw *hw)
7636 7648
7637 spin_unlock_irqrestore(&priv->lock, flags); 7649 spin_unlock_irqrestore(&priv->lock, flags);
7638 7650
7651 if (!iwl3945_is_ready_rf(priv)) {
7652 IWL_DEBUG_MAC80211("leave - not ready\n");
7653 mutex_unlock(&priv->mutex);
7654 return;
7655 }
7656
7639 /* we are restarting association process 7657 /* we are restarting association process
7640 * clear RXON_FILTER_ASSOC_MSK bit 7658 * clear RXON_FILTER_ASSOC_MSK bit
7641 */ 7659 */
@@ -7653,12 +7671,6 @@ static void iwl3945_mac_reset_tsf(struct ieee80211_hw *hw)
7653 return; 7671 return;
7654 } 7672 }
7655 7673
7656 if (!iwl3945_is_ready_rf(priv)) {
7657 IWL_DEBUG_MAC80211("leave - not ready\n");
7658 mutex_unlock(&priv->mutex);
7659 return;
7660 }
7661
7662 priv->only_active_channel = 0; 7674 priv->only_active_channel = 0;
7663 7675
7664 iwl3945_set_rate(priv); 7676 iwl3945_set_rate(priv);
diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c
index 6be38ce701f5..b6e9a09b7e75 100644
--- a/drivers/net/wireless/iwlwifi/iwl4965-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c
@@ -2649,9 +2649,6 @@ static void iwl4965_connection_init_rx_config(struct iwl4965_priv *priv)
2649 2649
2650static int iwl4965_set_mode(struct iwl4965_priv *priv, int mode) 2650static int iwl4965_set_mode(struct iwl4965_priv *priv, int mode)
2651{ 2651{
2652 if (!iwl4965_is_ready_rf(priv))
2653 return -EAGAIN;
2654
2655 if (mode == IEEE80211_IF_TYPE_IBSS) { 2652 if (mode == IEEE80211_IF_TYPE_IBSS) {
2656 const struct iwl4965_channel_info *ch_info; 2653 const struct iwl4965_channel_info *ch_info;
2657 2654
@@ -2666,13 +2663,6 @@ static int iwl4965_set_mode(struct iwl4965_priv *priv, int mode)
2666 } 2663 }
2667 } 2664 }
2668 2665
2669 cancel_delayed_work(&priv->scan_check);
2670 if (iwl4965_scan_cancel_timeout(priv, 100)) {
2671 IWL_WARNING("Aborted scan still in progress after 100ms\n");
2672 IWL_DEBUG_MAC80211("leaving - scan abort failed.\n");
2673 return -EAGAIN;
2674 }
2675
2676 priv->iw_mode = mode; 2666 priv->iw_mode = mode;
2677 2667
2678 iwl4965_connection_init_rx_config(priv); 2668 iwl4965_connection_init_rx_config(priv);
@@ -2680,6 +2670,17 @@ static int iwl4965_set_mode(struct iwl4965_priv *priv, int mode)
2680 2670
2681 iwl4965_clear_stations_table(priv); 2671 iwl4965_clear_stations_table(priv);
2682 2672
2673 /* dont commit rxon if rf-kill is on*/
2674 if (!iwl4965_is_ready_rf(priv))
2675 return -EAGAIN;
2676
2677 cancel_delayed_work(&priv->scan_check);
2678 if (iwl4965_scan_cancel_timeout(priv, 100)) {
2679 IWL_WARNING("Aborted scan still in progress after 100ms\n");
2680 IWL_DEBUG_MAC80211("leaving - scan abort failed.\n");
2681 return -EAGAIN;
2682 }
2683
2683 iwl4965_commit_rxon(priv); 2684 iwl4965_commit_rxon(priv);
2684 2685
2685 return 0; 2686 return 0;
@@ -7458,6 +7459,12 @@ static void iwl4965_mac_stop(struct ieee80211_hw *hw)
7458 * RXON_FILTER_ASSOC_MSK BIT 7459 * RXON_FILTER_ASSOC_MSK BIT
7459 */ 7460 */
7460 priv->is_open = 0; 7461 priv->is_open = 0;
7462 if (!iwl4965_is_ready_rf(priv)) {
7463 IWL_DEBUG_MAC80211("leave - RF not ready\n");
7464 mutex_unlock(&priv->mutex);
7465 return;
7466 }
7467
7461 iwl4965_scan_cancel_timeout(priv, 100); 7468 iwl4965_scan_cancel_timeout(priv, 100);
7462 cancel_delayed_work(&priv->post_associate); 7469 cancel_delayed_work(&priv->post_associate);
7463 priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; 7470 priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK;
@@ -7743,6 +7750,9 @@ static int iwl4965_mac_config_interface(struct ieee80211_hw *hw, int if_id,
7743 priv->ibss_beacon = conf->beacon; 7750 priv->ibss_beacon = conf->beacon;
7744 } 7751 }
7745 7752
7753 if (iwl4965_is_rfkill(priv))
7754 goto done;
7755
7746 if (conf->bssid && !is_zero_ether_addr(conf->bssid) && 7756 if (conf->bssid && !is_zero_ether_addr(conf->bssid) &&
7747 !is_multicast_ether_addr(conf->bssid)) { 7757 !is_multicast_ether_addr(conf->bssid)) {
7748 /* If there is currently a HW scan going on in the background 7758 /* If there is currently a HW scan going on in the background
@@ -7777,6 +7787,7 @@ static int iwl4965_mac_config_interface(struct ieee80211_hw *hw, int if_id,
7777 iwl4965_commit_rxon(priv); 7787 iwl4965_commit_rxon(priv);
7778 } 7788 }
7779 7789
7790 done:
7780 spin_lock_irqsave(&priv->lock, flags); 7791 spin_lock_irqsave(&priv->lock, flags);
7781 if (!conf->ssid_len) 7792 if (!conf->ssid_len)
7782 memset(priv->essid, 0, IW_ESSID_MAX_SIZE); 7793 memset(priv->essid, 0, IW_ESSID_MAX_SIZE);
@@ -7813,11 +7824,12 @@ static void iwl4965_mac_remove_interface(struct ieee80211_hw *hw,
7813 7824
7814 mutex_lock(&priv->mutex); 7825 mutex_lock(&priv->mutex);
7815 7826
7816 iwl4965_scan_cancel_timeout(priv, 100); 7827 if (iwl4965_is_ready_rf(priv)) {
7817 cancel_delayed_work(&priv->post_associate); 7828 iwl4965_scan_cancel_timeout(priv, 100);
7818 priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; 7829 cancel_delayed_work(&priv->post_associate);
7819 iwl4965_commit_rxon(priv); 7830 priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK;
7820 7831 iwl4965_commit_rxon(priv);
7832 }
7821 if (priv->interface_id == conf->if_id) { 7833 if (priv->interface_id == conf->if_id) {
7822 priv->interface_id = 0; 7834 priv->interface_id = 0;
7823 memset(priv->bssid, 0, ETH_ALEN); 7835 memset(priv->bssid, 0, ETH_ALEN);
@@ -8130,6 +8142,12 @@ static void iwl4965_mac_reset_tsf(struct ieee80211_hw *hw)
8130 8142
8131 spin_unlock_irqrestore(&priv->lock, flags); 8143 spin_unlock_irqrestore(&priv->lock, flags);
8132 8144
8145 if (!iwl4965_is_ready_rf(priv)) {
8146 IWL_DEBUG_MAC80211("leave - not ready\n");
8147 mutex_unlock(&priv->mutex);
8148 return;
8149 }
8150
8133 /* we are restarting association process 8151 /* we are restarting association process
8134 * clear RXON_FILTER_ASSOC_MSK bit 8152 * clear RXON_FILTER_ASSOC_MSK bit
8135 */ 8153 */
@@ -8147,12 +8165,6 @@ static void iwl4965_mac_reset_tsf(struct ieee80211_hw *hw)
8147 return; 8165 return;
8148 } 8166 }
8149 8167
8150 if (!iwl4965_is_ready_rf(priv)) {
8151 IWL_DEBUG_MAC80211("leave - not ready\n");
8152 mutex_unlock(&priv->mutex);
8153 return;
8154 }
8155
8156 priv->only_active_channel = 0; 8168 priv->only_active_channel = 0;
8157 8169
8158 iwl4965_set_rate(priv); 8170 iwl4965_set_rate(priv);