PCI/PM: Don't sleep at all when d3_delay or d3cold_delay is zero

msleep() still sleeps 1 jiffy even when told to sleep for zero
milliseconds.  That can end up being 1-2 milliseconds or more.  In the
cases of d3_delay and d3cold_delay, that unnecessarily increases suspend
and/or resume latencies.

Do not sleep at all for the respective cases if d3_delay is zero or
d3cold_delay is zero.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
This commit is contained in:
Adrian Hunter 2017-03-14 15:21:58 +02:00 коммит произвёл Bjorn Helgaas
Родитель c1ae3cfa0e
Коммит 50b2b540c0
1 изменённых файлов: 4 добавлений и 2 удалений

Просмотреть файл

@ -66,7 +66,8 @@ static void pci_dev_d3_sleep(struct pci_dev *dev)
if (delay < pci_pm_d3_delay) if (delay < pci_pm_d3_delay)
delay = pci_pm_d3_delay; delay = pci_pm_d3_delay;
msleep(delay); if (delay)
msleep(delay);
} }
#ifdef CONFIG_PCI_DOMAINS #ifdef CONFIG_PCI_DOMAINS
@ -827,7 +828,8 @@ static void __pci_start_power_transition(struct pci_dev *dev, pci_power_t state)
* because have already delayed for the bridge. * because have already delayed for the bridge.
*/ */
if (dev->runtime_d3cold) { if (dev->runtime_d3cold) {
msleep(dev->d3cold_delay); if (dev->d3cold_delay)
msleep(dev->d3cold_delay);
/* /*
* When powering on a bridge from D3cold, the * When powering on a bridge from D3cold, the
* whole hierarchy may be powered on into * whole hierarchy may be powered on into