From 5a837b22e59f1ac206d016f4142b7ae261afb387 Mon Sep 17 00:00:00 2001 From: Bruce Evans Date: Sun, 20 Apr 1997 15:36:12 +0000 Subject: [PATCH] Fixed the type of timeout functions and removed casts that hid the type mismatches. There was no problem in practice (at least on 386's). --- sys/dev/si/si.c | 14 +++++++------- sys/i386/isa/lpt.c | 14 ++++++++------ sys/i386/isa/si.c | 14 +++++++------- sys/i386/isa/tw.c | 13 +++++++------ sys/netatalk/aarp.c | 7 ++++--- sys/netatalk/at_control.c | 2 +- sys/netatalk/at_extern.h | 2 +- 7 files changed, 35 insertions(+), 31 deletions(-) diff --git a/sys/dev/si/si.c b/sys/dev/si/si.c index 5d8429b04ef0..cb2c4524f2d2 100644 --- a/sys/dev/si/si.c +++ b/sys/dev/si/si.c @@ -30,7 +30,7 @@ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN * NO EVENT SHALL THE AUTHORS BE LIABLE. * - * $Id: si.c,v 1.56 1997/03/23 03:35:01 bde Exp $ + * $Id: si.c,v 1.57 1997/03/24 12:02:48 bde Exp $ */ #ifndef lint @@ -98,7 +98,7 @@ static int si_modem __P((struct si_port *, enum si_mctl, int)); static void si_write_enable __P((struct si_port *, int)); static int si_Sioctl __P((dev_t, int, caddr_t, int, struct proc *)); static void si_start __P((struct tty *)); -static void si_lstart __P((struct si_port *)); +static timeout_t si_lstart; static void si_disc_optim __P((struct tty *tp, struct termios *t, struct si_port *pp)); static void sihardclose __P((struct si_port *pp)); @@ -914,7 +914,7 @@ siclose(dev, flag, mode, p) /* ok. we are now still on the right track.. nuke the hardware */ if (pp->sp_state & SS_LSTART) { - untimeout((timeout_func_t)si_lstart, (caddr_t)pp); + untimeout(si_lstart, (caddr_t)pp); pp->sp_state &= ~SS_LSTART; } @@ -2118,12 +2118,12 @@ si_start(tp) } if ((pp->sp_state & (SS_LSTART|SS_INLSTART)) == SS_LSTART) { - untimeout((timeout_func_t)si_lstart, (caddr_t)pp); + untimeout(si_lstart, (caddr_t)pp); } else { pp->sp_state |= SS_LSTART; } DPRINT((pp, DBG_START, "arming lstart, time=%d\n", time)); - timeout((timeout_func_t)si_lstart, (caddr_t)pp, time); + timeout(si_lstart, (caddr_t)pp, time); } out: @@ -2138,9 +2138,9 @@ si_start(tp) * time for protocols like ppp. */ static void -si_lstart(pp) - register struct si_port *pp; +si_lstart(void *arg) { + register struct si_port *pp = arg; register struct tty *tp; int oldspl; diff --git a/sys/i386/isa/lpt.c b/sys/i386/isa/lpt.c index 7c21b2091907..2e2cb8ee415f 100644 --- a/sys/i386/isa/lpt.c +++ b/sys/i386/isa/lpt.c @@ -46,7 +46,7 @@ * SUCH DAMAGE. * * from: unknown origin, 386BSD 0.1 - * $Id: lpt.c,v 1.58 1997/02/22 09:36:51 peter Exp $ + * $Id: lpt.c,v 1.59 1997/03/24 11:33:00 bde Exp $ */ /* @@ -259,7 +259,7 @@ static struct lpt_softc { #define MAX_SLEEP (hz*5) /* Timeout while waiting for device ready */ #define MAX_SPIN 20 /* Max delay for device ready in usecs */ -static void lptout (struct lpt_softc * sc); +static timeout_t lptout; static int lptprobe (struct isa_device *dvp); static int lptattach (struct isa_device *isdp); @@ -566,7 +566,7 @@ lptopen (dev_t dev, int flags, int fmt, struct proc *p) lprintf("irq %x\n", sc->sc_irq); if (sc->sc_irq & LP_USE_IRQ) { sc->sc_state |= TOUT; - timeout ((timeout_func_t)lptout, (caddr_t)sc, + timeout (lptout, (caddr_t)sc, (sc->sc_backoff = hz/LPTOUTINITIAL)); } @@ -575,15 +575,17 @@ lptopen (dev_t dev, int flags, int fmt, struct proc *p) } static void -lptout (struct lpt_softc * sc) -{ int pl; +lptout (void *arg) +{ + struct lpt_softc *sc = arg; + int pl; lprintf ("T %x ", inb(sc->sc_port+lpt_status)); if (sc->sc_state & OPEN) { sc->sc_backoff++; if (sc->sc_backoff > hz/LPTOUTMAX) sc->sc_backoff = sc->sc_backoff > hz/LPTOUTMAX; - timeout ((timeout_func_t)lptout, (caddr_t)sc, sc->sc_backoff); + timeout (lptout, (caddr_t)sc, sc->sc_backoff); } else sc->sc_state &= ~TOUT; diff --git a/sys/i386/isa/si.c b/sys/i386/isa/si.c index 5d8429b04ef0..cb2c4524f2d2 100644 --- a/sys/i386/isa/si.c +++ b/sys/i386/isa/si.c @@ -30,7 +30,7 @@ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN * NO EVENT SHALL THE AUTHORS BE LIABLE. * - * $Id: si.c,v 1.56 1997/03/23 03:35:01 bde Exp $ + * $Id: si.c,v 1.57 1997/03/24 12:02:48 bde Exp $ */ #ifndef lint @@ -98,7 +98,7 @@ static int si_modem __P((struct si_port *, enum si_mctl, int)); static void si_write_enable __P((struct si_port *, int)); static int si_Sioctl __P((dev_t, int, caddr_t, int, struct proc *)); static void si_start __P((struct tty *)); -static void si_lstart __P((struct si_port *)); +static timeout_t si_lstart; static void si_disc_optim __P((struct tty *tp, struct termios *t, struct si_port *pp)); static void sihardclose __P((struct si_port *pp)); @@ -914,7 +914,7 @@ siclose(dev, flag, mode, p) /* ok. we are now still on the right track.. nuke the hardware */ if (pp->sp_state & SS_LSTART) { - untimeout((timeout_func_t)si_lstart, (caddr_t)pp); + untimeout(si_lstart, (caddr_t)pp); pp->sp_state &= ~SS_LSTART; } @@ -2118,12 +2118,12 @@ si_start(tp) } if ((pp->sp_state & (SS_LSTART|SS_INLSTART)) == SS_LSTART) { - untimeout((timeout_func_t)si_lstart, (caddr_t)pp); + untimeout(si_lstart, (caddr_t)pp); } else { pp->sp_state |= SS_LSTART; } DPRINT((pp, DBG_START, "arming lstart, time=%d\n", time)); - timeout((timeout_func_t)si_lstart, (caddr_t)pp, time); + timeout(si_lstart, (caddr_t)pp, time); } out: @@ -2138,9 +2138,9 @@ si_start(tp) * time for protocols like ppp. */ static void -si_lstart(pp) - register struct si_port *pp; +si_lstart(void *arg) { + register struct si_port *pp = arg; register struct tty *tp; int oldspl; diff --git a/sys/i386/isa/tw.c b/sys/i386/isa/tw.c index 2a5a7f7cc7c8..a30d5b45439e 100644 --- a/sys/i386/isa/tw.c +++ b/sys/i386/isa/tw.c @@ -254,7 +254,7 @@ static void twdelayn(int n); static void twsetuptimes(int *a); static int wait_for_zero(struct tw_sc *sc); static int twgetbytes(struct tw_sc *sc, u_char *p, int cnt); -static void twabortrcv(struct tw_sc *sc); +static timeout_t twabortrcv; static int twsend(struct tw_sc *sc, int h, int k, int cnt); static int next_zero(struct tw_sc *sc); static int twputpkt(struct tw_sc *sc, u_char *p); @@ -805,9 +805,10 @@ int cnt; */ static void -twabortrcv(sc) - struct tw_sc *sc; +twabortrcv(arg) + void *arg; { + struct tw_sc *sc = arg; int s; u_char pkt[3]; @@ -861,7 +862,7 @@ int unit; else sc->sc_flags = 0; sc->sc_bits = 0; sc->sc_rphase = newphase; - timeout((timeout_func_t)twabortrcv, (caddr_t)sc, hz/4); + timeout(twabortrcv, (caddr_t)sc, hz/4); return; } /* @@ -888,7 +889,7 @@ int unit; twputpkt(sc, pkt); wakeup((caddr_t)sc); */ - untimeout((timeout_func_t)twabortrcv, (caddr_t)sc); + untimeout(twabortrcv, (caddr_t)sc); log(LOG_ERR, "TWRCV: Invalid start code\n"); return; } @@ -961,7 +962,7 @@ int unit; } sc->sc_state &= ~TWS_RCVING; twputpkt(sc, pkt); - untimeout((timeout_func_t)twabortrcv, (caddr_t)sc); + untimeout(twabortrcv, (caddr_t)sc); if(sc->sc_flags & TW_RCV_ERROR) log(LOG_ERR, "TWRCV: invalid packet: (%d, %x)\n", sc->sc_rcount, sc->sc_bits); diff --git a/sys/netatalk/aarp.c b/sys/netatalk/aarp.c index d81d1774bc08..7a9a71cb6e21 100644 --- a/sys/netatalk/aarp.c +++ b/sys/netatalk/aarp.c @@ -367,7 +367,7 @@ at_aarpinput( struct arpcom *ac, struct mbuf *m) * probed for the same address we'd like to use. Change the * address we're probing for. */ - untimeout((timeout_func_t) aarpprobe, ac ); + untimeout( aarpprobe, ac ); wakeup( aa ); m_freem( m ); return; @@ -518,8 +518,9 @@ aarptnew( addr ) void -aarpprobe( struct arpcom *ac ) +aarpprobe( void *arg ) { + struct arpcom *ac = arg; struct mbuf *m; struct ether_header *eh; struct ether_aarp *ea; @@ -551,7 +552,7 @@ aarpprobe( struct arpcom *ac ) wakeup( aa ); return; } else { - timeout( (timeout_func_t)aarpprobe, (caddr_t)ac, hz / 5 ); + timeout( aarpprobe, (caddr_t)ac, hz / 5 ); } if (( m = m_gethdr( M_DONTWAIT, MT_DATA )) == NULL ) { diff --git a/sys/netatalk/at_control.c b/sys/netatalk/at_control.c index ec3b997ed36e..16ef7c630e45 100644 --- a/sys/netatalk/at_control.c +++ b/sys/netatalk/at_control.c @@ -516,7 +516,7 @@ at_ifinit( ifp, aa, sat ) * start off the probes as an asynchronous activity. * though why wait 200mSec? */ - timeout( (timeout_func_t)aarpprobe, (caddr_t)ifp, hz / 5 ); + timeout( aarpprobe, (caddr_t)ifp, hz / 5 ); if ( tsleep( aa, PPAUSE|PCATCH, "at_ifinit", 0 )) { /* * theoretically we shouldn't time out here diff --git a/sys/netatalk/at_extern.h b/sys/netatalk/at_extern.h index 7e9478f13af8..c25ca11811cc 100644 --- a/sys/netatalk/at_extern.h +++ b/sys/netatalk/at_extern.h @@ -1,6 +1,6 @@ #ifdef _NETINET_IF_ETHER_H_ -extern void aarpprobe __P((struct arpcom *)); +extern timeout_t aarpprobe; extern int aarpresolve __P((struct arpcom *, struct mbuf *, struct sockaddr_at *,