diff options
author | Bret Lambert <blambert@cvs.openbsd.org> | 2008-09-10 14:01:24 +0000 |
---|---|---|
committer | Bret Lambert <blambert@cvs.openbsd.org> | 2008-09-10 14:01:24 +0000 |
commit | 33d64896abc9e79070ec22125a832e7d8ef87878 (patch) | |
tree | 1f2297f6ceb3127f1cc36b8d9c89baeeceb16922 /sys/kern | |
parent | 528af50e90df2cf2ebdf638dc4d94752c1861936 (diff) |
Convert timeout_add() calls using multiples of hz to timeout_add_sec()
Really just the low-hanging fruit of (hopefully) forthcoming timeout
conversions.
ok art@, krw@
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/kern_sensors.c | 4 | ||||
-rw-r--r-- | sys/kern/sched_bsd.c | 4 | ||||
-rw-r--r-- | sys/kern/tty_msts.c | 15 | ||||
-rw-r--r-- | sys/kern/tty_nmea.c | 15 |
4 files changed, 12 insertions, 26 deletions
diff --git a/sys/kern/kern_sensors.c b/sys/kern/kern_sensors.c index 6c804a6f178..69a534fd63b 100644 --- a/sys/kern/kern_sensors.c +++ b/sys/kern/kern_sensors.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_sensors.c,v 1.21 2007/07/03 03:22:34 cnst Exp $ */ +/* $OpenBSD: kern_sensors.c,v 1.22 2008/09/10 14:01:23 blambert Exp $ */ /* * Copyright (c) 2005 David Gwynne <dlg@openbsd.org> @@ -255,6 +255,6 @@ sensor_task_work(void *xst, void *arg) wakeup(st); } else { st->state = ST_TICKING; - timeout_add(&st->timeout, hz * st->period); + timeout_add_sec(&st->timeout, st->period); } } diff --git a/sys/kern/sched_bsd.c b/sys/kern/sched_bsd.c index e7babbb88ed..0de34540858 100644 --- a/sys/kern/sched_bsd.c +++ b/sys/kern/sched_bsd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sched_bsd.c,v 1.17 2008/07/18 23:43:31 art Exp $ */ +/* $OpenBSD: sched_bsd.c,v 1.18 2008/09/10 14:01:23 blambert Exp $ */ /* $NetBSD: kern_synch.c,v 1.37 1996/04/22 01:38:37 christos Exp $ */ /*- @@ -269,7 +269,7 @@ schedcpu(void *arg) } uvm_meter(); wakeup(&lbolt); - timeout_add(to, hz); + timeout_add_sec(to, 1); } /* diff --git a/sys/kern/tty_msts.c b/sys/kern/tty_msts.c index 660e9e2a0ee..5aa03c54376 100644 --- a/sys/kern/tty_msts.c +++ b/sys/kern/tty_msts.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tty_msts.c,v 1.4 2008/06/11 17:11:36 mbalmer Exp $ */ +/* $OpenBSD: tty_msts.c,v 1.5 2008/09/10 14:01:23 blambert Exp $ */ /* * Copyright (c) 2008 Marc Balmer <mbalmer@openbsd.org> @@ -53,7 +53,6 @@ void mstsattach(int); #endif int msts_count, msts_nxid; -static int t_trust; struct msts { char cbuf[MSTSMAX]; /* receive buffer */ @@ -92,7 +91,6 @@ mstsopen(dev_t dev, struct tty *tp) { struct proc *p = curproc; struct msts *np; - struct timeval t; int error; DPRINTF(("mstsopen\n")); @@ -128,11 +126,6 @@ mstsopen(dev_t dev, struct tty *tp) } else { sensordev_install(&np->timedev); timeout_set(&np->msts_tout, msts_timeout, np); - - /* convert timevals to hz */ - t.tv_sec = TRUSTTIME; - t.tv_usec = 0; - t_trust = tvtohz(&t); } return error; @@ -280,7 +273,7 @@ msts_decode(struct msts *np, struct tty *tp, char *fld[], int fldcnt) #ifdef MSTS_DEBUG if (np->time.status == SENSOR_S_UNKNOWN) { np->time.status = SENSOR_S_OK; - timeout_add(&np->msts_tout, t_trust); + timeout_add_sec(&np->msts_tout, TRUSTTIME); } np->gapno = 0; #endif @@ -305,7 +298,7 @@ msts_decode(struct msts *np, struct tty *tp, char *fld[], int fldcnt) if (fld[3][0] == ' ' && fld[3][1] == ' ') { np->time.status = SENSOR_S_OK; np->signal.status = SENSOR_S_OK; - timeout_add(&np->msts_tout, t_trust); + timeout_add_sec(&np->msts_tout, TRUSTTIME); } else np->signal.status = SENSOR_S_WARN; @@ -428,7 +421,7 @@ msts_timeout(void *xnp) * further degrade in TRUSTTIME seconds if no new valid MSTS * strings are received. */ - timeout_add(&np->msts_tout, t_trust); + timeout_add_sec(&np->msts_tout, TRUSTTIME); } else np->time.status = SENSOR_S_CRIT; } diff --git a/sys/kern/tty_nmea.c b/sys/kern/tty_nmea.c index 1e52d855575..c84834cc369 100644 --- a/sys/kern/tty_nmea.c +++ b/sys/kern/tty_nmea.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tty_nmea.c,v 1.30 2008/07/22 06:06:47 mbalmer Exp $ */ +/* $OpenBSD: tty_nmea.c,v 1.31 2008/09/10 14:01:23 blambert Exp $ */ /* * Copyright (c) 2006, 2007, 2008 Marc Balmer <mbalmer@openbsd.org> @@ -50,7 +50,6 @@ void nmeaattach(int); #endif int nmea_count, nmea_nxid; -static int t_trust; struct nmea { char cbuf[NMEAMAX]; /* receive buffer */ @@ -97,7 +96,6 @@ nmeaopen(dev_t dev, struct tty *tp) { struct proc *p = curproc; struct nmea *np; - struct timeval t; int error; if (tp->t_line == NMEADISC) @@ -130,11 +128,6 @@ nmeaopen(dev_t dev, struct tty *tp) } else { sensordev_install(&np->timedev); timeout_set(&np->nmea_tout, nmea_timeout, np); - - /* convert timevals to hz */ - t.tv_sec = TRUSTTIME; - t.tv_usec = 0; - t_trust = tvtohz(&t); } return error; } @@ -317,7 +310,7 @@ nmea_gprmc(struct nmea *np, struct tty *tp, char *fld[], int fldcnt) #ifdef NMEA_DEBUG if (np->time.status == SENSOR_S_UNKNOWN) { np->time.status = SENSOR_S_OK; - timeout_add(&np->nmea_tout, t_trust); + timeout_add_sec(&np->nmea_tout, TRUSTTIME); } np->gapno = 0; if (nmeadebug > 0) { @@ -373,7 +366,7 @@ nmea_gprmc(struct nmea *np, struct tty *tp, char *fld[], int fldcnt) case 'A': /* The GPS has a fix, (re)arm the timeout. */ np->time.status = SENSOR_S_OK; np->signal.status = SENSOR_S_OK; - timeout_add(&np->nmea_tout, t_trust); + timeout_add_sec(&np->nmea_tout, TRUSTTIME); break; case 'V': /* * The GPS indicates a warning status, do not add to @@ -547,7 +540,7 @@ nmea_timeout(void *xnp) * further degrade in TRUSTTIME seconds if no new valid NMEA * sentences are received. */ - timeout_add(&np->nmea_tout, t_trust); + timeout_add_sec(&np->nmea_tout, TRUSTTIME); } else np->time.status = SENSOR_S_CRIT; } |