diff options
author | Assaf Krauss <assaf.krauss@intel.com> | 2008-03-14 13:38:48 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-03-25 16:41:51 -0400 |
commit | 1d0a082d38decb62ceb3e26a4bb1a3ca78843a23 (patch) | |
tree | 4563baeb92331e953803a151f84abbdaac204481 /drivers/net/wireless | |
parent | 00acbc91354f7c548ce12a9ebb7fd25c4c3861ae (diff) |
iwlwifi: Probe Flow - Performing allocation in a separate function
Performing allocation in a separate function (previously handled in
'probe')
Signed-off-by: Assaf Krauss <assaf.krauss@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-core.c | 27 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-core.h | 7 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl4965-base.c | 13 |
3 files changed, 39 insertions, 8 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.c b/drivers/net/wireless/iwlwifi/iwl-core.c index 3a9fc905e6bc..244318af53fc 100644 --- a/drivers/net/wireless/iwlwifi/iwl-core.c +++ b/drivers/net/wireless/iwlwifi/iwl-core.c | |||
@@ -29,12 +29,15 @@ | |||
29 | #include <linux/kernel.h> | 29 | #include <linux/kernel.h> |
30 | #include <linux/module.h> | 30 | #include <linux/module.h> |
31 | #include <linux/version.h> | 31 | #include <linux/version.h> |
32 | #include <net/mac80211.h> | ||
32 | 33 | ||
33 | struct iwl_priv; /* FIXME: remove */ | 34 | struct iwl_priv; /* FIXME: remove */ |
34 | #include "iwl-debug.h" | 35 | #include "iwl-debug.h" |
35 | #include "iwl-eeprom.h" | 36 | #include "iwl-eeprom.h" |
36 | #include "iwl-core.h" | 37 | #include "iwl-core.h" |
37 | 38 | ||
39 | #include "iwl-4965.h" /* FIXME: remove */ | ||
40 | |||
38 | MODULE_DESCRIPTION("iwl core"); | 41 | MODULE_DESCRIPTION("iwl core"); |
39 | MODULE_VERSION(IWLWIFI_VERSION); | 42 | MODULE_VERSION(IWLWIFI_VERSION); |
40 | MODULE_AUTHOR(DRV_COPYRIGHT); | 43 | MODULE_AUTHOR(DRV_COPYRIGHT); |
@@ -44,3 +47,27 @@ MODULE_LICENSE("GPL"); | |||
44 | u32 iwl_debug_level; | 47 | u32 iwl_debug_level; |
45 | EXPORT_SYMBOL(iwl_debug_level); | 48 | EXPORT_SYMBOL(iwl_debug_level); |
46 | #endif | 49 | #endif |
50 | |||
51 | /* This function both allocates and initializes hw and priv. */ | ||
52 | struct ieee80211_hw *iwl_alloc_all(struct iwl_cfg *cfg, | ||
53 | struct ieee80211_ops *hw_ops) | ||
54 | { | ||
55 | struct iwl_priv *priv; | ||
56 | |||
57 | /* mac80211 allocates memory for this device instance, including | ||
58 | * space for this driver's private structure */ | ||
59 | struct ieee80211_hw *hw = | ||
60 | ieee80211_alloc_hw(sizeof(struct iwl_priv), hw_ops); | ||
61 | if (hw == NULL) { | ||
62 | IWL_ERROR("Can not allocate network device\n"); | ||
63 | goto out; | ||
64 | } | ||
65 | |||
66 | priv = hw->priv; | ||
67 | priv->hw = hw; | ||
68 | |||
69 | out: | ||
70 | return hw; | ||
71 | } | ||
72 | EXPORT_SYMBOL(iwl_alloc_all); | ||
73 | |||
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.h b/drivers/net/wireless/iwlwifi/iwl-core.h index fb4ce081807b..33bef1fecf4d 100644 --- a/drivers/net/wireless/iwlwifi/iwl-core.h +++ b/drivers/net/wireless/iwlwifi/iwl-core.h | |||
@@ -103,4 +103,11 @@ struct iwl_cfg { | |||
103 | const struct iwl_mod_params *mod_params; | 103 | const struct iwl_mod_params *mod_params; |
104 | }; | 104 | }; |
105 | 105 | ||
106 | /*************************** | ||
107 | * L i b * | ||
108 | ***************************/ | ||
109 | |||
110 | struct ieee80211_hw *iwl_alloc_all(struct iwl_cfg *cfg, | ||
111 | struct ieee80211_ops *hw_ops); | ||
112 | |||
106 | #endif /* __iwl_core_h__ */ | 113 | #endif /* __iwl_core_h__ */ |
diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c index 465918cf77f1..a8fa1bfa570b 100644 --- a/drivers/net/wireless/iwlwifi/iwl4965-base.c +++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c | |||
@@ -8531,21 +8531,18 @@ static int iwl4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e | |||
8531 | iwl4965_hw_ops.hw_scan = NULL; | 8531 | iwl4965_hw_ops.hw_scan = NULL; |
8532 | } | 8532 | } |
8533 | 8533 | ||
8534 | /* mac80211 allocates memory for this device instance, including | 8534 | hw = iwl_alloc_all(cfg, &iwl4965_hw_ops); |
8535 | * space for this driver's private structure */ | 8535 | if (!hw) { |
8536 | hw = ieee80211_alloc_hw(sizeof(struct iwl_priv), &iwl4965_hw_ops); | ||
8537 | if (hw == NULL) { | ||
8538 | IWL_ERROR("Can not allocate network device\n"); | ||
8539 | err = -ENOMEM; | 8536 | err = -ENOMEM; |
8540 | goto out; | 8537 | goto out; |
8541 | } | 8538 | } |
8539 | priv = hw->priv; | ||
8540 | /* At this point both hw and priv are allocated. */ | ||
8541 | |||
8542 | SET_IEEE80211_DEV(hw, &pdev->dev); | 8542 | SET_IEEE80211_DEV(hw, &pdev->dev); |
8543 | 8543 | ||
8544 | IWL_DEBUG_INFO("*** LOAD DRIVER ***\n"); | 8544 | IWL_DEBUG_INFO("*** LOAD DRIVER ***\n"); |
8545 | priv = hw->priv; | ||
8546 | priv->hw = hw; | ||
8547 | priv->cfg = cfg; | 8545 | priv->cfg = cfg; |
8548 | |||
8549 | priv->pci_dev = pdev; | 8546 | priv->pci_dev = pdev; |
8550 | 8547 | ||
8551 | #ifdef CONFIG_IWLWIFI_DEBUG | 8548 | #ifdef CONFIG_IWLWIFI_DEBUG |