linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] kernel: x86: early-quirks: Replace mdelay with usleep_range in apple_airport_reset
@ 2018-01-24  2:38 Jia-Ju Bai
  2018-01-24  5:33 ` Lukas Wunner
  0 siblings, 1 reply; 3+ messages in thread
From: Jia-Ju Bai @ 2018-01-24  2:38 UTC (permalink / raw)
  To: tglx, mingo, hpa, paulo.r.zanoni, kstewart, gregkh, lukas
  Cc: x86, linux-kernel, Jia-Ju Bai

The function apple_airport_reset is not called in atomic context.
Thus mdelay can be replaced with usleep_range, to avoid busy wait.

This is reported by a static analysis tool named DCNS written by myself.

Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
---
 arch/x86/kernel/early-quirks.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/kernel/early-quirks.c b/arch/x86/kernel/early-quirks.c
index 1e82f78..559e81a 100644
--- a/arch/x86/kernel/early-quirks.c
+++ b/arch/x86/kernel/early-quirks.c
@@ -604,7 +604,7 @@ static void __init apple_airport_reset(int bus, int slot, int func)
 	if ((pmcsr & PCI_PM_CTRL_STATE_MASK) != PCI_D0) {
 		pmcsr &= ~PCI_PM_CTRL_STATE_MASK;
 		write_pci_config_16(bus, slot, func, BCM4331_PM_CAP + PCI_PM_CTRL, pmcsr);
-		mdelay(10);
+		usleep_range(10000, 11000);
 
 		pmcsr = read_pci_config_16(bus, slot, func, BCM4331_PM_CAP + PCI_PM_CTRL);
 		if ((pmcsr & PCI_PM_CTRL_STATE_MASK) != PCI_D0) {
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-01-24 16:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-24  2:38 [PATCH] kernel: x86: early-quirks: Replace mdelay with usleep_range in apple_airport_reset Jia-Ju Bai
2018-01-24  5:33 ` Lukas Wunner
2018-01-24 16:13   ` Andy Shevchenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).