diff options
author | Emmanuel Grumbach <emmanuel.grumbach@intel.com> | 2011-08-13 12:02:44 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2011-08-13 14:40:46 -0400 |
commit | 16a9d06c753abc44f66f88e03bbecb3f1e45d71b (patch) | |
tree | 2b7ef40488c9c5ca856907d7f5efff07e0b05a90 /drivers/net | |
parent | 4eb60d869fdad7acd098b53bfd1863c311d8933d (diff) |
iwlagn: sysfs couldn't find the priv pointer
This bug has been introduced by:
d593411084a56124aa9d80aafa15db8463b2d8f7
Author: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Date: Mon Jul 11 10:48:51 2011 +0300
iwlagn: simplify the bus architecture
Revert part of the buggy patch: dev_get_drvdata will now return
iwl_priv as it did before the patch.
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-pci.c | 39 |
1 files changed, 17 insertions, 22 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-pci.c b/drivers/net/wireless/iwlwifi/iwl-pci.c index fb7e436b40c7..2fdbffa079c1 100644 --- a/drivers/net/wireless/iwlwifi/iwl-pci.c +++ b/drivers/net/wireless/iwlwifi/iwl-pci.c | |||
@@ -134,6 +134,7 @@ static void iwl_pci_apm_config(struct iwl_bus *bus) | |||
134 | static void iwl_pci_set_drv_data(struct iwl_bus *bus, void *drv_data) | 134 | static void iwl_pci_set_drv_data(struct iwl_bus *bus, void *drv_data) |
135 | { | 135 | { |
136 | bus->drv_data = drv_data; | 136 | bus->drv_data = drv_data; |
137 | pci_set_drvdata(IWL_BUS_GET_PCI_DEV(bus), drv_data); | ||
137 | } | 138 | } |
138 | 139 | ||
139 | static void iwl_pci_get_hw_id(struct iwl_bus *bus, char buf[], | 140 | static void iwl_pci_get_hw_id(struct iwl_bus *bus, char buf[], |
@@ -454,8 +455,6 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
454 | pci_write_config_word(pdev, PCI_COMMAND, pci_cmd); | 455 | pci_write_config_word(pdev, PCI_COMMAND, pci_cmd); |
455 | } | 456 | } |
456 | 457 | ||
457 | pci_set_drvdata(pdev, bus); | ||
458 | |||
459 | bus->dev = &pdev->dev; | 458 | bus->dev = &pdev->dev; |
460 | bus->irq = pdev->irq; | 459 | bus->irq = pdev->irq; |
461 | bus->ops = &pci_ops; | 460 | bus->ops = &pci_ops; |
@@ -479,26 +478,22 @@ out_no_pci: | |||
479 | return err; | 478 | return err; |
480 | } | 479 | } |
481 | 480 | ||
482 | static void iwl_pci_down(struct iwl_bus *bus) | ||
483 | { | ||
484 | struct iwl_pci_bus *pci_bus = (struct iwl_pci_bus *) bus->bus_specific; | ||
485 | |||
486 | pci_disable_msi(pci_bus->pci_dev); | ||
487 | pci_iounmap(pci_bus->pci_dev, pci_bus->hw_base); | ||
488 | pci_release_regions(pci_bus->pci_dev); | ||
489 | pci_disable_device(pci_bus->pci_dev); | ||
490 | pci_set_drvdata(pci_bus->pci_dev, NULL); | ||
491 | |||
492 | kfree(bus); | ||
493 | } | ||
494 | |||
495 | static void __devexit iwl_pci_remove(struct pci_dev *pdev) | 481 | static void __devexit iwl_pci_remove(struct pci_dev *pdev) |
496 | { | 482 | { |
497 | struct iwl_bus *bus = pci_get_drvdata(pdev); | 483 | struct iwl_priv *priv = pci_get_drvdata(pdev); |
484 | struct iwl_bus *bus = priv->bus; | ||
485 | struct iwl_pci_bus *pci_bus = IWL_BUS_GET_PCI_BUS(bus); | ||
486 | struct pci_dev *pci_dev = IWL_BUS_GET_PCI_DEV(bus); | ||
498 | 487 | ||
499 | iwl_remove(bus->drv_data); | 488 | iwl_remove(priv); |
500 | 489 | ||
501 | iwl_pci_down(bus); | 490 | pci_disable_msi(pci_dev); |
491 | pci_iounmap(pci_dev, pci_bus->hw_base); | ||
492 | pci_release_regions(pci_dev); | ||
493 | pci_disable_device(pci_dev); | ||
494 | pci_set_drvdata(pci_dev, NULL); | ||
495 | |||
496 | kfree(bus); | ||
502 | } | 497 | } |
503 | 498 | ||
504 | #ifdef CONFIG_PM | 499 | #ifdef CONFIG_PM |
@@ -506,20 +501,20 @@ static void __devexit iwl_pci_remove(struct pci_dev *pdev) | |||
506 | static int iwl_pci_suspend(struct device *device) | 501 | static int iwl_pci_suspend(struct device *device) |
507 | { | 502 | { |
508 | struct pci_dev *pdev = to_pci_dev(device); | 503 | struct pci_dev *pdev = to_pci_dev(device); |
509 | struct iwl_bus *bus = pci_get_drvdata(pdev); | 504 | struct iwl_priv *priv = pci_get_drvdata(pdev); |
510 | 505 | ||
511 | /* Before you put code here, think about WoWLAN. You cannot check here | 506 | /* Before you put code here, think about WoWLAN. You cannot check here |
512 | * whether WoWLAN is enabled or not, and your code will run even if | 507 | * whether WoWLAN is enabled or not, and your code will run even if |
513 | * WoWLAN is enabled - don't kill the NIC, someone may need it in Sx. | 508 | * WoWLAN is enabled - don't kill the NIC, someone may need it in Sx. |
514 | */ | 509 | */ |
515 | 510 | ||
516 | return iwl_suspend(bus->drv_data); | 511 | return iwl_suspend(priv); |
517 | } | 512 | } |
518 | 513 | ||
519 | static int iwl_pci_resume(struct device *device) | 514 | static int iwl_pci_resume(struct device *device) |
520 | { | 515 | { |
521 | struct pci_dev *pdev = to_pci_dev(device); | 516 | struct pci_dev *pdev = to_pci_dev(device); |
522 | struct iwl_bus *bus = pci_get_drvdata(pdev); | 517 | struct iwl_priv *priv = pci_get_drvdata(pdev); |
523 | 518 | ||
524 | /* Before you put code here, think about WoWLAN. You cannot check here | 519 | /* Before you put code here, think about WoWLAN. You cannot check here |
525 | * whether WoWLAN is enabled or not, and your code will run even if | 520 | * whether WoWLAN is enabled or not, and your code will run even if |
@@ -532,7 +527,7 @@ static int iwl_pci_resume(struct device *device) | |||
532 | */ | 527 | */ |
533 | pci_write_config_byte(pdev, PCI_CFG_RETRY_TIMEOUT, 0x00); | 528 | pci_write_config_byte(pdev, PCI_CFG_RETRY_TIMEOUT, 0x00); |
534 | 529 | ||
535 | return iwl_resume(bus->drv_data); | 530 | return iwl_resume(priv); |
536 | } | 531 | } |
537 | 532 | ||
538 | static SIMPLE_DEV_PM_OPS(iwl_dev_pm_ops, iwl_pci_suspend, iwl_pci_resume); | 533 | static SIMPLE_DEV_PM_OPS(iwl_dev_pm_ops, iwl_pci_suspend, iwl_pci_resume); |