Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 263239
b: refs/heads/master
c: 16a9d06
h: refs/heads/master
i:
  263237: 3104a94
  263235: 91829e0
  263231: 065a773
v: v3
  • Loading branch information
Emmanuel Grumbach authored and John W. Linville committed Aug 13, 2011
1 parent 4211c94 commit 61416d0
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 23 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 4eb60d869fdad7acd098b53bfd1863c311d8933d
refs/heads/master: 16a9d06c753abc44f66f88e03bbecb3f1e45d71b
39 changes: 17 additions & 22 deletions trunk/drivers/net/wireless/iwlwifi/iwl-pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ static void iwl_pci_apm_config(struct iwl_bus *bus)
static void iwl_pci_set_drv_data(struct iwl_bus *bus, void *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[],
Expand Down Expand Up @@ -454,8 +455,6 @@ 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_set_drvdata(pdev, bus);

bus->dev = &pdev->dev;
bus->irq = pdev->irq;
bus->ops = &pci_ops;
Expand All @@ -479,47 +478,43 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
return err;
}

static void iwl_pci_down(struct iwl_bus *bus)
{
struct iwl_pci_bus *pci_bus = (struct iwl_pci_bus *) bus->bus_specific;

pci_disable_msi(pci_bus->pci_dev);
pci_iounmap(pci_bus->pci_dev, pci_bus->hw_base);
pci_release_regions(pci_bus->pci_dev);
pci_disable_device(pci_bus->pci_dev);
pci_set_drvdata(pci_bus->pci_dev, NULL);

kfree(bus);
}

static void __devexit iwl_pci_remove(struct pci_dev *pdev)
{
struct iwl_bus *bus = pci_get_drvdata(pdev);
struct iwl_priv *priv = pci_get_drvdata(pdev);
struct iwl_bus *bus = priv->bus;
struct iwl_pci_bus *pci_bus = IWL_BUS_GET_PCI_BUS(bus);
struct pci_dev *pci_dev = IWL_BUS_GET_PCI_DEV(bus);

iwl_remove(bus->drv_data);
iwl_remove(priv);

iwl_pci_down(bus);
pci_disable_msi(pci_dev);
pci_iounmap(pci_dev, pci_bus->hw_base);
pci_release_regions(pci_dev);
pci_disable_device(pci_dev);
pci_set_drvdata(pci_dev, NULL);

kfree(bus);
}

#ifdef CONFIG_PM

static int iwl_pci_suspend(struct device *device)
{
struct pci_dev *pdev = to_pci_dev(device);
struct iwl_bus *bus = pci_get_drvdata(pdev);
struct iwl_priv *priv = pci_get_drvdata(pdev);

/* 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
* WoWLAN is enabled - don't kill the NIC, someone may need it in Sx.
*/

return iwl_suspend(bus->drv_data);
return iwl_suspend(priv);
}

static int iwl_pci_resume(struct device *device)
{
struct pci_dev *pdev = to_pci_dev(device);
struct iwl_bus *bus = pci_get_drvdata(pdev);
struct iwl_priv *priv = pci_get_drvdata(pdev);

/* 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
Expand All @@ -532,7 +527,7 @@ static int iwl_pci_resume(struct device *device)
*/
pci_write_config_byte(pdev, PCI_CFG_RETRY_TIMEOUT, 0x00);

return iwl_resume(bus->drv_data);
return iwl_resume(priv);
}

static SIMPLE_DEV_PM_OPS(iwl_dev_pm_ops, iwl_pci_suspend, iwl_pci_resume);
Expand Down

0 comments on commit 61416d0

Please sign in to comment.