mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-12-23 03:23:47 +00:00
49c751603c
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>
21 lines
380 B
C
21 lines
380 B
C
/* SPDX-License-Identifier: GPL-2.0+ */
|
|
|
|
#ifndef _LINUX_DELAY_H
|
|
#define _LINUX_DELAY_H
|
|
|
|
#include <linux/kernel.h>
|
|
|
|
void __udelay(unsigned long usec);
|
|
void udelay(unsigned long usec);
|
|
|
|
static inline void mdelay(unsigned long msec)
|
|
{
|
|
udelay(1000 * msec);
|
|
}
|
|
|
|
static inline void ndelay(unsigned long nsec)
|
|
{
|
|
udelay(DIV_ROUND_UP(nsec, 1000));
|
|
}
|
|
|
|
#endif /* defined(_LINUX_DELAY_H) */
|