提交 4eb60d86 编写于 作者: E Emmanuel Grumbach 提交者: John W. Linville

Revert "iwlagn: sysfs couldn't find the priv pointer"

This reverts commit cc1a93e6.

This fix introduced a bug: bad pointer in unload.
Signed-off-by: NEmmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: NWey-Yi Guy <wey-yi.w.guy@intel.com>
Signed-off-by: NJohn W. Linville <linville@tuxdriver.com>
上级 f8afdf48
...@@ -134,7 +134,6 @@ static void iwl_pci_apm_config(struct iwl_bus *bus) ...@@ -134,7 +134,6 @@ static void iwl_pci_apm_config(struct iwl_bus *bus)
static void iwl_pci_set_drv_data(struct iwl_bus *bus, void *drv_data) static void iwl_pci_set_drv_data(struct iwl_bus *bus, void *drv_data)
{ {
bus->drv_data = drv_data; bus->drv_data = drv_data;
pci_set_drvdata(IWL_BUS_GET_PCI_DEV(bus), drv_data);
} }
static void iwl_pci_get_hw_id(struct iwl_bus *bus, char buf[], static 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,6 +454,8 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
pci_write_config_word(pdev, PCI_COMMAND, pci_cmd); pci_write_config_word(pdev, PCI_COMMAND, pci_cmd);
} }
pci_set_drvdata(pdev, bus);
bus->dev = &pdev->dev; bus->dev = &pdev->dev;
bus->irq = pdev->irq; bus->irq = pdev->irq;
bus->ops = &pci_ops; bus->ops = &pci_ops;
...@@ -493,12 +494,11 @@ static void iwl_pci_down(struct iwl_bus *bus) ...@@ -493,12 +494,11 @@ static void iwl_pci_down(struct iwl_bus *bus)
static void __devexit iwl_pci_remove(struct pci_dev *pdev) static void __devexit iwl_pci_remove(struct pci_dev *pdev)
{ {
struct iwl_priv *priv = pci_get_drvdata(pdev); struct iwl_bus *bus = pci_get_drvdata(pdev);
void *bus_specific = priv->bus->bus_specific;
iwl_remove(priv); iwl_remove(bus->drv_data);
iwl_pci_down(bus_specific); iwl_pci_down(bus);
} }
#ifdef CONFIG_PM #ifdef CONFIG_PM
...@@ -506,20 +506,20 @@ static void __devexit iwl_pci_remove(struct pci_dev *pdev) ...@@ -506,20 +506,20 @@ static void __devexit iwl_pci_remove(struct pci_dev *pdev)
static int iwl_pci_suspend(struct device *device) static int iwl_pci_suspend(struct device *device)
{ {
struct pci_dev *pdev = to_pci_dev(device); struct pci_dev *pdev = to_pci_dev(device);
struct iwl_priv *priv = pci_get_drvdata(pdev); struct iwl_bus *bus = pci_get_drvdata(pdev);
/* Before you put code here, think about WoWLAN. You cannot check here /* Before you put code here, think about WoWLAN. You cannot check here
* whether WoWLAN is enabled or not, and your code will run even if * whether WoWLAN is enabled or not, and your code will run even if
* WoWLAN is enabled - don't kill the NIC, someone may need it in Sx. * WoWLAN is enabled - don't kill the NIC, someone may need it in Sx.
*/ */
return iwl_suspend(priv); return iwl_suspend(bus->drv_data);
} }
static int iwl_pci_resume(struct device *device) static int iwl_pci_resume(struct device *device)
{ {
struct pci_dev *pdev = to_pci_dev(device); struct pci_dev *pdev = to_pci_dev(device);
struct iwl_priv *priv = pci_get_drvdata(pdev); struct iwl_bus *bus = pci_get_drvdata(pdev);
/* Before you put code here, think about WoWLAN. You cannot check here /* Before you put code here, think about WoWLAN. You cannot check here
* whether WoWLAN is enabled or not, and your code will run even if * 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,7 +532,7 @@ static int iwl_pci_resume(struct device *device)
*/ */
pci_write_config_byte(pdev, PCI_CFG_RETRY_TIMEOUT, 0x00); pci_write_config_byte(pdev, PCI_CFG_RETRY_TIMEOUT, 0x00);
return iwl_resume(priv); return iwl_resume(bus->drv_data);
} }
static SIMPLE_DEV_PM_OPS(iwl_dev_pm_ops, iwl_pci_suspend, iwl_pci_resume); static SIMPLE_DEV_PM_OPS(iwl_dev_pm_ops, iwl_pci_suspend, iwl_pci_resume);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册