callout_schedule uses ticks as timeunit, not usecs.

As suggested by Rene Gollent, we used ticks as usecs.
This commit is contained in:
Fredrik Holmqvist 2012-07-18 17:09:36 +02:00
parent 4feeeb4a8f
commit a2e7d8df7b
2 changed files with 8 additions and 7 deletions

View File

@ -172,7 +172,7 @@ callout_init_mtx(struct callout *c, struct mtx *mtx, int flags)
int
callout_reset(struct callout *c, int when, void (*func)(void *), void *arg)
callout_reset(struct callout *c, int ticks, void (*func)(void *), void *arg)
{
int canceled = callout_stop(c);
@ -183,12 +183,12 @@ callout_reset(struct callout *c, int when, void (*func)(void *), void *arg)
TRACE("callout_reset %p, func %p, arg %p\n", c, c->c_func, c->c_arg);
if (when >= 0) {
if (ticks >= 0) {
// reschedule or add this timer
if (c->due <= 0)
list_add_item(&sTimers, c);
c->due = system_time() + when;
c->due = system_time() + ticks_to_usecs(ticks);
// notify timer about the change if necessary
if (sTimeout > c->due)
@ -200,9 +200,9 @@ callout_reset(struct callout *c, int when, void (*func)(void *), void *arg)
int
callout_schedule(struct callout *callout, int toTicks)
callout_schedule(struct callout *callout, int ticks)
{
return callout_reset(callout, toTicks, callout->c_func, callout->c_arg);
return callout_reset(callout, ticks, callout->c_func, callout->c_arg);
}

View File

@ -30,8 +30,9 @@ struct callout {
void callout_init(struct callout *c, int mpsafe);
void callout_init_mtx(struct callout *c, struct mtx *mutex, int flags);
int callout_schedule(struct callout *c, int when);
int callout_reset(struct callout *c, int when, void (*func)(void *), void *arg);
/* Time values are in ticks, see compat/sys/kernel.h for its definition */
int callout_schedule(struct callout *c, int ticks);
int callout_reset(struct callout *c, int ticks, void (*func)(void *), void *arg);
int callout_pending(struct callout *c);
int callout_active(struct callout *c);