* [PATCH] ata: pata_pdc2027x: Replace mdelay with msleep
@ 2018-01-25 10:45 Jia-Ju Bai
2018-01-25 15:30 ` Tejun Heo
0 siblings, 1 reply; 2+ messages in thread
From: Jia-Ju Bai @ 2018-01-25 10:45 UTC (permalink / raw)
To: b.zolnierkie, tj; +Cc: linux-ide, linux-kernel, Jia-Ju Bai
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>
---
drivers/ata/pata_pdc2027x.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/ata/pata_pdc2027x.c b/drivers/ata/pata_pdc2027x.c
index ffd8d33..4e8584d 100644
--- a/drivers/ata/pata_pdc2027x.c
+++ b/drivers/ata/pata_pdc2027x.c
@@ -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);
--
1.7.9.5
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] ata: pata_pdc2027x: Replace mdelay with msleep
2018-01-25 10:45 [PATCH] ata: pata_pdc2027x: Replace mdelay with msleep Jia-Ju Bai
@ 2018-01-25 15:30 ` Tejun Heo
0 siblings, 0 replies; 2+ messages in thread
From: Tejun Heo @ 2018-01-25 15:30 UTC (permalink / raw)
To: Jia-Ju Bai; +Cc: b.zolnierkie, linux-ide, linux-kernel
On Thu, Jan 25, 2018 at 06:45:05PM +0800, Jia-Ju Bai wrote:
> 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>
Applied to libata/for-4.16.
Thanks.
--
tejun
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-01-25 15:31 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-25 10:45 [PATCH] ata: pata_pdc2027x: Replace mdelay with msleep Jia-Ju Bai
2018-01-25 15:30 ` Tejun Heo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox