We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4c00cba commit 3e34796Copy full SHA for 3e34796
drivers/pci/pci.c
@@ -66,13 +66,15 @@ struct pci_pme_device {
66
67
static void pci_dev_d3_sleep(struct pci_dev *dev)
68
{
69
- unsigned int delay = dev->d3hot_delay;
70
-
71
- if (delay < pci_pm_d3hot_delay)
72
- delay = pci_pm_d3hot_delay;
73
74
- if (delay)
75
- msleep(delay);
+ unsigned int delay_ms = max(dev->d3hot_delay, pci_pm_d3hot_delay);
+ unsigned int upper;
+
+ if (delay_ms) {
+ /* Use a 20% upper bound, 1ms minimum */
+ upper = max(DIV_ROUND_CLOSEST(delay_ms, 5), 1U);
+ usleep_range(delay_ms * USEC_PER_MSEC,
76
+ (delay_ms + upper) * USEC_PER_MSEC);
77
+ }
78
}
79
80
bool pci_reset_supported(struct pci_dev *dev)
0 commit comments