iwlwifi: allocate the transport from the bus layer

Change the way we alloc the transport on the way.
Since the transport is allocated from a bus specific area, we can
give the bus specific parameters (i.e. pci_dev for PCI) to the
transport. This will be useful when the bus layer will be killed.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
diff --git a/drivers/net/wireless/iwlwifi/iwl-pci.c b/drivers/net/wireless/iwlwifi/iwl-pci.c
index a3ca0a7..c0d62e7 100644
--- a/drivers/net/wireless/iwlwifi/iwl-pci.c
+++ b/drivers/net/wireless/iwlwifi/iwl-pci.c
@@ -463,14 +463,28 @@
 	bus->ops = &bus_ops_pci;
 
 #ifdef CONFIG_IWLWIFI_IDI
+	trans(bus) = iwl_trans_idi_alloc(bus->shrd, pdev, ent);
+	if (trans(bus) == NULL) {
+		err = -ENOMEM;
+		goto out_disable_msi;
+	}
+
 	err = iwl_probe(bus, &trans_ops_idi, cfg);
 #else
+	trans(bus) = iwl_trans_pcie_alloc(bus->shrd, pdev, ent);
+	if (trans(bus) == NULL) {
+		err = -ENOMEM;
+		goto out_disable_msi;
+	}
+
 	err = iwl_probe(bus, &trans_ops_pcie, cfg);
 #endif
 	if (err)
-		goto out_disable_msi;
+		goto out_free_trans;
 	return 0;
 
+out_free_trans:
+	iwl_trans_free(trans(bus));
 out_disable_msi:
 	pci_disable_msi(pdev);
 	pci_iounmap(pdev, pci_bus->hw_base);
@@ -493,6 +507,7 @@
 	struct iwl_shared *shrd = bus->shrd;
 
 	iwl_remove(shrd->priv);
+	iwl_trans_free(shrd->trans);
 
 	pci_disable_msi(pci_dev);
 	pci_iounmap(pci_dev, pci_bus->hw_base);