PCI: endpoint: Replace mdelay with usleep_range() in pci_epf_test_write()
authorJia-Ju Bai <baijiaju1990@gmail.com>
Tue, 10 Apr 2018 13:04:06 +0000 (21:04 +0800)
committerLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Tue, 8 May 2018 10:13:42 +0000 (11:13 +0100)
pci_epf_test_write() is never called in atomic context.

The call chain ending up at pci_epf_test_write() is:
[1] pci_epf_test_write() <- pci_epf_test_cmd_handler()

pci_epf_test_cmd_handler() is set as a parameter of INIT_DELAYED_WORK()
in pci_epf_test_probe().
This function is not called in atomic context.

Despite never getting called from atomic context, pci_epf_test_write()
calls mdelay() to busy wait.

This is not necessary and can be replaced with usleep_range() to
avoid busy waiting.

Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
[lorenzo.pieralisi@arm.com: updated commit log]
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Acked-by: Kishon Vijay Abraham I <kishon@ti.com>
drivers/pci/endpoint/functions/pci-epf-test.c

index 7cef8512432567883b6a0a42eb931cbaa576a5ab..7f1898b79569fab2c2f2ae9f91331180c5268293 100644 (file)
@@ -230,7 +230,7 @@ static int pci_epf_test_write(struct pci_epf_test *epf_test)
         * wait 1ms inorder for the write to complete. Without this delay L3
         * error in observed in the host system.
         */
-       mdelay(1);
+       usleep_range(1000, 2000);
 
        kfree(buf);