[U-Boot] [PATCH 17/21] time: Update mdelay() to delay in one large chunk

sjg at google.com sjg at google.com
Wed Dec 5 23:10:43 UTC 2018


The current function delays in one millisecond at a time. This does not
work well on sandbox since it results in lots of calls to usleep(1000) in
a tight loop. This makes the sleep duration quite variable since each call
results in a sleep of *at least* 1000us, but possibly more. Depending on
how busy the machine is, the sleep time can change quite a bit.

We cannot fix this in general, but we can reduce the effect by doing a
single sleep. The multiplication works fine with an unsigned long argument
up until a sleep time of about 4m milliseconds. This is over an hour and
we can be sure that delays of that length are not useful.

Update the mdelay() function to call udelay() only once with the
calculated delay value.

Signed-off-by: Simon Glass <sjg at chromium.org>
---

 include/linux/delay.h | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Applied to u-boot-dm/master, thanks!


More information about the U-Boot mailing list