Commit 98e6e286 authored by Rafael J. Wysocki's avatar Rafael J. Wysocki Committed by Jesse Barnes

PCI PM: Register power state of devices during initialization

Use the observation that the power state of a PCI device can be
loaded into its pci_dev structure as soon as pci_pm_init() is run for
it and make that happen.
Signed-off-by: default avatarRafael J. Wysocki <rjw@sisk.pl>
Acked-by: default avatarPavel Machek <pavel@suse.cz>
Signed-off-by: default avatarJesse Barnes <jbarnes@virtuousgeek.org>
parent ad8cfa1d
...@@ -1260,14 +1260,15 @@ void pci_pm_init(struct pci_dev *dev) ...@@ -1260,14 +1260,15 @@ void pci_pm_init(struct pci_dev *dev)
/* find PCI PM capability in list */ /* find PCI PM capability in list */
pm = pci_find_capability(dev, PCI_CAP_ID_PM); pm = pci_find_capability(dev, PCI_CAP_ID_PM);
if (!pm) if (!pm)
return; goto Exit;
/* Check device's ability to generate PME# */ /* Check device's ability to generate PME# */
pci_read_config_word(dev, pm + PCI_PM_PMC, &pmc); pci_read_config_word(dev, pm + PCI_PM_PMC, &pmc);
if ((pmc & PCI_PM_CAP_VER_MASK) > 3) { if ((pmc & PCI_PM_CAP_VER_MASK) > 3) {
dev_err(&dev->dev, "unsupported PM cap regs version (%u)\n", dev_err(&dev->dev, "unsupported PM cap regs version (%u)\n",
pmc & PCI_PM_CAP_VER_MASK); pmc & PCI_PM_CAP_VER_MASK);
return; goto Exit;
} }
dev->pm_cap = pm; dev->pm_cap = pm;
...@@ -1306,6 +1307,9 @@ void pci_pm_init(struct pci_dev *dev) ...@@ -1306,6 +1307,9 @@ void pci_pm_init(struct pci_dev *dev)
} else { } else {
dev->pme_support = 0; dev->pme_support = 0;
} }
Exit:
pci_update_current_state(dev, PCI_D0);
} }
/** /**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment