]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
ata: pata_pdc2027x: Replace mdelay with msleep
authorJia-Ju Bai <baijiaju1990@gmail.com>
Thu, 25 Jan 2018 10:45:05 +0000 (18:45 +0800)
committerTejun Heo <tj@kernel.org>
Thu, 25 Jan 2018 15:28:31 +0000 (07:28 -0800)
After checking all possible call chains to pdc_adjust_pll and
pdc_detect_pll_input_clock,
my tool finds that these functions are never called in atomic context,
namely never in an interrupt handler or holding a spinlock.
And their caller functions pdc2027x_init_one and pdc2027x_reinit_one
calls pci_enable_device which can sleep, and no spinlock is held when
calling pdc_adjust_pll and pdc_detect_pll_input_clock,
so it proves that pdc_adjust_pll and pdc_detect_pll_input_clock
can call functions which can sleep.
Thus mdelay can be replaced with msleep to avoid busy wait.

Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
drivers/ata/pata_pdc2027x.c

index 6db2e34bd52f2e5521e72ac2b17e1ee1fe43cc44..1a18e675ba9ff087c011ec0816fa4962a65d55cc 100644 (file)
@@ -580,7 +580,7 @@ static void pdc_adjust_pll(struct ata_host *host, long pll_clock, unsigned int b
        ioread16(mmio_base + PDC_PLL_CTL); /* flush */
 
        /* Wait the PLL circuit to be stable */
-       mdelay(30);
+       msleep(30);
 
 #ifdef PDC_DEBUG
        /*
@@ -620,7 +620,7 @@ static long pdc_detect_pll_input_clock(struct ata_host *host)
        start_time = ktime_get();
 
        /* Let the counter run for 100 ms. */
-       mdelay(100);
+       msleep(100);
 
        /* Read the counter values again */
        end_count = pdc_read_counter(host);