Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ata: pata_pdc2027x: Replace mdelay with msleep

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>

authored by

Jia-Ju Bai and committed by
Tejun Heo
b3506c7e eada8598

+2 -2
+2 -2
drivers/ata/pata_pdc2027x.c
··· 580 580 ioread16(mmio_base + PDC_PLL_CTL); /* flush */ 581 581 582 582 /* Wait the PLL circuit to be stable */ 583 - mdelay(30); 583 + msleep(30); 584 584 585 585 #ifdef PDC_DEBUG 586 586 /* ··· 620 620 start_time = ktime_get(); 621 621 622 622 /* Let the counter run for 100 ms. */ 623 - mdelay(100); 623 + msleep(100); 624 624 625 625 /* Read the counter values again */ 626 626 end_count = pdc_read_counter(host);