Commit fa885b06 authored by Raag Jadav's avatar Raag Jadav Committed by Bjorn Helgaas

PCI/PM: Allow runtime PM with no PM callbacks at all

Commit c5eb1190 ("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
c5eb1190 ("PCI / PM: Allow runtime PM without callback functions").

Link: https://lore.kernel.org/r/20240227062648.16579-1-raag.jadav@intel.comSigned-off-by: default avatarRaag Jadav <raag.jadav@intel.com>
[bhelgaas: commit log]
Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
Tested-by: default avatarJarkko Nikula <jarkko.nikula@linux.intel.com>
Reviewed-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: default avatarStanislaw Gruszka <stanislaw.gruszka@linux.intel.com>
Acked-by: default avatarRafael J. Wysocki <rafael@kernel.org>
parent cb98555f
......@@ -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;
......
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