Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/ic Don't use sleep() and a callout; just use tsleep().



details:   https://anonhg.NetBSD.org/src/rev/e60dbfcada24
branches:  trunk
changeset: 486647:e60dbfcada24
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Sat May 27 04:46:24 2000 +0000

description:
Don't use sleep() and a callout; just use tsleep().

diffstat:

 sys/dev/ic/tropic.c    |  28 ++++++----------------------
 sys/dev/ic/tropicvar.h |   3 +--
 2 files changed, 7 insertions(+), 24 deletions(-)

diffs (102 lines):

diff -r bfdaddb2ad26 -r e60dbfcada24 sys/dev/ic/tropic.c
--- a/sys/dev/ic/tropic.c       Sat May 27 04:42:14 2000 +0000
+++ b/sys/dev/ic/tropic.c       Sat May 27 04:46:24 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tropic.c,v 1.7 2000/03/23 07:01:32 thorpej Exp $       */
+/*     $NetBSD: tropic.c,v 1.8 2000/05/27 04:46:24 thorpej Exp $       */
 
 /* 
  * Ported to NetBSD by Onno van der Linden
@@ -88,7 +88,6 @@
 void   tr_oldxint __P((struct tr_softc *));
 struct mbuf *tr_get __P((struct tr_softc *, int, struct ifnet *));
 void   tr_opensap __P((struct tr_softc *, u_char));
-void   tr_timeout __P((void *));
 int    tr_mbcopy __P((struct tr_softc *, bus_size_t, struct mbuf *));
 void   tr_bcopy __P((struct tr_softc *, u_char *, int));
 void   tr_start __P((struct ifnet *));
@@ -442,7 +441,6 @@
        bpfattach(&ifp->if_bpf, ifp, DLT_IEEE802, sizeof(struct token_header));
 #endif
 
-       callout_init(&sc->sc_timeout_callout);
        callout_init(&sc->sc_init_callout);
        callout_init(&sc->sc_reinit_callout);
 
@@ -894,7 +892,6 @@
                                                    sc->sc_xmit_buffers);
 #endif
                                                sc->sc_xmit_correlator = 0;
-                                               callout_stop(&sc->sc_timeout_callout);
                                                wakeup(&sc->tr_sleepevent);
                                        }
                                        else
@@ -924,12 +921,10 @@
                                        ifp->if_flags &= ~IFF_RUNNING;
                                        ifp->if_flags &= ~IFF_UP;
                                        ifp->if_flags &= ~IFF_OACTIVE;
-                                       callout_stop(&sc->sc_timeout_callout);
                                        wakeup(&sc->tr_sleepevent);
                                }
                                break;
                        case DIR_SET_DEFAULT_RING_SPEED:
-                               callout_stop(&sc->sc_timeout_callout);
                                wakeup(&sc->tr_sleepevent);
                                break;
 
@@ -942,7 +937,6 @@
                                                SRB_OPNSAP_STATIONID);
                                printf("%s: Token Ring opened\n",
                                    sc->sc_dev.dv_xname);
-                               callout_stop(&sc->sc_timeout_callout);
                                wakeup(&sc->tr_sleepevent);
                                break;
 /* XXX DLC_CLOSE_SAP not needed ? */
@@ -1717,8 +1711,11 @@
 tr_sleep(sc)
 struct tr_softc *sc;
 {
-       callout_reset(&sc->sc_timeout_callout, hz * 30, tr_timeout, sc);
-       sleep(&sc->tr_sleepevent, 1);
+       int error;
+
+       error = tsleep(&sc->tr_sleepevent, 1, "trsleep", hz * 30);
+       if (error == EWOULDBLOCK)
+               printf("%s: sleep event timeout\n", sc->sc_dev.dv_xname);
 }
 
 void
@@ -1732,16 +1729,3 @@
 
        tr_reset(sc);
 }
-
-/*
- *  tr_timeout - timeout routine if adapter does not open in 30 seconds
- */
-void
-tr_timeout(arg)
-void   *arg;
-{
-       struct tr_softc *sc = arg;
-
-       printf("Token Ring timeout\n");
-       wakeup(&sc->tr_sleepevent);
-}
diff -r bfdaddb2ad26 -r e60dbfcada24 sys/dev/ic/tropicvar.h
--- a/sys/dev/ic/tropicvar.h    Sat May 27 04:42:14 2000 +0000
+++ b/sys/dev/ic/tropicvar.h    Sat May 27 04:46:24 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tropicvar.h,v 1.5 2000/03/23 07:01:33 thorpej Exp $    */
+/*     $NetBSD: tropicvar.h,v 1.6 2000/05/27 04:46:56 thorpej Exp $    */
 
 /* 
  * Mach Operating System
@@ -71,7 +71,6 @@
        bus_space_handle_t sc_sramh;    /* handle for the shared ram area */
        bus_space_handle_t sc_mmioh;    /* handle for the bios/mmio area */
 
-       struct callout sc_timeout_callout;
        struct callout sc_init_callout;
        struct callout sc_reinit_callout;
 



Home | Main Index | Thread Index | Old Index