diff options
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-pci.c')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-pci.c | 60 |
1 files changed, 27 insertions, 33 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-pci.c b/drivers/net/wireless/iwlwifi/iwl-pci.c index 754001581340..0c8a1c2d8847 100644 --- a/drivers/net/wireless/iwlwifi/iwl-pci.c +++ b/drivers/net/wireless/iwlwifi/iwl-pci.c | |||
@@ -67,11 +67,11 @@ | |||
67 | #include <linux/pci.h> | 67 | #include <linux/pci.h> |
68 | #include <linux/pci-aspm.h> | 68 | #include <linux/pci-aspm.h> |
69 | 69 | ||
70 | #include "iwl-shared.h" | ||
71 | #include "iwl-trans.h" | 70 | #include "iwl-trans.h" |
72 | #include "iwl-cfg.h" | 71 | #include "iwl-cfg.h" |
73 | #include "iwl-drv.h" | 72 | #include "iwl-drv.h" |
74 | #include "iwl-trans.h" | 73 | #include "iwl-trans.h" |
74 | #include "iwl-trans-pcie-int.h" | ||
75 | 75 | ||
76 | #define IWL_PCI_DEVICE(dev, subdev, cfg) \ | 76 | #define IWL_PCI_DEVICE(dev, subdev, cfg) \ |
77 | .vendor = PCI_VENDOR_ID_INTEL, .device = (dev), \ | 77 | .vendor = PCI_VENDOR_ID_INTEL, .device = (dev), \ |
@@ -262,61 +262,46 @@ MODULE_DEVICE_TABLE(pci, iwl_hw_card_ids); | |||
262 | /* PCI registers */ | 262 | /* PCI registers */ |
263 | #define PCI_CFG_RETRY_TIMEOUT 0x041 | 263 | #define PCI_CFG_RETRY_TIMEOUT 0x041 |
264 | 264 | ||
265 | #ifndef CONFIG_IWLWIFI_IDI | ||
266 | |||
265 | static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | 267 | static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) |
266 | { | 268 | { |
267 | const struct iwl_cfg *cfg = (struct iwl_cfg *)(ent->driver_data); | 269 | const struct iwl_cfg *cfg = (struct iwl_cfg *)(ent->driver_data); |
268 | struct iwl_shared *shrd; | ||
269 | struct iwl_trans *iwl_trans; | 270 | struct iwl_trans *iwl_trans; |
270 | int err; | 271 | struct iwl_trans_pcie *trans_pcie; |
271 | |||
272 | shrd = kzalloc(sizeof(*iwl_trans->shrd), GFP_KERNEL); | ||
273 | if (!shrd) { | ||
274 | dev_printk(KERN_ERR, &pdev->dev, | ||
275 | "Couldn't allocate iwl_shared"); | ||
276 | err = -ENOMEM; | ||
277 | goto out_free_bus; | ||
278 | } | ||
279 | 272 | ||
280 | #ifdef CONFIG_IWLWIFI_IDI | 273 | iwl_trans = iwl_trans_pcie_alloc(pdev, ent, cfg); |
281 | iwl_trans = iwl_trans_idi_alloc(shrd, pdev, ent); | 274 | if (iwl_trans == NULL) |
282 | #else | 275 | return -ENOMEM; |
283 | iwl_trans = iwl_trans_pcie_alloc(shrd, pdev, ent); | ||
284 | #endif | ||
285 | if (iwl_trans == NULL) { | ||
286 | err = -ENOMEM; | ||
287 | goto out_free_bus; | ||
288 | } | ||
289 | 276 | ||
290 | shrd->trans = iwl_trans; | ||
291 | pci_set_drvdata(pdev, iwl_trans); | 277 | pci_set_drvdata(pdev, iwl_trans); |
292 | 278 | ||
293 | err = iwl_drv_start(shrd, iwl_trans, cfg); | 279 | trans_pcie = IWL_TRANS_GET_PCIE_TRANS(iwl_trans); |
294 | if (err) | 280 | trans_pcie->drv = iwl_drv_start(iwl_trans, cfg); |
281 | if (!trans_pcie->drv) | ||
295 | goto out_free_trans; | 282 | goto out_free_trans; |
296 | 283 | ||
297 | return 0; | 284 | return 0; |
298 | 285 | ||
299 | out_free_trans: | 286 | out_free_trans: |
300 | iwl_trans_free(iwl_trans); | 287 | iwl_trans_pcie_free(iwl_trans); |
301 | pci_set_drvdata(pdev, NULL); | 288 | pci_set_drvdata(pdev, NULL); |
302 | out_free_bus: | 289 | return -EFAULT; |
303 | kfree(shrd); | ||
304 | return err; | ||
305 | } | 290 | } |
306 | 291 | ||
307 | static void __devexit iwl_pci_remove(struct pci_dev *pdev) | 292 | static void __devexit iwl_pci_remove(struct pci_dev *pdev) |
308 | { | 293 | { |
309 | struct iwl_trans *iwl_trans = pci_get_drvdata(pdev); | 294 | struct iwl_trans *trans = pci_get_drvdata(pdev); |
310 | struct iwl_shared *shrd = iwl_trans->shrd; | 295 | struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); |
311 | 296 | ||
312 | iwl_drv_stop(shrd); | 297 | iwl_drv_stop(trans_pcie->drv); |
313 | iwl_trans_free(shrd->trans); | 298 | iwl_trans_pcie_free(trans); |
314 | 299 | ||
315 | pci_set_drvdata(pdev, NULL); | 300 | pci_set_drvdata(pdev, NULL); |
316 | |||
317 | kfree(shrd); | ||
318 | } | 301 | } |
319 | 302 | ||
303 | #endif /* CONFIG_IWLWIFI_IDI */ | ||
304 | |||
320 | #ifdef CONFIG_PM_SLEEP | 305 | #ifdef CONFIG_PM_SLEEP |
321 | 306 | ||
322 | static int iwl_pci_suspend(struct device *device) | 307 | static int iwl_pci_suspend(struct device *device) |
@@ -361,6 +346,15 @@ static SIMPLE_DEV_PM_OPS(iwl_dev_pm_ops, iwl_pci_suspend, iwl_pci_resume); | |||
361 | 346 | ||
362 | #endif | 347 | #endif |
363 | 348 | ||
349 | #ifdef CONFIG_IWLWIFI_IDI | ||
350 | /* | ||
351 | * Defined externally in iwl-idi.c | ||
352 | */ | ||
353 | int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent); | ||
354 | void __devexit iwl_pci_remove(struct pci_dev *pdev); | ||
355 | |||
356 | #endif /* CONFIG_IWLWIFI_IDI */ | ||
357 | |||
364 | static struct pci_driver iwl_pci_driver = { | 358 | static struct pci_driver iwl_pci_driver = { |
365 | .name = DRV_NAME, | 359 | .name = DRV_NAME, |
366 | .id_table = iwl_hw_card_ids, | 360 | .id_table = iwl_hw_card_ids, |