Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/usb Fix several botches:



details:   https://anonhg.NetBSD.org/src/rev/ccc2826777d3
branches:  trunk
changeset: 755833:ccc2826777d3
user:      tsutsui <tsutsui%NetBSD.org@localhost>
date:      Thu Jun 24 14:39:57 2010 +0000

description:
Fix several botches:
 * in axe_detach():
  * call callout_destroy(9) after axe_stop() which calls callout_stop(9)
    (otherwise gets panic on DIAGNOSTIC and LOCK_DEBUG kernel)
  * no need to call usbd_abort_pipe() that are done in axe_stop()
  * no need to call usb_detach_wait() twice
  * also destroy axe_mii_lock mutex
 * in axe_tick_task():
  * fix an inverted logic

diffstat:

 sys/dev/usb/if_axe.c |  22 +++++-----------------
 1 files changed, 5 insertions(+), 17 deletions(-)

diffs (62 lines):

diff -r e092d087f316 -r ccc2826777d3 sys/dev/usb/if_axe.c
--- a/sys/dev/usb/if_axe.c      Thu Jun 24 12:58:48 2010 +0000
+++ b/sys/dev/usb/if_axe.c      Thu Jun 24 14:39:57 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_axe.c,v 1.35 2010/06/23 19:00:26 pgoyette Exp $     */
+/*     $NetBSD: if_axe.c,v 1.36 2010/06/24 14:39:57 tsutsui Exp $      */
 /*     $OpenBSD: if_axe.c,v 1.96 2010/01/09 05:33:08 jsg Exp $ */
 
 /*
@@ -89,7 +89,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_axe.c,v 1.35 2010/06/23 19:00:26 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_axe.c,v 1.36 2010/06/24 14:39:57 tsutsui Exp $");
 
 #if defined(__NetBSD__)
 #include "opt_inet.h"
@@ -755,17 +755,8 @@
        if (!sc->axe_attached)
                return 0;
 
-       callout_destroy(&sc->axe_stat_ch);
-
        sc->axe_dying = 1;
 
-       if (sc->axe_ep[AXE_ENDPT_TX] != NULL)
-               usbd_abort_pipe(sc->axe_ep[AXE_ENDPT_TX]);
-       if (sc->axe_ep[AXE_ENDPT_RX] != NULL)
-               usbd_abort_pipe(sc->axe_ep[AXE_ENDPT_RX]);
-       if (sc->axe_ep[AXE_ENDPT_INTR] != NULL)
-               usbd_abort_pipe(sc->axe_ep[AXE_ENDPT_INTR]);
-
        /*
         * Remove any pending tasks.  They cannot be executing because they run
         * in the same thread as detach.
@@ -775,14 +766,11 @@
 
        s = splusb();
 
-       if (--sc->axe_refcnt >= 0) {
-               /* Wait for processes to go away */
-               usb_detach_wait((sc->axe_dev));
-       }
-
        if (ifp->if_flags & IFF_RUNNING)
                axe_stop(ifp, 1);
 
+       callout_destroy(&sc->axe_stat_ch);
+       mutex_destroy(&sc->axe_mii_lock);
 #if NRND > 0
        rnd_detach_source(&sc->rnd_source);
 #endif
@@ -1149,7 +1137,7 @@
                DPRINTF(("%s: %s: got link\n", device_xname(sc->axe_dev),
                    __func__));
                sc->axe_link++;
-               if (!IFQ_IS_EMPTY(&ifp->if_snd) == 0)
+               if (!IFQ_IS_EMPTY(&ifp->if_snd))
                        axe_start(ifp);
        }
 



Home | Main Index | Thread Index | Old Index