Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/ic Correct xfer->busy_free status in DIAGNOSTIC.



details:   https://anonhg.NetBSD.org/src/rev/9c2fe95a46d8
branches:  trunk
changeset: 536124:9c2fe95a46d8
user:      isaki <isaki%NetBSD.org@localhost>
date:      Sun Sep 08 07:58:14 2002 +0000

description:
Correct xfer->busy_free status in DIAGNOSTIC.

diffstat:

 sys/dev/ic/sl811hs.c |  30 +++++++++++++++++++++++++-----
 1 files changed, 25 insertions(+), 5 deletions(-)

diffs (62 lines):

diff -r eb729535ffb3 -r 9c2fe95a46d8 sys/dev/ic/sl811hs.c
--- a/sys/dev/ic/sl811hs.c      Sun Sep 08 07:52:41 2002 +0000
+++ b/sys/dev/ic/sl811hs.c      Sun Sep 08 07:58:14 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sl811hs.c,v 1.1 2002/08/11 13:17:53 isaki Exp $        */
+/*     $NetBSD: sl811hs.c,v 1.2 2002/09/08 07:58:14 isaki Exp $        */
 
 /*
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -44,7 +44,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sl811hs.c,v 1.1 2002/08/11 13:17:53 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sl811hs.c,v 1.2 2002/09/08 07:58:14 isaki Exp $");
 
 #include "opt_slhci.h"
 
@@ -569,13 +569,24 @@
        DPRINTF(D_MEM, ("SLallocx"));
 
        xfer = SIMPLEQ_FIRST(&sc->sc_free_xfers);
-       if (xfer)
+       if (xfer) {
                SIMPLEQ_REMOVE_HEAD(&sc->sc_free_xfers, next);
-       else
+#ifdef DIAGNOSTIC
+               if (xfer->busy_free != XFER_FREE) {
+                       printf("slhci_allocx: xfer=%p not free, 0x%08x\n",
+                               xfer, xfer->busy_free);
+               }
+#endif
+       } else {
                xfer = malloc(sizeof(*xfer), M_USB, M_NOWAIT);
+       }
 
-       if (xfer)
+       if (xfer) {
                memset(xfer, 0, sizeof(*xfer));
+#ifdef DIAGNOSTIC
+               xfer->busy_free = XFER_BUSY;
+#endif
+       }
 
        return xfer;
 }
@@ -586,6 +597,15 @@
        struct slhci_softc *sc = (struct slhci_softc *)bus;
 
        DPRINTF(D_MEM, ("SLfreex"));
+
+#ifdef DIAGNOSTIC
+       if (xfer->busy_free != XFER_BUSY) {
+               printf("slhci_freex: xfer=%p not busy, 0x%08x\n",
+                       xfer, xfer->busy_free);
+               return;
+       }
+       xfer->busy_free = XFER_FREE;
+#endif
        SIMPLEQ_INSERT_HEAD(&sc->sc_free_xfers, xfer, next);
 }
 



Home | Main Index | Thread Index | Old Index