diff options
author | Emmanuel Grumbach <emmanuel.grumbach@intel.com> | 2011-05-31 08:22:30 +0300 |
---|---|---|
committer | Wey-Yi Guy <wey-yi.w.guy@intel.com> | 2011-06-18 08:05:52 -0700 |
commit | a48709c5d076aa3a3f9b6426f462abe6bf432b11 (patch) | |
tree | a6da050f84ff8b9d3ac366387b4a9c8fb412215b /drivers/net/wireless/iwlwifi/iwl-agn.c | |
parent | c6ca8bc46cc320e31e8fcb8b104eeed044febd6f (diff) | |
download | op-kernel-dev-a48709c5d076aa3a3f9b6426f462abe6bf432b11.zip op-kernel-dev-a48709c5d076aa3a3f9b6426f462abe6bf432b11.tar.gz |
iwlagn: introduce iwl_bus and iwl_bus_ops
iwl_bus will represent a bus, and iwl_bus_ops all the operations that can be
done on this bus.
For the moment only set_prv_data is implemented. More to come...
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-agn.c')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-agn.c | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c index d5eeb3e..1eeb4a7 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn.c @@ -3479,7 +3479,8 @@ static void iwl_init_context(struct iwl_priv *priv) BUILD_BUG_ON(NUM_IWL_RXON_CTX != 2); } -int iwl_probe(struct pci_dev *pdev, struct iwl_cfg *cfg) +int iwl_probe(void *bus_specific, struct iwl_bus_ops *bus_ops, + struct iwl_cfg *cfg) { int err = 0; struct iwl_priv *priv; @@ -3490,12 +3491,23 @@ int iwl_probe(struct pci_dev *pdev, struct iwl_cfg *cfg) /************************ * 1. Allocating HW data ************************/ + /* TODO: remove this nasty hack when PCI encapsulation is done + * assumes that struct pci_dev * is at the very beginning of whatever + * is pointed by bus_specific */ + unsigned long *ppdev = bus_specific; + struct pci_dev *pdev = (struct pci_dev *) *ppdev; hw = iwl_alloc_all(cfg); if (!hw) { err = -ENOMEM; goto out; } priv = hw->priv; + + priv->bus.priv = priv; + priv->bus.bus_specific = bus_specific; + priv->bus.ops = bus_ops; + priv->bus.ops->set_drv_data(&priv->bus, priv); + /* At this point both hw and priv are allocated. */ SET_IEEE80211_DEV(hw, &pdev->dev); @@ -3549,9 +3561,6 @@ int iwl_probe(struct pci_dev *pdev, struct iwl_cfg *cfg) if (err) goto out_pci_disable_device; - pci_set_drvdata(pdev, priv); - - /*********************** * 3. Read REV register ***********************/ @@ -3705,7 +3714,7 @@ int iwl_probe(struct pci_dev *pdev, struct iwl_cfg *cfg) out_iounmap: pci_iounmap(pdev, priv->hw_base); out_pci_release_regions: - pci_set_drvdata(pdev, NULL); + priv->bus.ops->set_drv_data(&priv->bus, NULL); pci_release_regions(pdev); out_pci_disable_device: pci_disable_device(pdev); @@ -3716,14 +3725,11 @@ int iwl_probe(struct pci_dev *pdev, struct iwl_cfg *cfg) return err; } -void __devexit iwl_remove(struct pci_dev *pdev) +void __devexit iwl_remove(struct iwl_priv * priv) { - struct iwl_priv *priv = pci_get_drvdata(pdev); + struct pci_dev *pdev = priv->pci_dev; unsigned long flags; - if (!priv) - return; - wait_for_completion(&priv->_agn.firmware_loading_complete); IWL_DEBUG_INFO(priv, "*** UNLOAD DRIVER ***\n"); @@ -3783,7 +3789,7 @@ void __devexit iwl_remove(struct pci_dev *pdev) pci_iounmap(pdev, priv->hw_base); pci_release_regions(pdev); pci_disable_device(pdev); - pci_set_drvdata(pdev, NULL); + priv->bus.ops->set_drv_data(&priv->bus, NULL); iwl_uninit_drv(priv); |