Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/usb make this work with lockdebug. while here, set u...



details:   https://anonhg.NetBSD.org/src/rev/170405538b50
branches:  trunk
changeset: 784098:170405538b50
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Fri Jan 18 01:41:07 2013 +0000

description:
make this work with lockdebug. while here, set urtwn_debug=0 now that
USB_DEBUG implies URTWN_DEBUG

diffstat:

 sys/dev/usb/if_urtwn.c    |  44 ++++++++++++++++++++++----------------------
 sys/dev/usb/if_urtwnvar.h |   3 ++-
 2 files changed, 24 insertions(+), 23 deletions(-)

diffs (121 lines):

diff -r 3468fcd93e07 -r 170405538b50 sys/dev/usb/if_urtwn.c
--- a/sys/dev/usb/if_urtwn.c    Thu Jan 17 23:21:20 2013 +0000
+++ b/sys/dev/usb/if_urtwn.c    Fri Jan 18 01:41:07 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_urtwn.c,v 1.9 2013/01/05 23:34:18 christos Exp $    */
+/*     $NetBSD: if_urtwn.c,v 1.10 2013/01/18 01:41:07 jmcneill Exp $   */
 /*     $OpenBSD: if_urtwn.c,v 1.20 2011/11/26 06:39:33 ckuethe Exp $   */
 
 /*-
@@ -22,7 +22,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_urtwn.c,v 1.9 2013/01/05 23:34:18 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_urtwn.c,v 1.10 2013/01/18 01:41:07 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/sockio.h>
@@ -78,7 +78,7 @@
 #define        DBG_RF          __BIT(5)
 #define        DBG_REG         __BIT(6)
 #define        DBG_ALL         0xffffffffU
-u_int urtwn_debug = DBG_TX|DBG_RX|DBG_STM;
+u_int urtwn_debug = 0;
 #define DPRINTFN(n, s) \
        do { if (urtwn_debug & (n)) printf s; } while (/*CONSTCOND*/0)
 #else
@@ -407,6 +407,10 @@
                ieee80211_ifdetach(&sc->sc_ic);
                if_detach(ifp);
 
+               /* Free Tx/Rx buffers. */
+               urtwn_free_tx_list(sc);
+               urtwn_free_rx_list(sc);
+       
                /* Abort and close Tx/Rx pipes. */
                urtwn_close_pipes(sc);
        }
@@ -582,7 +586,6 @@
 
        DPRINTFN(DBG_FN, ("%s: %s\n", device_xname(sc->sc_dev), __func__));
 
-       mutex_enter(&sc->sc_tx_mtx);
        TAILQ_INIT(&sc->tx_free_list);
        for (i = 0; i < URTWN_TX_LIST_COUNT; i++) {
                data = &sc->tx_data[i];
@@ -608,12 +611,10 @@
                /* Append this Tx buffer to our free list. */
                TAILQ_INSERT_TAIL(&sc->tx_free_list, data, next);
        }
-       mutex_exit(&sc->sc_tx_mtx);
        return (0);
 
  fail:
        urtwn_free_tx_list(sc);
-       mutex_exit(&sc->sc_tx_mtx);
        return (error);
 }
 
@@ -3515,18 +3516,21 @@
        sc->fwcur = 0;
        mutex_exit(&sc->sc_fwcmd_mtx);
 
-       /* Allocate Tx/Rx buffers. */
-       error = urtwn_alloc_rx_list(sc);
-       if (error != 0) {
-               aprint_error_dev(sc->sc_dev,
-                   "could not allocate Rx buffers\n");
-               goto fail;
-       }
-       error = urtwn_alloc_tx_list(sc);
-       if (error != 0) {
-               aprint_error_dev(sc->sc_dev,
-                   "could not allocate Tx buffers\n");
-               goto fail;
+       if (!(sc->sc_flags & URTWN_FLAG_INIT_ONCE)) {
+               /* Allocate Tx/Rx buffers. */
+               error = urtwn_alloc_rx_list(sc);
+               if (error != 0) {
+                       aprint_error_dev(sc->sc_dev,
+                           "could not allocate Rx buffers\n");
+                       goto fail;
+               }
+               error = urtwn_alloc_tx_list(sc);
+               if (error != 0) {
+                       aprint_error_dev(sc->sc_dev,
+                           "could not allocate Tx buffers\n");
+                       goto fail;
+               }
+               sc->sc_flags |= URTWN_FLAG_INIT_ONCE;
        }
 
        /* Power on adapter. */
@@ -3739,10 +3743,6 @@
        /* Stop Rx pipe. */
        usbd_abort_pipe(sc->rx_pipe);
 
-       /* Free Tx/Rx buffers. */
-       urtwn_free_tx_list(sc);
-       urtwn_free_rx_list(sc);
-
        if (disable)
                urtwn_chip_stop(sc);
 }
diff -r 3468fcd93e07 -r 170405538b50 sys/dev/usb/if_urtwnvar.h
--- a/sys/dev/usb/if_urtwnvar.h Thu Jan 17 23:21:20 2013 +0000
+++ b/sys/dev/usb/if_urtwnvar.h Fri Jan 18 01:41:07 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_urtwnvar.h,v 1.2 2012/08/20 07:32:49 christos Exp $ */
+/*     $NetBSD: if_urtwnvar.h,v 1.3 2013/01/18 01:41:07 jmcneill Exp $ */
 /*     $OpenBSD: if_urtwnreg.h,v 1.3 2010/11/16 18:02:59 damien Exp $  */
 
 /*-
@@ -117,6 +117,7 @@
 #define URTWN_FLAG_CCK_HIPWR   __BIT(0)
 #define        URTWN_FLAG_ATTACHED     __BIT(1)
 #define        URTWN_FLAG_FWREADY      __BIT(2)
+#define URTWN_FLAG_INIT_ONCE   __BIT(3)
        int                             sc_dying;
 
        struct usb_task                 sc_task;



Home | Main Index | Thread Index | Old Index