From: Matthew Dillon Date: Sat, 18 Sep 2004 19:11:29 +0000 (+0000) Subject: timeout/untimeout ==> callout_* X-Git-Tag: v2.0.1~10175 X-Git-Url: https://gitweb.dragonflybsd.org/dragonfly.git/commitdiff_plain/726b825484beb3f0eb0dfc559bf1fce4bbb93c87 timeout/untimeout ==> callout_* --- diff --git a/sys/dev/misc/spic/spic.c b/sys/dev/misc/spic/spic.c index fff724ca62..69b41a2717 100644 --- a/sys/dev/misc/spic/spic.c +++ b/sys/dev/misc/spic/spic.c @@ -48,7 +48,7 @@ * also provided sample code upon which this driver was based. * * $FreeBSD: src/sys/i386/isa/spic.c,v 1.4.2.1 2002/04/15 00:52:12 will Exp $ - * $DragonFly: src/sys/dev/misc/spic/spic.c,v 1.9 2004/05/20 21:47:23 dillon Exp $ + * $DragonFly: src/sys/dev/misc/spic/spic.c,v 1.10 2004/09/18 19:11:28 dillon Exp $ */ #include @@ -115,7 +115,7 @@ struct spic_softc { int sc_opened; int sc_sleeping; int sc_buttonlast; - struct callout_handle sc_timeout_ch; + struct callout sc_timeout_ch; device_t sc_dev; struct selinfo sc_rsel; u_char sc_buf[SCBUFLEN]; @@ -347,6 +347,7 @@ spic_attach(device_t dev) sc = device_get_softc(dev); sc->sc_dev = dev; + callout_init(&sc->sc_timeout_ch); spic_pollrate = (hz/50); /* Every 50th of a second */ @@ -434,7 +435,8 @@ spictimeout(void *arg) } else { /* No event. Wait some more */ - sc->sc_timeout_ch = timeout(spictimeout, sc, spic_pollrate); + callout_reset(&sc->sc_timeout_ch, spic_pollrate, + spictimeout, sc); return; } @@ -447,7 +449,7 @@ spictimeout(void *arg) } spic_call2(sc, 0x81, 0xff); /* Clear event */ - sc->sc_timeout_ch = timeout(spictimeout, sc, spic_pollrate); + callout_reset(&sc->sc_timeout_ch, spic_pollrate, spictimeout, sc); } static int @@ -476,7 +478,7 @@ spicclose(dev_t dev, int flag, int fmt, struct thread *td) sc = devclass_get_softc(spic_devclass, 0); /* Stop polling */ - untimeout(spictimeout, sc, sc->sc_timeout_ch); + callout_stop(&sc->sc_timeout_ch); sc->sc_opened = 0; return 0; } diff --git a/sys/dev/misc/tw/tw.c b/sys/dev/misc/tw/tw.c index bfbd57106d..023cd3e536 100644 --- a/sys/dev/misc/tw/tw.c +++ b/sys/dev/misc/tw/tw.c @@ -29,7 +29,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/i386/isa/tw.c,v 1.38 2000/01/29 16:00:32 peter Exp $ - * $DragonFly: src/sys/dev/misc/tw/tw.c,v 1.10 2004/05/19 22:52:45 dillon Exp $ + * $DragonFly: src/sys/dev/misc/tw/tw.c,v 1.11 2004/09/18 19:11:29 dillon Exp $ * */ @@ -261,7 +261,7 @@ static struct tw_sc { int sc_nextin; /* Next free slot in circular buffer */ int sc_nextout; /* First used slot in circular buffer */ /* Callout for canceling our abortrcv timeout */ - struct callout_handle abortrcv_ch; + struct callout abortrcv_ch; #ifdef HIRESTIME int sc_xtimes[22]; /* Times for bits in current xmit packet */ int sc_rtimes[22]; /* Times for bits in current rcv packet */ @@ -402,7 +402,7 @@ static int twattach(idp) sc->sc_port = idp->id_iobase; sc->sc_state = 0; sc->sc_rcount = 0; - callout_handle_init(&sc->abortrcv_ch); + callout_init(&sc->abortrcv_ch); cdevsw_add(&tw_cdevsw, -1, unit); make_dev(&tw_cdevsw, unit, 0, 0, 0600, "tw%d", unit); return (1); @@ -956,13 +956,12 @@ int unit; sc->sc_bits = 0; sc->sc_rphase = newphase; /* 3 cycles of silence = 3/60 = 1/20 = 50 msec */ - sc->abortrcv_ch = timeout(twabortrcv, (caddr_t)sc, hz/20); + callout_reset(&sc->abortrcv_ch, hz / 20, twabortrcv, sc); sc->sc_rcv_time[0] = tv.tv_usec; sc->sc_no_rcv = 1; return; } - untimeout(twabortrcv, (caddr_t)sc, sc->abortrcv_ch); - sc->abortrcv_ch = timeout(twabortrcv, (caddr_t)sc, hz/20); + callout_reset(&sc->abortrcv_ch, hz / 20, twabortrcv, sc); newphase = inb(port + tw_zcport) & tw_zcmask; /* enforce a minimum delay since the last interrupt */ @@ -996,7 +995,7 @@ int unit; */ sc->sc_state &= ~TWS_RCVING; sc->sc_flags |= TW_RCV_ERROR; - untimeout(twabortrcv, (caddr_t)sc, sc->abortrcv_ch); + callout_stop(&sc->abortrcv_ch); log(LOG_ERR, "TWRCV: Invalid start code\n"); twdebugtimes(sc); sc->sc_no_rcv = 0; @@ -1084,7 +1083,7 @@ int unit; } sc->sc_state &= ~TWS_RCVING; twputpkt(sc, pkt); - untimeout(twabortrcv, (caddr_t)sc, sc->abortrcv_ch); + callout_stop(&sc->abortrcv_ch); if(sc->sc_flags & TW_RCV_ERROR) { log(LOG_ERR, "TWRCV: invalid packet: (%d, %x) %c %s\n", sc->sc_rcount, sc->sc_bits, 'A' + pkt[1], X10_KEY_LABEL[pkt[2]]);