Merge branch 'for-linus' into next
* for-linus: PCI/portdrv: Don't create hotplug slots unless port supports hotplug PCI/PM: Fix proc config reg access for D3cold and bridge suspending PCI/PM: Resume device before shutdown PCI/PM: Fix deadlock when unbinding device if parent in D3cold
This commit is contained in:
@@ -1868,6 +1868,38 @@ bool pci_dev_run_wake(struct pci_dev *dev)
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(pci_dev_run_wake);
|
||||
|
||||
void pci_config_pm_runtime_get(struct pci_dev *pdev)
|
||||
{
|
||||
struct device *dev = &pdev->dev;
|
||||
struct device *parent = dev->parent;
|
||||
|
||||
if (parent)
|
||||
pm_runtime_get_sync(parent);
|
||||
pm_runtime_get_noresume(dev);
|
||||
/*
|
||||
* pdev->current_state is set to PCI_D3cold during suspending,
|
||||
* so wait until suspending completes
|
||||
*/
|
||||
pm_runtime_barrier(dev);
|
||||
/*
|
||||
* Only need to resume devices in D3cold, because config
|
||||
* registers are still accessible for devices suspended but
|
||||
* not in D3cold.
|
||||
*/
|
||||
if (pdev->current_state == PCI_D3cold)
|
||||
pm_runtime_resume(dev);
|
||||
}
|
||||
|
||||
void pci_config_pm_runtime_put(struct pci_dev *pdev)
|
||||
{
|
||||
struct device *dev = &pdev->dev;
|
||||
struct device *parent = dev->parent;
|
||||
|
||||
pm_runtime_put(dev);
|
||||
if (parent)
|
||||
pm_runtime_put_sync(parent);
|
||||
}
|
||||
|
||||
/**
|
||||
* pci_pm_init - Initialize PM functions of given PCI device
|
||||
* @dev: PCI device to handle.
|
||||
|
||||
Reference in New Issue
Block a user