aboutsummaryrefslogtreecommitdiff
path: root/include/linux/delay.h
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2018-11-23 21:29:40 -0700
committerSimon Glass <sjg@chromium.org>2018-12-05 06:01:35 -0700
commit49c751603c5abfe32019640834bc34a0a424eb57 (patch)
tree5be1fb86151ac64025c0ce6f2dd9dedfd7a8546f /include/linux/delay.h
parent4a978e86d73e792b3136ad9e83df4ba566a040c7 (diff)
downloadu-boot-49c751603c5abfe32019640834bc34a0a424eb57.zip
u-boot-49c751603c5abfe32019640834bc34a0a424eb57.tar.gz
u-boot-49c751603c5abfe32019640834bc34a0a424eb57.tar.bz2
time: Update mdelay() to delay in one large chunk
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@chromium.org>
Diffstat (limited to 'include/linux/delay.h')
-rw-r--r--include/linux/delay.h3
1 files changed, 1 insertions, 2 deletions
diff --git a/include/linux/delay.h b/include/linux/delay.h
index 1936034..71a38e1 100644
--- a/include/linux/delay.h
+++ b/include/linux/delay.h
@@ -10,8 +10,7 @@ void udelay(unsigned long usec);
static inline void mdelay(unsigned long msec)
{
- while (msec--)
- udelay(1000);
+ udelay(1000 * msec);
}
static inline void ndelay(unsigned long nsec)