summaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl-pci.c
diff options
context:
space:
mode:
authorDon Fry <donald.h.fry@intel.com>2012-02-07 14:45:58 -0800
committerWey-Yi Guy <wey-yi.w.guy@intel.com>2012-02-17 10:12:03 -0800
commitb1c23d9ec3afb85bd299e4f3859dce555fd55c8a (patch)
treea161699a94caefbea117e62870b1d403bb99b911 /drivers/net/wireless/iwlwifi/iwl-pci.c
parent7b11488fbbbe06ada39a396dec16532db8c933e6 (diff)
iwlwifi: create iwl_nic structure
Create iwl_nic structure and link it together. Signed-off-by: Don Fry <donald.h.fry@intel.com> Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-pci.c')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-pci.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-pci.c b/drivers/net/wireless/iwlwifi/iwl-pci.c
index 3e2fce4ce00..51906702053 100644
--- a/drivers/net/wireless/iwlwifi/iwl-pci.c
+++ b/drivers/net/wireless/iwlwifi/iwl-pci.c
@@ -70,6 +70,7 @@
#include "iwl-trans.h"
#include "iwl-csr.h"
#include "iwl-cfg.h"
+#include "iwl-wifi.h"
#define IWL_PCI_DEVICE(dev, subdev, cfg) \
.vendor = PCI_VENDOR_ID_INTEL, .device = (dev), \
@@ -282,13 +283,23 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
bus->shrd->bus = bus;
+ /* temporarily create this here */
+ bus->shrd->nic = kzalloc(sizeof(*bus->shrd->nic), GFP_KERNEL);
+ if (!bus->shrd->nic) {
+ dev_printk(KERN_ERR, &pdev->dev,
+ "Couldn't allocate iwl_nic");
+ err = -ENOMEM;
+ goto out_free_bus;
+ }
+ /* and initialize it as well, temporarily */
+ bus->shrd->nic->shrd = bus->shrd;
pci_set_drvdata(pdev, bus);
#ifdef CONFIG_IWLWIFI_IDI
trans(bus) = iwl_trans_idi_alloc(bus->shrd, pdev, ent);
if (trans(bus) == NULL) {
err = -ENOMEM;
- goto out_free_bus;
+ goto out_free_nic;
}
err = iwl_probe(bus, &trans_ops_idi, cfg);
@@ -296,7 +307,7 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
trans(bus) = iwl_trans_pcie_alloc(bus->shrd, pdev, ent);
if (trans(bus) == NULL) {
err = -ENOMEM;
- goto out_free_bus;
+ goto out_free_nic;
}
err = iwl_probe(bus, &trans_ops_pcie, cfg);
@@ -309,6 +320,8 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
out_free_trans:
iwl_trans_free(trans(bus));
pci_set_drvdata(pdev, NULL);
+out_free_nic:
+ kfree(bus->shrd->nic);
out_free_bus:
kfree(bus->shrd);
kfree(bus);
@@ -325,6 +338,7 @@ static void __devexit iwl_pci_remove(struct pci_dev *pdev)
pci_set_drvdata(pdev, NULL);
+ kfree(bus->shrd->nic);
kfree(bus->shrd);
kfree(bus);
}