1
0
mirror of https://review.coreboot.org/flashrom.git synced 2025-07-01 22:21:16 +02:00

Make delay values unsigned

There is no reason for negative delays in our use cases:
 - We don't need it (to work around any quirks).
 - sleep() (POSIX) uses an unsigned argument.
 - usleep() (POSIX) uses an unsigned argument.
 - Sleep() (Windows) uses an unsigned argument.

Change all callees as well (without any complications).

Corresponding to flashrom svn r1782.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
This commit is contained in:
Stefan Tauner
2014-05-02 15:41:42 +00:00
parent b66ed84d19
commit f80419c75a
6 changed files with 21 additions and 22 deletions

View File

@ -30,7 +30,7 @@
/* loops per microsecond */
static unsigned long micro = 1;
__attribute__ ((noinline)) void myusec_delay(int usecs)
__attribute__ ((noinline)) void myusec_delay(unsigned int usecs)
{
unsigned long i;
for (i = 0; i < usecs * micro; i++) {
@ -63,7 +63,7 @@ static unsigned long measure_os_delay_resolution(void)
return timeusec;
}
static unsigned long measure_delay(int usecs)
static unsigned long measure_delay(unsigned int usecs)
{
unsigned long timeusec;
struct timeval start, end;
@ -170,7 +170,7 @@ recalibrate:
}
/* Not very precise sleep. */
void internal_sleep(int usecs)
void internal_sleep(unsigned int usecs)
{
#ifdef _WIN32
Sleep((usecs + 999) / 1000);
@ -181,7 +181,7 @@ void internal_sleep(int usecs)
}
/* Precise delay. */
void internal_delay(int usecs)
void internal_delay(unsigned int usecs)
{
/* If the delay is >1 s, use internal_sleep because timing does not need to be so precise. */
if (usecs > 1000000) {
@ -199,7 +199,7 @@ void myusec_calibrate_delay(void)
get_cpu_speed();
}
void internal_delay(int usecs)
void internal_delay(unsigned int usecs)
{
udelay(usecs);
}