aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi
diff options
context:
space:
mode:
authorReinette Chatre <reinette.chatre@intel.com>2009-10-30 17:36:11 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-11-02 15:39:46 -0500
commit89f186a8b64a4c90a219cfd94c26de5cfea54b84 (patch)
tree9b049ec3d8fa8226d4a9ef779d0e7c5ce2fcbd7a /drivers/net/wireless/iwlwifi
parentc33de6256a07869b48830e3a26fb6942ea8c4f79 (diff)
iwlwifi: move iwl_[un]init_drv to iwlagn
Since iwlagn is the only user of these functions, move it to this module. This results in a bit more code moving than just these functions since the functions only used by them are also moved and we need to export the symbols previously available to them directly. Signed-off-by: Reinette Chatre <reinette.chatre@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn.c90
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-calib.c1
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-core.c93
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-core.h2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-scan.c1
5 files changed, 92 insertions, 95 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
index 0cb95bfd15a5..2814565fa3b4 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
@@ -2972,6 +2972,96 @@ static void iwl_cancel_deferred_work(struct iwl_priv *priv)
2972 del_timer_sync(&priv->statistics_periodic); 2972 del_timer_sync(&priv->statistics_periodic);
2973} 2973}
2974 2974
2975static void iwl_init_hw_rates(struct iwl_priv *priv,
2976 struct ieee80211_rate *rates)
2977{
2978 int i;
2979
2980 for (i = 0; i < IWL_RATE_COUNT_LEGACY; i++) {
2981 rates[i].bitrate = iwl_rates[i].ieee * 5;
2982 rates[i].hw_value = i; /* Rate scaling will work on indexes */
2983 rates[i].hw_value_short = i;
2984 rates[i].flags = 0;
2985 if ((i >= IWL_FIRST_CCK_RATE) && (i <= IWL_LAST_CCK_RATE)) {
2986 /*
2987 * If CCK != 1M then set short preamble rate flag.
2988 */
2989 rates[i].flags |=
2990 (iwl_rates[i].plcp == IWL_RATE_1M_PLCP) ?
2991 0 : IEEE80211_RATE_SHORT_PREAMBLE;
2992 }
2993 }
2994}
2995
2996static int iwl_init_drv(struct iwl_priv *priv)
2997{
2998 int ret;
2999
3000 priv->ibss_beacon = NULL;
3001
3002 spin_lock_init(&priv->lock);
3003 spin_lock_init(&priv->sta_lock);
3004 spin_lock_init(&priv->hcmd_lock);
3005
3006 INIT_LIST_HEAD(&priv->free_frames);
3007
3008 mutex_init(&priv->mutex);
3009
3010 /* Clear the driver's (not device's) station table */
3011 iwl_clear_stations_table(priv);
3012
3013 priv->ieee_channels = NULL;
3014 priv->ieee_rates = NULL;
3015 priv->band = IEEE80211_BAND_2GHZ;
3016
3017 priv->iw_mode = NL80211_IFTYPE_STATION;
3018
3019 /* Choose which receivers/antennas to use */
3020 if (priv->cfg->ops->hcmd->set_rxon_chain)
3021 priv->cfg->ops->hcmd->set_rxon_chain(priv);
3022
3023 iwl_init_scan_params(priv);
3024
3025 iwl_reset_qos(priv);
3026
3027 priv->qos_data.qos_active = 0;
3028 priv->qos_data.qos_cap.val = 0;
3029
3030 priv->rates_mask = IWL_RATES_MASK;
3031 /* Set the tx_power_user_lmt to the lowest power level
3032 * this value will get overwritten by channel max power avg
3033 * from eeprom */
3034 priv->tx_power_user_lmt = IWL_TX_POWER_TARGET_POWER_MIN;
3035
3036 ret = iwl_init_channel_map(priv);
3037 if (ret) {
3038 IWL_ERR(priv, "initializing regulatory failed: %d\n", ret);
3039 goto err;
3040 }
3041
3042 ret = iwlcore_init_geos(priv);
3043 if (ret) {
3044 IWL_ERR(priv, "initializing geos failed: %d\n", ret);
3045 goto err_free_channel_map;
3046 }
3047 iwl_init_hw_rates(priv, priv->ieee_rates);
3048
3049 return 0;
3050
3051err_free_channel_map:
3052 iwl_free_channel_map(priv);
3053err:
3054 return ret;
3055}
3056
3057static void iwl_uninit_drv(struct iwl_priv *priv)
3058{
3059 iwl_calib_free_results(priv);
3060 iwlcore_free_geos(priv);
3061 iwl_free_channel_map(priv);
3062 kfree(priv->scan);
3063}
3064
2975static struct attribute *iwl_sysfs_entries[] = { 3065static struct attribute *iwl_sysfs_entries[] = {
2976 &dev_attr_flags.attr, 3066 &dev_attr_flags.attr,
2977 &dev_attr_filter_flags.attr, 3067 &dev_attr_filter_flags.attr,
diff --git a/drivers/net/wireless/iwlwifi/iwl-calib.c b/drivers/net/wireless/iwlwifi/iwl-calib.c
index 1f801eb9fbff..d994de7438d8 100644
--- a/drivers/net/wireless/iwlwifi/iwl-calib.c
+++ b/drivers/net/wireless/iwlwifi/iwl-calib.c
@@ -132,6 +132,7 @@ void iwl_calib_free_results(struct iwl_priv *priv)
132 priv->calib_results[i].buf_len = 0; 132 priv->calib_results[i].buf_len = 0;
133 } 133 }
134} 134}
135EXPORT_SYMBOL(iwl_calib_free_results);
135 136
136/***************************************************************************** 137/*****************************************************************************
137 * RUNTIME calibrations framework 138 * RUNTIME calibrations framework
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.c b/drivers/net/wireless/iwlwifi/iwl-core.c
index addc9ad5a5c6..256c9a49fa3b 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.c
+++ b/drivers/net/wireless/iwlwifi/iwl-core.c
@@ -451,28 +451,6 @@ static void iwlcore_init_ht_hw_capab(const struct iwl_priv *priv,
451 } 451 }
452} 452}
453 453
454static void iwlcore_init_hw_rates(struct iwl_priv *priv,
455 struct ieee80211_rate *rates)
456{
457 int i;
458
459 for (i = 0; i < IWL_RATE_COUNT_LEGACY; i++) {
460 rates[i].bitrate = iwl_rates[i].ieee * 5;
461 rates[i].hw_value = i; /* Rate scaling will work on indexes */
462 rates[i].hw_value_short = i;
463 rates[i].flags = 0;
464 if ((i >= IWL_FIRST_CCK_RATE) && (i <= IWL_LAST_CCK_RATE)) {
465 /*
466 * If CCK != 1M then set short preamble rate flag.
467 */
468 rates[i].flags |=
469 (iwl_rates[i].plcp == IWL_RATE_1M_PLCP) ?
470 0 : IEEE80211_RATE_SHORT_PREAMBLE;
471 }
472 }
473}
474
475
476/** 454/**
477 * iwlcore_init_geos - Initialize mac80211's geo/channel info based from eeprom 455 * iwlcore_init_geos - Initialize mac80211's geo/channel info based from eeprom
478 */ 456 */
@@ -1571,68 +1549,6 @@ int iwl_set_hw_params(struct iwl_priv *priv)
1571} 1549}
1572EXPORT_SYMBOL(iwl_set_hw_params); 1550EXPORT_SYMBOL(iwl_set_hw_params);
1573 1551
1574int iwl_init_drv(struct iwl_priv *priv)
1575{
1576 int ret;
1577
1578 priv->ibss_beacon = NULL;
1579
1580 spin_lock_init(&priv->lock);
1581 spin_lock_init(&priv->sta_lock);
1582 spin_lock_init(&priv->hcmd_lock);
1583
1584 INIT_LIST_HEAD(&priv->free_frames);
1585
1586 mutex_init(&priv->mutex);
1587
1588 /* Clear the driver's (not device's) station table */
1589 iwl_clear_stations_table(priv);
1590
1591 priv->ieee_channels = NULL;
1592 priv->ieee_rates = NULL;
1593 priv->band = IEEE80211_BAND_2GHZ;
1594
1595 priv->iw_mode = NL80211_IFTYPE_STATION;
1596
1597 /* Choose which receivers/antennas to use */
1598 if (priv->cfg->ops->hcmd->set_rxon_chain)
1599 priv->cfg->ops->hcmd->set_rxon_chain(priv);
1600
1601 iwl_init_scan_params(priv);
1602
1603 iwl_reset_qos(priv);
1604
1605 priv->qos_data.qos_active = 0;
1606 priv->qos_data.qos_cap.val = 0;
1607
1608 priv->rates_mask = IWL_RATES_MASK;
1609 /* Set the tx_power_user_lmt to the lowest power level
1610 * this value will get overwritten by channel max power avg
1611 * from eeprom */
1612 priv->tx_power_user_lmt = IWL_TX_POWER_TARGET_POWER_MIN;
1613
1614 ret = iwl_init_channel_map(priv);
1615 if (ret) {
1616 IWL_ERR(priv, "initializing regulatory failed: %d\n", ret);
1617 goto err;
1618 }
1619
1620 ret = iwlcore_init_geos(priv);
1621 if (ret) {
1622 IWL_ERR(priv, "initializing geos failed: %d\n", ret);
1623 goto err_free_channel_map;
1624 }
1625 iwlcore_init_hw_rates(priv, priv->ieee_rates);
1626
1627 return 0;
1628
1629err_free_channel_map:
1630 iwl_free_channel_map(priv);
1631err:
1632 return ret;
1633}
1634EXPORT_SYMBOL(iwl_init_drv);
1635
1636int iwl_set_tx_power(struct iwl_priv *priv, s8 tx_power, bool force) 1552int iwl_set_tx_power(struct iwl_priv *priv, s8 tx_power, bool force)
1637{ 1553{
1638 int ret = 0; 1554 int ret = 0;
@@ -1680,15 +1596,6 @@ int iwl_set_tx_power(struct iwl_priv *priv, s8 tx_power, bool force)
1680} 1596}
1681EXPORT_SYMBOL(iwl_set_tx_power); 1597EXPORT_SYMBOL(iwl_set_tx_power);
1682 1598
1683void iwl_uninit_drv(struct iwl_priv *priv)
1684{
1685 iwl_calib_free_results(priv);
1686 iwlcore_free_geos(priv);
1687 iwl_free_channel_map(priv);
1688 kfree(priv->scan);
1689}
1690EXPORT_SYMBOL(iwl_uninit_drv);
1691
1692#define ICT_COUNT (PAGE_SIZE/sizeof(u32)) 1599#define ICT_COUNT (PAGE_SIZE/sizeof(u32))
1693 1600
1694/* Free dram table */ 1601/* Free dram table */
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.h b/drivers/net/wireless/iwlwifi/iwl-core.h
index b875dcfca2d6..ddf0998fb752 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.h
+++ b/drivers/net/wireless/iwlwifi/iwl-core.h
@@ -316,8 +316,6 @@ void iwl_configure_filter(struct ieee80211_hw *hw,
316 unsigned int *total_flags, u64 multicast); 316 unsigned int *total_flags, u64 multicast);
317int iwl_hw_nic_init(struct iwl_priv *priv); 317int iwl_hw_nic_init(struct iwl_priv *priv);
318int iwl_set_hw_params(struct iwl_priv *priv); 318int iwl_set_hw_params(struct iwl_priv *priv);
319int iwl_init_drv(struct iwl_priv *priv);
320void iwl_uninit_drv(struct iwl_priv *priv);
321bool iwl_is_monitor_mode(struct iwl_priv *priv); 319bool iwl_is_monitor_mode(struct iwl_priv *priv);
322void iwl_post_associate(struct iwl_priv *priv); 320void iwl_post_associate(struct iwl_priv *priv);
323void iwl_bss_info_changed(struct ieee80211_hw *hw, 321void iwl_bss_info_changed(struct ieee80211_hw *hw,
diff --git a/drivers/net/wireless/iwlwifi/iwl-scan.c b/drivers/net/wireless/iwlwifi/iwl-scan.c
index 4fca65a2fe9c..1eb0d0bf1fe4 100644
--- a/drivers/net/wireless/iwlwifi/iwl-scan.c
+++ b/drivers/net/wireless/iwlwifi/iwl-scan.c
@@ -401,6 +401,7 @@ void iwl_init_scan_params(struct iwl_priv *priv)
401 if (!priv->scan_tx_ant[IEEE80211_BAND_2GHZ]) 401 if (!priv->scan_tx_ant[IEEE80211_BAND_2GHZ])
402 priv->scan_tx_ant[IEEE80211_BAND_2GHZ] = ant_idx; 402 priv->scan_tx_ant[IEEE80211_BAND_2GHZ] = ant_idx;
403} 403}
404EXPORT_SYMBOL(iwl_init_scan_params);
404 405
405static int iwl_scan_initiate(struct iwl_priv *priv) 406static int iwl_scan_initiate(struct iwl_priv *priv)
406{ 407{