aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAbhijeet Kolekar <abhijeet.kolekar@intel.com>2009-04-08 14:26:45 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-04-22 16:54:42 -0400
commit727882d62477ed45d248e8cd6d53cf794537b073 (patch)
treee474cc2e65acb84a595f4cd5560e54882142070a
parent45823531662028a8cbd68906c20e887bb287c85e (diff)
iwl3945: use iwl_set_mode in 3945
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>
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn.c27
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-core.c42
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-core.h1
-rw-r--r--drivers/net/wireless/iwlwifi/iwl3945-base.c40
4 files changed, 45 insertions, 65 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
index 11e17923ad01..479fcf142707 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
@@ -588,33 +588,6 @@ static void iwl_setup_rxon_timing(struct iwl_priv *priv)
588 le16_to_cpu(priv->rxon_timing.atim_window)); 588 le16_to_cpu(priv->rxon_timing.atim_window));
589} 589}
590 590
591static int iwl_set_mode(struct iwl_priv *priv, int mode)
592{
593 iwl_connection_init_rx_config(priv, mode);
594
595 if (priv->cfg->ops->hcmd->set_rxon_chain)
596 priv->cfg->ops->hcmd->set_rxon_chain(priv);
597
598 memcpy(priv->staging_rxon.node_addr, priv->mac_addr, ETH_ALEN);
599
600 priv->cfg->ops->smgmt->clear_station_table(priv);
601
602 /* dont commit rxon if rf-kill is on*/
603 if (!iwl_is_ready_rf(priv))
604 return -EAGAIN;
605
606 cancel_delayed_work(&priv->scan_check);
607 if (iwl_scan_cancel_timeout(priv, 100)) {
608 IWL_WARN(priv, "Aborted scan still in progress after 100ms\n");
609 IWL_DEBUG_MAC80211(priv, "leaving - scan abort failed.\n");
610 return -EAGAIN;
611 }
612
613 iwlcore_commit_rxon(priv);
614
615 return 0;
616}
617
618/****************************************************************************** 591/******************************************************************************
619 * 592 *
620 * Generic RX handler implementations 593 * Generic RX handler implementations
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.c b/drivers/net/wireless/iwlwifi/iwl-core.c
index cca37af3243f..01e7604bf33f 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.c
+++ b/drivers/net/wireless/iwlwifi/iwl-core.c
@@ -2339,6 +2339,48 @@ int iwl_mac_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb)
2339} 2339}
2340EXPORT_SYMBOL(iwl_mac_beacon_update); 2340EXPORT_SYMBOL(iwl_mac_beacon_update);
2341 2341
2342int iwl_set_mode(struct iwl_priv *priv, int mode)
2343{
2344 if (mode == NL80211_IFTYPE_ADHOC) {
2345 const struct iwl_channel_info *ch_info;
2346
2347 ch_info = iwl_get_channel_info(priv,
2348 priv->band,
2349 le16_to_cpu(priv->staging_rxon.channel));
2350
2351 if (!ch_info || !is_channel_ibss(ch_info)) {
2352 IWL_ERR(priv, "channel %d not IBSS channel\n",
2353 le16_to_cpu(priv->staging_rxon.channel));
2354 return -EINVAL;
2355 }
2356 }
2357
2358 iwl_connection_init_rx_config(priv, mode);
2359
2360 if (priv->cfg->ops->hcmd->set_rxon_chain)
2361 priv->cfg->ops->hcmd->set_rxon_chain(priv);
2362
2363 memcpy(priv->staging_rxon.node_addr, priv->mac_addr, ETH_ALEN);
2364
2365 priv->cfg->ops->smgmt->clear_station_table(priv);
2366
2367 /* dont commit rxon if rf-kill is on*/
2368 if (!iwl_is_ready_rf(priv))
2369 return -EAGAIN;
2370
2371 cancel_delayed_work(&priv->scan_check);
2372 if (iwl_scan_cancel_timeout(priv, 100)) {
2373 IWL_WARN(priv, "Aborted scan still in progress after 100ms\n");
2374 IWL_DEBUG_MAC80211(priv, "leaving - scan abort failed.\n");
2375 return -EAGAIN;
2376 }
2377
2378 iwlcore_commit_rxon(priv);
2379
2380 return 0;
2381}
2382EXPORT_SYMBOL(iwl_set_mode);
2383
2342#ifdef CONFIG_PM 2384#ifdef CONFIG_PM
2343 2385
2344int iwl_pci_suspend(struct pci_dev *pdev, pm_message_t state) 2386int iwl_pci_suspend(struct pci_dev *pdev, pm_message_t state)
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.h b/drivers/net/wireless/iwlwifi/iwl-core.h
index f5eff747e964..49df47a53b5d 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.h
+++ b/drivers/net/wireless/iwlwifi/iwl-core.h
@@ -273,6 +273,7 @@ void iwl_bss_info_changed(struct ieee80211_hw *hw,
273 u32 changes); 273 u32 changes);
274int iwl_mac_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb); 274int iwl_mac_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb);
275int iwl_commit_rxon(struct iwl_priv *priv); 275int iwl_commit_rxon(struct iwl_priv *priv);
276int iwl_set_mode(struct iwl_priv *priv, int mode);
276 277
277/***************************************************** 278/*****************************************************
278 * RX handlers. 279 * RX handlers.
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index 7f35017d9df2..666c1fff62b2 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -570,42 +570,6 @@ static void iwl3945_setup_rxon_timing(struct iwl_priv *priv)
570 le16_to_cpu(priv->rxon_timing.atim_window)); 570 le16_to_cpu(priv->rxon_timing.atim_window));
571} 571}
572 572
573static int iwl3945_set_mode(struct iwl_priv *priv, int mode)
574{
575 if (mode == NL80211_IFTYPE_ADHOC) {
576 const struct iwl_channel_info *ch_info;
577
578 ch_info = iwl_get_channel_info(priv,
579 priv->band,
580 le16_to_cpu(priv->staging_rxon.channel));
581
582 if (!ch_info || !is_channel_ibss(ch_info)) {
583 IWL_ERR(priv, "channel %d not IBSS channel\n",
584 le16_to_cpu(priv->staging_rxon.channel));
585 return -EINVAL;
586 }
587 }
588
589 iwl_connection_init_rx_config(priv, mode);
590
591 priv->cfg->ops->smgmt->clear_station_table(priv);
592
593 /* don't commit rxon if rf-kill is on*/
594 if (!iwl_is_ready_rf(priv))
595 return -EAGAIN;
596
597 cancel_delayed_work(&priv->scan_check);
598 if (iwl_scan_cancel_timeout(priv, 100)) {
599 IWL_WARN(priv, "Aborted scan still in progress after 100ms\n");
600 IWL_DEBUG_MAC80211(priv, "leaving - scan abort failed.\n");
601 return -EAGAIN;
602 }
603
604 iwlcore_commit_rxon(priv);
605
606 return 0;
607}
608
609static void iwl3945_build_tx_cmd_hwcrypto(struct iwl_priv *priv, 573static void iwl3945_build_tx_cmd_hwcrypto(struct iwl_priv *priv,
610 struct ieee80211_tx_info *info, 574 struct ieee80211_tx_info *info,
611 struct iwl_cmd *cmd, 575 struct iwl_cmd *cmd,
@@ -2701,7 +2665,7 @@ static void iwl3945_alive_start(struct iwl_priv *priv)
2701 } 2665 }
2702 2666
2703 if (test_and_clear_bit(STATUS_MODE_PENDING, &priv->status)) 2667 if (test_and_clear_bit(STATUS_MODE_PENDING, &priv->status))
2704 iwl3945_set_mode(priv, priv->iw_mode); 2668 iwl_set_mode(priv, priv->iw_mode);
2705 2669
2706 return; 2670 return;
2707 2671
@@ -3442,7 +3406,7 @@ static int iwl3945_mac_add_interface(struct ieee80211_hw *hw,
3442 memcpy(priv->mac_addr, conf->mac_addr, ETH_ALEN); 3406 memcpy(priv->mac_addr, conf->mac_addr, ETH_ALEN);
3443 } 3407 }
3444 3408
3445 if (iwl3945_set_mode(priv, conf->type) == -EAGAIN) 3409 if (iwl_set_mode(priv, conf->type) == -EAGAIN)
3446 set_bit(STATUS_MODE_PENDING, &priv->status); 3410 set_bit(STATUS_MODE_PENDING, &priv->status);
3447 3411
3448 mutex_unlock(&priv->mutex); 3412 mutex_unlock(&priv->mutex);