]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
PCI: dwc: Use msleep() in dw_pcie_wait_for_link()
authorKonrad Dybcio <konrad.dybcio@linaro.org>
Wed, 27 Mar 2024 18:24:49 +0000 (19:24 +0100)
committerBjorn Helgaas <bhelgaas@google.com>
Tue, 9 Jul 2024 23:19:58 +0000 (18:19 -0500)
According to [1], msleep should be used for large sleeps, such as the
100-ish ms one in this function. Comply with the guide and use it.

[1] https://docs.kernel.org/timers/timers-howto.html

[kwilczynski: commit log]
Link: https://lore.kernel.org/linux-pci/20240215-topic-pci_sleep-v2-1-79334884546b@linaro.org
Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org>
Signed-off-by: Krzysztof WilczyƄski <kwilczynski@kernel.org>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Johan Hovold <johan+linaro@kernel.org>
Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
drivers/pci/controller/dwc/pcie-designware.c
drivers/pci/controller/dwc/pcie-designware.h

index 250cf7f40b8587e9b2944115801baf5321a10640..62915e4b2ebd44b47291b6adb8d259e3997f075e 100644 (file)
@@ -655,7 +655,7 @@ int dw_pcie_wait_for_link(struct dw_pcie *pci)
                if (dw_pcie_link_up(pci))
                        break;
 
-               usleep_range(LINK_WAIT_USLEEP_MIN, LINK_WAIT_USLEEP_MAX);
+               msleep(LINK_WAIT_SLEEP_MS);
        }
 
        if (retries >= LINK_WAIT_MAX_RETRIES) {
index f8e5431a207bd5aa01c9c6c98666f4d0fbf16b6c..0e8d467254976e360d5a648bf51c9b56de1593ed 100644 (file)
@@ -63,8 +63,7 @@
 
 /* Parameters for the waiting for link up routine */
 #define LINK_WAIT_MAX_RETRIES          10
-#define LINK_WAIT_USLEEP_MIN           90000
-#define LINK_WAIT_USLEEP_MAX           100000
+#define LINK_WAIT_SLEEP_MS             90
 
 /* Parameters for the waiting for iATU enabled routine */
 #define LINK_WAIT_MAX_IATU_RETRIES     5