Test callout_pending(), not callout_active(), and eliminate now-unnecessary

callout_deactivate() calls.
This commit is contained in:
thorpej 2003-02-03 23:50:59 +00:00
parent c09e8e04cb
commit 882dec6ba3
9 changed files with 24 additions and 33 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: cd.c,v 1.176 2003/01/23 00:00:33 bad Exp $ */
/* $NetBSD: cd.c,v 1.177 2003/02/03 23:50:59 thorpej Exp $ */
/*-
* Copyright (c) 1998, 2001 The NetBSD Foundation, Inc.
@ -54,7 +54,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: cd.c,v 1.176 2003/01/23 00:00:33 bad Exp $");
__KERNEL_RCSID(0, "$NetBSD: cd.c,v 1.177 2003/02/03 23:50:59 thorpej Exp $");
#include "rnd.h"
@ -966,7 +966,7 @@ int cd_interpret_sense(xs)
SC_DEBUG(periph, SCSIPI_DB1, ("Waiting 5 sec for CD "
"spinup\n"));
if (!callout_active(&periph->periph_callout))
if (!callout_pending(&periph->periph_callout))
scsipi_periph_freeze(periph, 1);
callout_reset(&periph->periph_callout,
5 * hz, scsipi_periph_timed_thaw, periph);

View File

@ -1,4 +1,4 @@
/* $NetBSD: scsipi_base.c,v 1.83 2003/01/20 04:08:44 simonb Exp $ */
/* $NetBSD: scsipi_base.c,v 1.84 2003/02/03 23:51:00 thorpej Exp $ */
/*-
* Copyright (c) 1998, 1999, 2000, 2002 The NetBSD Foundation, Inc.
@ -38,7 +38,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: scsipi_base.c,v 1.83 2003/01/20 04:08:44 simonb Exp $");
__KERNEL_RCSID(0, "$NetBSD: scsipi_base.c,v 1.84 2003/02/03 23:51:00 thorpej Exp $");
#include "opt_scsi.h"
@ -1526,7 +1526,7 @@ scsipi_complete(xs)
if ((xs->xs_control & XS_CTL_POLL) ||
(chan->chan_flags & SCSIPI_CHAN_TACTIVE) == 0) {
delay(1000000);
} else if (!callout_active(&periph->periph_callout)) {
} else if (!callout_pending(&periph->periph_callout)) {
scsipi_periph_freeze(periph, 1);
callout_reset(&periph->periph_callout,
hz, scsipi_periph_timed_thaw, periph);

View File

@ -1,4 +1,4 @@
/* $NetBSD: sd.c,v 1.194 2003/01/23 00:00:33 bad Exp $ */
/* $NetBSD: sd.c,v 1.195 2003/02/03 23:51:00 thorpej Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -54,7 +54,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: sd.c,v 1.194 2003/01/23 00:00:33 bad Exp $");
__KERNEL_RCSID(0, "$NetBSD: sd.c,v 1.195 2003/02/03 23:51:00 thorpej Exp $");
#include "opt_scsi.h"
#include "opt_bufq.h"
@ -1288,7 +1288,7 @@ sd_interpret_sense(xs)
*/
printf("%s: waiting for pack to spin up...\n",
sd->sc_dev.dv_xname);
if (!callout_active(&periph->periph_callout))
if (!callout_pending(&periph->periph_callout))
scsipi_periph_freeze(periph, 1);
callout_reset(&periph->periph_callout,
5 * hz, scsipi_periph_timed_thaw, periph);

View File

@ -1,4 +1,4 @@
/* $NetBSD: st.c,v 1.158 2002/10/23 09:13:51 jdolecek Exp $ */
/* $NetBSD: st.c,v 1.159 2003/02/03 23:51:01 thorpej Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
* All rights reserved.
@ -56,7 +56,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: st.c,v 1.158 2002/10/23 09:13:51 jdolecek Exp $");
__KERNEL_RCSID(0, "$NetBSD: st.c,v 1.159 2003/02/03 23:51:01 thorpej Exp $");
#include "opt_scsi.h"
@ -2105,7 +2105,7 @@ st_interpret_sense(xs)
if (key == SKEY_NOT_READY && st->asc == 0x4 && st->ascq == 0x1) {
/* Not Ready, Logical Unit Is in Process Of Becoming Ready */
if (!callout_active(&periph->periph_callout))
if (!callout_pending(&periph->periph_callout))
scsipi_periph_freeze(periph, 1);
callout_reset(&periph->periph_callout,
hz, scsipi_periph_timed_thaw, periph);

View File

@ -1,4 +1,4 @@
/* $NetBSD: bridgestp.c,v 1.2 2001/11/12 23:49:34 lukem Exp $ */
/* $NetBSD: bridgestp.c,v 1.3 2003/02/03 23:51:03 thorpej Exp $ */
/*
* Copyright (c) 2000 Jason L. Wright (jason@thought.net)
@ -40,7 +40,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: bridgestp.c,v 1.2 2001/11/12 23:49:34 lukem Exp $");
__KERNEL_RCSID(0, "$NetBSD: bridgestp.c,v 1.3 2003/02/03 23:51:03 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -851,7 +851,7 @@ bstp_initialization(struct bridge_softc *sc)
bstp_timer_stop(&sc->sc_tcn_timer);
bstp_timer_stop(&sc->sc_topology_change_timer);
if (callout_active(&sc->sc_bstpcallout) == 0)
if (callout_pending(&sc->sc_bstpcallout) == 0)
callout_reset(&sc->sc_bstpcallout, hz,
bstp_tick, sc);

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_ethersubr.c,v 1.102 2003/01/22 11:47:05 jmmv Exp $ */
/* $NetBSD: if_ethersubr.c,v 1.103 2003/02/03 23:51:03 thorpej Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@ -65,7 +65,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if_ethersubr.c,v 1.102 2003/01/22 11:47:05 jmmv Exp $");
__KERNEL_RCSID(0, "$NetBSD: if_ethersubr.c,v 1.103 2003/02/03 23:51:03 thorpej Exp $");
#include "opt_inet.h"
#include "opt_atalk.h"
@ -808,7 +808,7 @@ ether_input(struct ifnet *ifp, struct mbuf *m)
IF_ENQUEUE(inq, m);
splx(s);
#ifndef __HAVE_GENERIC_SOFT_INTERRUPTS
if (!callout_active(&pppoe_softintr))
if (!callout_pending(&pppoe_softintr))
callout_reset(&pppoe_softintr, 1, pppoe_softintr_handler, NULL);
#else
softintr_schedule(pppoe_softintr);

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_pppoe.c,v 1.37 2003/01/07 20:02:10 martin Exp $ */
/* $NetBSD: if_pppoe.c,v 1.38 2003/02/03 23:51:03 thorpej Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc.
@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if_pppoe.c,v 1.37 2003/01/07 20:02:10 martin Exp $");
__KERNEL_RCSID(0, "$NetBSD: if_pppoe.c,v 1.38 2003/02/03 23:51:03 thorpej Exp $");
#include "pppoe.h"
#include "bpfilter.h"
@ -346,7 +346,6 @@ void pppoe_softintr_handler(void *dummy)
{
int s = splnet();
pppoe_input();
callout_deactivate(&pppoe_softintr);
splx(s);
}
#endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: tcp_timer.c,v 1.61 2002/11/24 10:55:03 scw Exp $ */
/* $NetBSD: tcp_timer.c,v 1.62 2003/02/03 23:51:04 thorpej Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@ -102,7 +102,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: tcp_timer.c,v 1.61 2002/11/24 10:55:03 scw Exp $");
__KERNEL_RCSID(0, "$NetBSD: tcp_timer.c,v 1.62 2003/02/03 23:51:04 thorpej Exp $");
#include "opt_inet.h"
#include "opt_tcp_debug.h"
@ -268,8 +268,6 @@ tcp_timer_rexmt(void *arg)
s = splsoftnet();
callout_deactivate(&tp->t_timer[TCPT_REXMT]);
#ifdef TCP_DEBUG
#ifdef INET
if (tp->t_inpcb)
@ -417,8 +415,6 @@ tcp_timer_persist(void *arg)
s = splsoftnet();
callout_deactivate(&tp->t_timer[TCPT_PERSIST]);
#ifdef TCP_DEBUG
#ifdef INET
if (tp->t_inpcb)
@ -481,8 +477,6 @@ tcp_timer_keep(void *arg)
s = splsoftnet();
callout_deactivate(&tp->t_timer[TCPT_KEEP]);
#ifdef TCP_DEBUG
ostate = tp->t_state;
#endif /* TCP_DEBUG */
@ -565,8 +559,6 @@ tcp_timer_2msl(void *arg)
s = splsoftnet();
callout_deactivate(&tp->t_timer[TCPT_2MSL]);
#ifdef TCP_DEBUG
#ifdef INET
if (tp->t_inpcb)

View File

@ -1,4 +1,4 @@
/* $NetBSD: tcp_timer.h,v 1.17 2001/11/04 13:42:28 matt Exp $ */
/* $NetBSD: tcp_timer.h,v 1.18 2003/02/03 23:51:04 thorpej Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@ -165,7 +165,7 @@ char *tcptimers[] =
callout_stop(&(tp)->t_timer[(timer)])
#define TCP_TIMER_ISARMED(tp, timer) \
callout_active(&(tp)->t_timer[(timer)])
callout_pending(&(tp)->t_timer[(timer)])
/*
* Force a time value to be in a certain range.