iwl3945: use iwl_set_mode in 3945
authorAbhijeet Kolekar <abhijeet.kolekar@intel.com>
Wed, 8 Apr 2009 18:26:45 +0000 (11:26 -0700)
committerJohn W. Linville <linville@tuxdriver.com>
Wed, 22 Apr 2009 20:54:42 +0000 (16:54 -0400)
3945 can now use iwl_set_mode from iwlcore library.

Signed-off-by: Abhijeet Kolekar <abhijeet.kolekar@intel.com>
Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/iwlwifi/iwl-agn.c
drivers/net/wireless/iwlwifi/iwl-core.c
drivers/net/wireless/iwlwifi/iwl-core.h
drivers/net/wireless/iwlwifi/iwl3945-base.c

index 11e17923ad01dd91f1a7fd923e43be12d8ad3b36..479fcf142707d5bfc839c9671c517204ebeb09bf 100644 (file)
@@ -588,33 +588,6 @@ static void iwl_setup_rxon_timing(struct iwl_priv *priv)
                        le16_to_cpu(priv->rxon_timing.atim_window));
 }
 
-static int iwl_set_mode(struct iwl_priv *priv, int mode)
-{
-       iwl_connection_init_rx_config(priv, mode);
-
-       if (priv->cfg->ops->hcmd->set_rxon_chain)
-               priv->cfg->ops->hcmd->set_rxon_chain(priv);
-
-       memcpy(priv->staging_rxon.node_addr, priv->mac_addr, ETH_ALEN);
-
-       priv->cfg->ops->smgmt->clear_station_table(priv);
-
-       /* dont commit rxon if rf-kill is on*/
-       if (!iwl_is_ready_rf(priv))
-               return -EAGAIN;
-
-       cancel_delayed_work(&priv->scan_check);
-       if (iwl_scan_cancel_timeout(priv, 100)) {
-               IWL_WARN(priv, "Aborted scan still in progress after 100ms\n");
-               IWL_DEBUG_MAC80211(priv, "leaving - scan abort failed.\n");
-               return -EAGAIN;
-       }
-
-       iwlcore_commit_rxon(priv);
-
-       return 0;
-}
-
 /******************************************************************************
  *
  * Generic RX handler implementations
index cca37af3243f6cb0fd25252f004c52904ba2222b..01e7604bf33f3ba274a435af0a1c556324163b1d 100644 (file)
@@ -2339,6 +2339,48 @@ int iwl_mac_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb)
 }
 EXPORT_SYMBOL(iwl_mac_beacon_update);
 
+int iwl_set_mode(struct iwl_priv *priv, int mode)
+{
+       if (mode == NL80211_IFTYPE_ADHOC) {
+               const struct iwl_channel_info *ch_info;
+
+               ch_info = iwl_get_channel_info(priv,
+                       priv->band,
+                       le16_to_cpu(priv->staging_rxon.channel));
+
+               if (!ch_info || !is_channel_ibss(ch_info)) {
+                       IWL_ERR(priv, "channel %d not IBSS channel\n",
+                                 le16_to_cpu(priv->staging_rxon.channel));
+                       return -EINVAL;
+               }
+       }
+
+       iwl_connection_init_rx_config(priv, mode);
+
+       if (priv->cfg->ops->hcmd->set_rxon_chain)
+               priv->cfg->ops->hcmd->set_rxon_chain(priv);
+
+       memcpy(priv->staging_rxon.node_addr, priv->mac_addr, ETH_ALEN);
+
+       priv->cfg->ops->smgmt->clear_station_table(priv);
+
+       /* dont commit rxon if rf-kill is on*/
+       if (!iwl_is_ready_rf(priv))
+               return -EAGAIN;
+
+       cancel_delayed_work(&priv->scan_check);
+       if (iwl_scan_cancel_timeout(priv, 100)) {
+               IWL_WARN(priv, "Aborted scan still in progress after 100ms\n");
+               IWL_DEBUG_MAC80211(priv, "leaving - scan abort failed.\n");
+               return -EAGAIN;
+       }
+
+       iwlcore_commit_rxon(priv);
+
+       return 0;
+}
+EXPORT_SYMBOL(iwl_set_mode);
+
 #ifdef CONFIG_PM
 
 int iwl_pci_suspend(struct pci_dev *pdev, pm_message_t state)
index f5eff747e964b5796bb2b1c8f62ab62bc5c9f3b0..49df47a53b5d3b6f8eec08f91e0783ef6ce57a1f 100644 (file)
@@ -273,6 +273,7 @@ void iwl_bss_info_changed(struct ieee80211_hw *hw,
                                     u32 changes);
 int iwl_mac_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb);
 int iwl_commit_rxon(struct iwl_priv *priv);
+int iwl_set_mode(struct iwl_priv *priv, int mode);
 
 /*****************************************************
  * RX handlers.
index 7f35017d9df28337432e0a2b0e4d2893922647b6..666c1fff62b28b8aaa5ea973696c13dc472631fd 100644 (file)
@@ -570,42 +570,6 @@ static void iwl3945_setup_rxon_timing(struct iwl_priv *priv)
                le16_to_cpu(priv->rxon_timing.atim_window));
 }
 
-static int iwl3945_set_mode(struct iwl_priv *priv, int mode)
-{
-       if (mode == NL80211_IFTYPE_ADHOC) {
-               const struct iwl_channel_info *ch_info;
-
-               ch_info = iwl_get_channel_info(priv,
-                       priv->band,
-                       le16_to_cpu(priv->staging_rxon.channel));
-
-               if (!ch_info || !is_channel_ibss(ch_info)) {
-                       IWL_ERR(priv, "channel %d not IBSS channel\n",
-                                 le16_to_cpu(priv->staging_rxon.channel));
-                       return -EINVAL;
-               }
-       }
-
-       iwl_connection_init_rx_config(priv, mode);
-
-       priv->cfg->ops->smgmt->clear_station_table(priv);
-
-       /* don't commit rxon if rf-kill is on*/
-       if (!iwl_is_ready_rf(priv))
-               return -EAGAIN;
-
-       cancel_delayed_work(&priv->scan_check);
-       if (iwl_scan_cancel_timeout(priv, 100)) {
-               IWL_WARN(priv, "Aborted scan still in progress after 100ms\n");
-               IWL_DEBUG_MAC80211(priv, "leaving - scan abort failed.\n");
-               return -EAGAIN;
-       }
-
-       iwlcore_commit_rxon(priv);
-
-       return 0;
-}
-
 static void iwl3945_build_tx_cmd_hwcrypto(struct iwl_priv *priv,
                                      struct ieee80211_tx_info *info,
                                      struct iwl_cmd *cmd,
@@ -2701,7 +2665,7 @@ static void iwl3945_alive_start(struct iwl_priv *priv)
        }
 
        if (test_and_clear_bit(STATUS_MODE_PENDING, &priv->status))
-               iwl3945_set_mode(priv, priv->iw_mode);
+               iwl_set_mode(priv, priv->iw_mode);
 
        return;
 
@@ -3442,7 +3406,7 @@ static int iwl3945_mac_add_interface(struct ieee80211_hw *hw,
                memcpy(priv->mac_addr, conf->mac_addr, ETH_ALEN);
        }
 
-       if (iwl3945_set_mode(priv, conf->type) == -EAGAIN)
+       if (iwl_set_mode(priv, conf->type) == -EAGAIN)
                set_bit(STATUS_MODE_PENDING, &priv->status);
 
        mutex_unlock(&priv->mutex);