Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 90302
b: refs/heads/master
c: 1d0a082
h: refs/heads/master
v: v3
  • Loading branch information
Assaf Krauss authored and John W. Linville committed Mar 25, 2008
1 parent e2f34c5 commit b78b8e6
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 9 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 00acbc91354f7c548ce12a9ebb7fd25c4c3861ae
refs/heads/master: 1d0a082d38decb62ceb3e26a4bb1a3ca78843a23
27 changes: 27 additions & 0 deletions trunk/drivers/net/wireless/iwlwifi/iwl-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,15 @@
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/version.h>
#include <net/mac80211.h>

struct iwl_priv; /* FIXME: remove */
#include "iwl-debug.h"
#include "iwl-eeprom.h"
#include "iwl-core.h"

#include "iwl-4965.h" /* FIXME: remove */

MODULE_DESCRIPTION("iwl core");
MODULE_VERSION(IWLWIFI_VERSION);
MODULE_AUTHOR(DRV_COPYRIGHT);
Expand All @@ -44,3 +47,27 @@ MODULE_LICENSE("GPL");
u32 iwl_debug_level;
EXPORT_SYMBOL(iwl_debug_level);
#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);

7 changes: 7 additions & 0 deletions trunk/drivers/net/wireless/iwlwifi/iwl-core.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,4 +103,11 @@ struct iwl_cfg {
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__ */
13 changes: 5 additions & 8 deletions trunk/drivers/net/wireless/iwlwifi/iwl4965-base.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

/* mac80211 allocates memory for this device instance, including
* space for this driver's private structure */
hw = ieee80211_alloc_hw(sizeof(struct iwl_priv), &iwl4965_hw_ops);
if (hw == NULL) {
IWL_ERROR("Can not allocate network device\n");
hw = iwl_alloc_all(cfg, &iwl4965_hw_ops);
if (!hw) {
err = -ENOMEM;
goto out;
}
priv = hw->priv;
/* At this point both hw and priv are allocated. */

SET_IEEE80211_DEV(hw, &pdev->dev);

IWL_DEBUG_INFO("*** LOAD DRIVER ***\n");
priv = hw->priv;
priv->hw = hw;
priv->cfg = cfg;

priv->pci_dev = pdev;

#ifdef CONFIG_IWLWIFI_DEBUG
Expand Down

0 comments on commit b78b8e6

Please sign in to comment.