PCI / PM: Really allow runtime PM without callback functions
PATCH v2 1/1 PCI / PM: Really allow runtime PM without callback functions
Commit c5eb1190074c ("PCI / PM: Allow runtime PM without callback functions") tried to eliminate the need for runtime PM callbacks by modifying pci_pm_runtime_suspend() and pci_pm_runtime_resume(), but didn't modify pci_pm_runtime_idle() with relevant changes, which still returns -ENOSYS if the driver supplies no runtime PM callbacks.
Modify pci_pm_runtime_idle() such that it allows PCI device power state transitions without runtime PM callbacks and complete the original intention of commit c5eb1190074c ("PCI / PM: Allow runtime PM without callback functions").
---
This is not marked for linux-stable for the need of extensive testing and can be backported after a few releases if no issues are reported.
Changes since v1:
- Update commit message and tags
drivers/pci/pci-driver.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/pci/pci-driver.c +1 -4
@@ -1382,10 +1382,7 @@ static int pci_pm_runtime_idle(struct device *dev)if (!pci_dev->driver)return 0 ; -if (!pm) -return -ENOSYS ; - -if (pm->runtime_idle) +if (pm && pm->runtime_idle)return pm->runtime_idle (dev);return 0 ;
Signature · 1 line
2.35.3
Bjorn Helgaas
AppliedQuoted 11 lines · Raag Jadav
Commit
c5eb1190074c("PCI / PM: Allow runtime PM without callback functions") tried to eliminate the need for runtime PM callbacks by modifyingpci_pm_runtime_suspend()andpci_pm_runtime_resume(), but didn't modifypci_pm_runtime_idle()with relevant changes, which still returns-ENOSYSif the driver supplies no runtime PM callbacks.Modify
pci_pm_runtime_idle()such that it allows PCI device power state transitions without runtime PM callbacks and complete the original intention of commitc5eb1190074c("PCI / PM: Allow runtime PM without callback functions").
Quoted 5 lines
Signed-off-by Raag Jadav <[email protected]>Tested-by Jarkko Nikula <[email protected]>Reviewed-by Andy Shevchenko <[email protected]>Reviewed-by Stanislaw Gruszka <[email protected]>
Applied to pci/pm for v6.9, thanks!
I updated the commit log to try to clarify which drivers would be affected. Now that I worked through those details, I see that it was all there from the beginning and it just took a long time to sink into my head:
PCI/PM: Allow runtime PM with no PM callbacks at all
Commit c5eb1190074c ("PCI / PM: Allow runtime PM without callback functions") eliminated the need for PM callbacks in pci_pm_runtime_suspend() and pci_pm_runtime_resume(), but didn't do the same for pci_pm_runtime_idle().
Therefore, runtime suspend worked as long as the driver implemented at least one PM callback. But if the driver doesn't implement any PM callbacks at all (driver->pm is NULL), pci_pm_runtime_idle() returned -ENOSYS, which prevented runtime suspend.
Modify pci_pm_runtime_idle() to allow PCI device power state transitions without runtime PM callbacks and complete the original intention of commit c5eb1190074c ("PCI / PM: Allow runtime PM without callback functions").
Bjorn
Quoted 30 lines
---
This is not marked for linux-stable for the need of extensive testing and can be backported after a few releases if no issues are reported.
Changes since v1:
- Update commit message and tagsdrivers/pci/pci-driver.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)drivers/pci/pci-driver.c +1
-4@@ -1382,10 +1382,7 @@ static int pci_pm_runtime_idle(struct device *dev)if (!pci_dev->driver)return 0 ; -if (!pm) -return -ENOSYS ; - -if (pm->runtime_idle) +if (pm && pm->runtime_idle)return pm->runtime_idle (dev);return 0 ;Signature · 1 line
2.35.3