aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEmmanuel Grumbach <emmanuel.grumbach@intel.com>2011-08-13 12:02:43 -0400
committerJohn W. Linville <linville@tuxdriver.com>2011-08-13 14:40:46 -0400
commit4eb60d869fdad7acd098b53bfd1863c311d8933d (patch)
treecf46706836968d9e3ad25be6d0f226680379956f
parentf8afdf481f0fef5e170c6c928cec42879d505654 (diff)
Revert "iwlagn: sysfs couldn't find the priv pointer"
This reverts commit cc1a93e68f6c0d736b771f0746e8e4186f483fdc. This fix introduced a bug: bad pointer in unload. 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>
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-pci.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-pci.c b/drivers/net/wireless/iwlwifi/iwl-pci.c
index 69d4ec467dca..fb7e436b40c7 100644
--- a/drivers/net/wireless/iwlwifi/iwl-pci.c
+++ b/drivers/net/wireless/iwlwifi/iwl-pci.c
@@ -134,7 +134,6 @@ static void iwl_pci_apm_config(struct iwl_bus *bus)
134static void iwl_pci_set_drv_data(struct iwl_bus *bus, void *drv_data) 134static 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);
138} 137}
139 138
140static void iwl_pci_get_hw_id(struct iwl_bus *bus, char buf[], 139static void iwl_pci_get_hw_id(struct iwl_bus *bus, char buf[],
@@ -455,6 +454,8 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
455 pci_write_config_word(pdev, PCI_COMMAND, pci_cmd); 454 pci_write_config_word(pdev, PCI_COMMAND, pci_cmd);
456 } 455 }
457 456
457 pci_set_drvdata(pdev, bus);
458
458 bus->dev = &pdev->dev; 459 bus->dev = &pdev->dev;
459 bus->irq = pdev->irq; 460 bus->irq = pdev->irq;
460 bus->ops = &pci_ops; 461 bus->ops = &pci_ops;
@@ -493,12 +494,11 @@ static void iwl_pci_down(struct iwl_bus *bus)
493 494
494static void __devexit iwl_pci_remove(struct pci_dev *pdev) 495static void __devexit iwl_pci_remove(struct pci_dev *pdev)
495{ 496{
496 struct iwl_priv *priv = pci_get_drvdata(pdev); 497 struct iwl_bus *bus = pci_get_drvdata(pdev);
497 void *bus_specific = priv->bus->bus_specific;
498 498
499 iwl_remove(priv); 499 iwl_remove(bus->drv_data);
500 500
501 iwl_pci_down(bus_specific); 501 iwl_pci_down(bus);
502} 502}
503 503
504#ifdef CONFIG_PM 504#ifdef CONFIG_PM
@@ -506,20 +506,20 @@ static void __devexit iwl_pci_remove(struct pci_dev *pdev)
506static int iwl_pci_suspend(struct device *device) 506static int iwl_pci_suspend(struct device *device)
507{ 507{
508 struct pci_dev *pdev = to_pci_dev(device); 508 struct pci_dev *pdev = to_pci_dev(device);
509 struct iwl_priv *priv = pci_get_drvdata(pdev); 509 struct iwl_bus *bus = pci_get_drvdata(pdev);
510 510
511 /* Before you put code here, think about WoWLAN. You cannot check here 511 /* 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 512 * 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. 513 * WoWLAN is enabled - don't kill the NIC, someone may need it in Sx.
514 */ 514 */
515 515
516 return iwl_suspend(priv); 516 return iwl_suspend(bus->drv_data);
517} 517}
518 518
519static int iwl_pci_resume(struct device *device) 519static int iwl_pci_resume(struct device *device)
520{ 520{
521 struct pci_dev *pdev = to_pci_dev(device); 521 struct pci_dev *pdev = to_pci_dev(device);
522 struct iwl_priv *priv = pci_get_drvdata(pdev); 522 struct iwl_bus *bus = pci_get_drvdata(pdev);
523 523
524 /* Before you put code here, think about WoWLAN. You cannot check here 524 /* 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 525 * whether WoWLAN is enabled or not, and your code will run even if
@@ -532,7 +532,7 @@ static int iwl_pci_resume(struct device *device)
532 */ 532 */
533 pci_write_config_byte(pdev, PCI_CFG_RETRY_TIMEOUT, 0x00); 533 pci_write_config_byte(pdev, PCI_CFG_RETRY_TIMEOUT, 0x00);
534 534
535 return iwl_resume(priv); 535 return iwl_resume(bus->drv_data);
536} 536}
537 537
538static SIMPLE_DEV_PM_OPS(iwl_dev_pm_ops, iwl_pci_suspend, iwl_pci_resume); 538static SIMPLE_DEV_PM_OPS(iwl_dev_pm_ops, iwl_pci_suspend, iwl_pci_resume);