Thread (9 messages) flat view 9 messages, 6 authors, 2018-07-19

Re: [PATCH] powerpc: Replaced msleep with usleep_range

From: Michael Ellerman <mpe@ellerman.id.au>
Date: 2018-07-11 14:13:47
Also in: lkml

Hi Daniel,

Daniel Klamt [off-list ref] writes:
quoted hunk ↗ jump to hunk
Replaced msleep for less than 10ms with usleep_range because will
often sleep longer than intended.
For original explanation see:
Documentation/timers/timers-howto.txt

Signed-off-by: Daniel Klamt <redacted>
Signed-off-by: Bjoern Noetel <redacted>
---
 arch/powerpc/sysdev/xive/native.c | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)
diff --git a/arch/powerpc/sysdev/xive/native.c b/arch/powerpc/sysdev/xive/native.c
index 311185b9960a..b164b1cdf4d6 100644
--- a/arch/powerpc/sysdev/xive/native.c
+++ b/arch/powerpc/sysdev/xive/native.c
@@ -109,7 +109,7 @@ int xive_native_configure_irq(u32 hw_irq, u32 target, u8 prio, u32 sw_irq)
 		rc = opal_xive_set_irq_config(hw_irq, target, prio, sw_irq);
 		if (rc != OPAL_BUSY)
 			break;
-		msleep(1);
+		usleep_range(1000, 1100)
 	}
We have actually recently added OPAL_BUSY_DELAY_MS (see opal.h) and
should convert these to use that. eg:

		msleep(OPAL_BUSY_DELAY_MS);


That has the effect of documenting that this is a short sleep to wait
for opal (our firmware), and we aren't concerned about rounding errors
in msleep().

If you send me a patch doing that I'd be happy to merge it.

cheers
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help