Commit 1d0a082d authored by Assaf Krauss's avatar Assaf Krauss Committed by John W. Linville

iwlwifi: Probe Flow - Performing allocation in a separate function

Performing allocation in a separate function (previously handled in
'probe')
Signed-off-by: default avatarAssaf Krauss <assaf.krauss@intel.com>
Signed-off-by: default avatarTomas Winkler <tomas.winkler@intel.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 00acbc91
...@@ -29,12 +29,15 @@ ...@@ -29,12 +29,15 @@
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/version.h> #include <linux/version.h>
#include <net/mac80211.h>
struct iwl_priv; /* FIXME: remove */ struct iwl_priv; /* FIXME: remove */
#include "iwl-debug.h" #include "iwl-debug.h"
#include "iwl-eeprom.h" #include "iwl-eeprom.h"
#include "iwl-core.h" #include "iwl-core.h"
#include "iwl-4965.h" /* FIXME: remove */
MODULE_DESCRIPTION("iwl core"); MODULE_DESCRIPTION("iwl core");
MODULE_VERSION(IWLWIFI_VERSION); MODULE_VERSION(IWLWIFI_VERSION);
MODULE_AUTHOR(DRV_COPYRIGHT); MODULE_AUTHOR(DRV_COPYRIGHT);
...@@ -44,3 +47,27 @@ MODULE_LICENSE("GPL"); ...@@ -44,3 +47,27 @@ MODULE_LICENSE("GPL");
u32 iwl_debug_level; u32 iwl_debug_level;
EXPORT_SYMBOL(iwl_debug_level); EXPORT_SYMBOL(iwl_debug_level);
#endif #endif
/* This function both allocates and initializes hw and priv. */
struct ieee80211_hw *iwl_alloc_all(struct iwl_cfg *cfg,
struct ieee80211_ops *hw_ops)
{
struct iwl_priv *priv;
/* mac80211 allocates memory for this device instance, including
* space for this driver's private structure */
struct ieee80211_hw *hw =
ieee80211_alloc_hw(sizeof(struct iwl_priv), hw_ops);
if (hw == NULL) {
IWL_ERROR("Can not allocate network device\n");
goto out;
}
priv = hw->priv;
priv->hw = hw;
out:
return hw;
}
EXPORT_SYMBOL(iwl_alloc_all);
...@@ -103,4 +103,11 @@ struct iwl_cfg { ...@@ -103,4 +103,11 @@ struct iwl_cfg {
const struct iwl_mod_params *mod_params; const struct iwl_mod_params *mod_params;
}; };
/***************************
* L i b *
***************************/
struct ieee80211_hw *iwl_alloc_all(struct iwl_cfg *cfg,
struct ieee80211_ops *hw_ops);
#endif /* __iwl_core_h__ */ #endif /* __iwl_core_h__ */
...@@ -8531,21 +8531,18 @@ static int iwl4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e ...@@ -8531,21 +8531,18 @@ static int iwl4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e
iwl4965_hw_ops.hw_scan = NULL; iwl4965_hw_ops.hw_scan = NULL;
} }
/* mac80211 allocates memory for this device instance, including hw = iwl_alloc_all(cfg, &iwl4965_hw_ops);
* space for this driver's private structure */ if (!hw) {
hw = ieee80211_alloc_hw(sizeof(struct iwl_priv), &iwl4965_hw_ops);
if (hw == NULL) {
IWL_ERROR("Can not allocate network device\n");
err = -ENOMEM; err = -ENOMEM;
goto out; goto out;
} }
priv = hw->priv;
/* At this point both hw and priv are allocated. */
SET_IEEE80211_DEV(hw, &pdev->dev); SET_IEEE80211_DEV(hw, &pdev->dev);
IWL_DEBUG_INFO("*** LOAD DRIVER ***\n"); IWL_DEBUG_INFO("*** LOAD DRIVER ***\n");
priv = hw->priv;
priv->hw = hw;
priv->cfg = cfg; priv->cfg = cfg;
priv->pci_dev = pdev; priv->pci_dev = pdev;
#ifdef CONFIG_IWLWIFI_DEBUG #ifdef CONFIG_IWLWIFI_DEBUG
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment