iwlwifi: move the shrd memory from priv
authorEmmanuel Grumbach <emmanuel.grumbach@intel.com>
Thu, 2 Feb 2012 22:08:57 +0000 (14:08 -0800)
committerWey-Yi Guy <wey-yi.w.guy@intel.com>
Thu, 2 Feb 2012 22:15:33 +0000 (14:15 -0800)
Allocating the shrd area dynamically will allow more agility
while revamping the flows.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
drivers/net/wireless/iwlwifi/iwl-agn.c
drivers/net/wireless/iwlwifi/iwl-dev.h
drivers/net/wireless/iwlwifi/iwl-pci.c

index f3bd6a3eec3846019e01146fe2e291d084ad5f11..b42be3084507dec06f3df5f3a18734169287da45 100644 (file)
@@ -1780,9 +1780,7 @@ int iwl_probe(struct iwl_bus *bus, const struct iwl_trans_ops *trans_ops,
        }
 
        priv = hw->priv;
-       priv->shrd = &priv->_shrd;
-       bus->shrd = priv->shrd;
-       priv->shrd->bus = bus;
+       priv->shrd = bus->shrd;
        priv->shrd->priv = priv;
 
        priv->shrd->trans = trans_ops->alloc(priv->shrd);
index af846002150ab162addd11bc5a0a94628f99a601..fff5b620927bfc728bfe41846e07d1cbe147e6eb 100644 (file)
@@ -821,7 +821,6 @@ struct iwl_wipan_noa_data {
 struct iwl_priv {
 
        /*data shared among all the driver's layers */
-       struct iwl_shared _shrd;
        struct iwl_shared *shrd;
 
        /* ieee device used by generic ieee processing code */
index 2c46063522c988898f513828cf2f1fb3ad30ba19..a3ca0a78336f3caefc8e2bce0abbd5dfaefda77c 100644 (file)
@@ -374,10 +374,18 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
        if (!bus) {
                dev_printk(KERN_ERR, &pdev->dev,
                           "Couldn't allocate iwl_pci_bus");
+               return -ENOMEM;
+       }
+
+       bus->shrd = kzalloc(sizeof(*bus->shrd), GFP_KERNEL);
+       if (!bus->shrd) {
+               dev_printk(KERN_ERR, &pdev->dev,
+                          "Couldn't allocate iwl_shared");
                err = -ENOMEM;
                goto out_no_pci;
        }
 
+       bus->shrd->bus = bus;
        pci_bus = IWL_BUS_GET_PCI_BUS(bus);
        pci_bus->pci_dev = pdev;
 
@@ -472,6 +480,7 @@ out_pci_release_regions:
 out_pci_disable_device:
        pci_disable_device(pdev);
 out_no_pci:
+       kfree(bus->shrd);
        kfree(bus);
        return err;
 }
@@ -491,6 +500,7 @@ static void __devexit iwl_pci_remove(struct pci_dev *pdev)
        pci_disable_device(pci_dev);
        pci_set_drvdata(pci_dev, NULL);
 
+       kfree(bus->shrd);
        kfree(bus);
 }