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>
diff --git a/udelay.c b/udelay.c
index e3cf3e3..ee858b8 100644
--- a/udelay.c
+++ b/udelay.c
@@ -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 @@
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 @@
}
/* 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 @@
}
/* 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 @@
get_cpu_speed();
}
-void internal_delay(int usecs)
+void internal_delay(unsigned int usecs)
{
udelay(usecs);
}