diff options
author | Tomas Winkler <tomas.winkler@intel.com> | 2008-05-15 01:54:17 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-05-21 21:48:06 -0400 |
commit | 6ba879562289bcad537a2374754ef750307c7d32 (patch) | |
tree | cdfe183883a2ab093419dd7c6544ea76877f3572 /drivers/net/wireless/iwlwifi/iwl-core.c | |
parent | 445c2dff409ef9de5d2f964d20917ab238fd266f (diff) |
iwlwifi: refactor pci prob flow
This patch refactores pci prob flow. It moves mac80211 registration
to the end, otherwise there is a race between error path in pci_probe
and mac_start.
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-core.c')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-core.c | 61 |
1 files changed, 33 insertions, 28 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.c b/drivers/net/wireless/iwlwifi/iwl-core.c index 79e46c5a35a..21f481ef1ce 100644 --- a/drivers/net/wireless/iwlwifi/iwl-core.c +++ b/drivers/net/wireless/iwlwifi/iwl-core.c | |||
@@ -518,12 +518,6 @@ static int iwlcore_init_geos(struct iwl_priv *priv) | |||
518 | priv->bands[IEEE80211_BAND_2GHZ].n_channels, | 518 | priv->bands[IEEE80211_BAND_2GHZ].n_channels, |
519 | priv->bands[IEEE80211_BAND_5GHZ].n_channels); | 519 | priv->bands[IEEE80211_BAND_5GHZ].n_channels); |
520 | 520 | ||
521 | if (priv->bands[IEEE80211_BAND_2GHZ].n_channels) | ||
522 | priv->hw->wiphy->bands[IEEE80211_BAND_2GHZ] = | ||
523 | &priv->bands[IEEE80211_BAND_2GHZ]; | ||
524 | if (priv->bands[IEEE80211_BAND_5GHZ].n_channels) | ||
525 | priv->hw->wiphy->bands[IEEE80211_BAND_5GHZ] = | ||
526 | &priv->bands[IEEE80211_BAND_5GHZ]; | ||
527 | 521 | ||
528 | set_bit(STATUS_GEO_CONFIGURED, &priv->status); | 522 | set_bit(STATUS_GEO_CONFIGURED, &priv->status); |
529 | 523 | ||
@@ -533,13 +527,12 @@ static int iwlcore_init_geos(struct iwl_priv *priv) | |||
533 | /* | 527 | /* |
534 | * iwlcore_free_geos - undo allocations in iwlcore_init_geos | 528 | * iwlcore_free_geos - undo allocations in iwlcore_init_geos |
535 | */ | 529 | */ |
536 | void iwlcore_free_geos(struct iwl_priv *priv) | 530 | static void iwlcore_free_geos(struct iwl_priv *priv) |
537 | { | 531 | { |
538 | kfree(priv->ieee_channels); | 532 | kfree(priv->ieee_channels); |
539 | kfree(priv->ieee_rates); | 533 | kfree(priv->ieee_rates); |
540 | clear_bit(STATUS_GEO_CONFIGURED, &priv->status); | 534 | clear_bit(STATUS_GEO_CONFIGURED, &priv->status); |
541 | } | 535 | } |
542 | EXPORT_SYMBOL(iwlcore_free_geos); | ||
543 | 536 | ||
544 | #ifdef CONFIG_IWL4965_HT | 537 | #ifdef CONFIG_IWL4965_HT |
545 | static u8 is_single_rx_stream(struct iwl_priv *priv) | 538 | static u8 is_single_rx_stream(struct iwl_priv *priv) |
@@ -767,8 +760,9 @@ int iwl_set_rxon_channel(struct iwl_priv *priv, | |||
767 | } | 760 | } |
768 | EXPORT_SYMBOL(iwl_set_rxon_channel); | 761 | EXPORT_SYMBOL(iwl_set_rxon_channel); |
769 | 762 | ||
770 | static void iwlcore_init_hw(struct iwl_priv *priv) | 763 | int iwl_setup_mac(struct iwl_priv *priv) |
771 | { | 764 | { |
765 | int ret; | ||
772 | struct ieee80211_hw *hw = priv->hw; | 766 | struct ieee80211_hw *hw = priv->hw; |
773 | hw->rate_control_algorithm = "iwl-4965-rs"; | 767 | hw->rate_control_algorithm = "iwl-4965-rs"; |
774 | 768 | ||
@@ -782,9 +776,29 @@ static void iwlcore_init_hw(struct iwl_priv *priv) | |||
782 | /* Enhanced value; more queues, to support 11n aggregation */ | 776 | /* Enhanced value; more queues, to support 11n aggregation */ |
783 | hw->ampdu_queues = 12; | 777 | hw->ampdu_queues = 12; |
784 | #endif /* CONFIG_IWL4965_HT */ | 778 | #endif /* CONFIG_IWL4965_HT */ |
779 | |||
780 | hw->conf.beacon_int = 100; | ||
781 | |||
782 | if (priv->bands[IEEE80211_BAND_2GHZ].n_channels) | ||
783 | priv->hw->wiphy->bands[IEEE80211_BAND_2GHZ] = | ||
784 | &priv->bands[IEEE80211_BAND_2GHZ]; | ||
785 | if (priv->bands[IEEE80211_BAND_5GHZ].n_channels) | ||
786 | priv->hw->wiphy->bands[IEEE80211_BAND_5GHZ] = | ||
787 | &priv->bands[IEEE80211_BAND_5GHZ]; | ||
788 | |||
789 | ret = ieee80211_register_hw(priv->hw); | ||
790 | if (ret) { | ||
791 | IWL_ERROR("Failed to register hw (error %d)\n", ret); | ||
792 | return ret; | ||
793 | } | ||
794 | priv->mac80211_registered = 1; | ||
795 | |||
796 | return 0; | ||
785 | } | 797 | } |
798 | EXPORT_SYMBOL(iwl_setup_mac); | ||
799 | |||
786 | 800 | ||
787 | static int iwlcore_init_drv(struct iwl_priv *priv) | 801 | int iwl_init_drv(struct iwl_priv *priv) |
788 | { | 802 | { |
789 | int ret; | 803 | int ret; |
790 | int i; | 804 | int i; |
@@ -821,6 +835,9 @@ static int iwlcore_init_drv(struct iwl_priv *priv) | |||
821 | /* Choose which receivers/antennas to use */ | 835 | /* Choose which receivers/antennas to use */ |
822 | iwl_set_rxon_chain(priv); | 836 | iwl_set_rxon_chain(priv); |
823 | 837 | ||
838 | if (priv->cfg->mod_params->enable_qos) | ||
839 | priv->qos_data.qos_enable = 1; | ||
840 | |||
824 | iwl_reset_qos(priv); | 841 | iwl_reset_qos(priv); |
825 | 842 | ||
826 | priv->qos_data.qos_active = 0; | 843 | priv->qos_data.qos_active = 0; |
@@ -845,34 +862,22 @@ static int iwlcore_init_drv(struct iwl_priv *priv) | |||
845 | goto err_free_channel_map; | 862 | goto err_free_channel_map; |
846 | } | 863 | } |
847 | 864 | ||
848 | ret = ieee80211_register_hw(priv->hw); | ||
849 | if (ret) { | ||
850 | IWL_ERROR("Failed to register network device (error %d)\n", | ||
851 | ret); | ||
852 | goto err_free_geos; | ||
853 | } | ||
854 | |||
855 | priv->hw->conf.beacon_int = 100; | ||
856 | priv->mac80211_registered = 1; | ||
857 | |||
858 | return 0; | 865 | return 0; |
859 | 866 | ||
860 | err_free_geos: | ||
861 | iwlcore_free_geos(priv); | ||
862 | err_free_channel_map: | 867 | err_free_channel_map: |
863 | iwl_free_channel_map(priv); | 868 | iwl_free_channel_map(priv); |
864 | err: | 869 | err: |
865 | return ret; | 870 | return ret; |
866 | } | 871 | } |
872 | EXPORT_SYMBOL(iwl_init_drv); | ||
873 | |||
867 | 874 | ||
868 | int iwl_setup(struct iwl_priv *priv) | 875 | void iwl_uninit_drv(struct iwl_priv *priv) |
869 | { | 876 | { |
870 | int ret = 0; | 877 | iwlcore_free_geos(priv); |
871 | iwlcore_init_hw(priv); | 878 | iwl_free_channel_map(priv); |
872 | ret = iwlcore_init_drv(priv); | ||
873 | return ret; | ||
874 | } | 879 | } |
875 | EXPORT_SYMBOL(iwl_setup); | 880 | EXPORT_SYMBOL(iwl_uninit_drv); |
876 | 881 | ||
877 | /* Low level driver call this function to update iwlcore with | 882 | /* Low level driver call this function to update iwlcore with |
878 | * driver status. | 883 | * driver status. |