Source-Changes-HG archive

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

[src/mrg-ohci-jmcneill-usbmp]: src/sys/dev/usb sync usb_subr.c and usbdivar.h...



details:   https://anonhg.NetBSD.org/src/rev/d5a8040e9258
branches:  mrg-ohci-jmcneill-usbmp
changeset: 771777:d5a8040e9258
user:      mrg <mrg%NetBSD.org@localhost>
date:      Thu Dec 08 22:04:56 2011 +0000

description:
sync usb_subr.c and usbdivar.h with the branch entirely, and most of
usbdi.c as well.

diffstat:

 sys/dev/usb/usb_subr.c |  11 ++---------
 sys/dev/usb/usbdi.c    |  19 ++++++++++---------
 sys/dev/usb/usbdivar.h |   7 +------
 3 files changed, 13 insertions(+), 24 deletions(-)

diffs (136 lines):

diff -r fc03e2e47194 -r d5a8040e9258 sys/dev/usb/usb_subr.c
--- a/sys/dev/usb/usb_subr.c    Thu Dec 08 20:21:31 2011 +0000
+++ b/sys/dev/usb/usb_subr.c    Thu Dec 08 22:04:56 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: usb_subr.c,v 1.180.6.1.2.3 2011/12/08 10:41:28 mrg Exp $       */
+/*     $NetBSD: usb_subr.c,v 1.180.6.1.2.4 2011/12/08 22:04:56 mrg Exp $       */
 /*     $FreeBSD: src/sys/dev/usb/usb_subr.c,v 1.18 1999/11/17 22:33:47 n_hibma Exp $   */
 
 /*
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: usb_subr.c,v 1.180.6.1.2.3 2011/12/08 10:41:28 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usb_subr.c,v 1.180.6.1.2.4 2011/12/08 22:04:56 mrg Exp $");
 
 #include "opt_compat_netbsd.h"
 #include "opt_usbverbose.h"
@@ -751,13 +751,6 @@
                free(p, M_USB);
                return (err);
        }
-#if 1
-       if (dev->bus->methods->get_locks) {
-               dev->bus->methods->get_locks(dev->bus, &p->intr_lock, &p->lock);
-       } else {
-               p->intr_lock = p->lock = NULL;
-       }
-#endif
        *pipe = p;
        return (USBD_NORMAL_COMPLETION);
 }
diff -r fc03e2e47194 -r d5a8040e9258 sys/dev/usb/usbdi.c
--- a/sys/dev/usb/usbdi.c       Thu Dec 08 20:21:31 2011 +0000
+++ b/sys/dev/usb/usbdi.c       Thu Dec 08 22:04:56 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: usbdi.c,v 1.134.2.1.2.3 2011/12/08 20:21:31 mrg Exp $  */
+/*     $NetBSD: usbdi.c,v 1.134.2.1.2.4 2011/12/08 22:04:56 mrg Exp $  */
 /*     $FreeBSD: src/sys/dev/usb/usbdi.c,v 1.28 1999/11/17 22:33:49 n_hibma Exp $      */
 
 /*
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: usbdi.c,v 1.134.2.1.2.3 2011/12/08 20:21:31 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usbdi.c,v 1.134.2.1.2.4 2011/12/08 22:04:56 mrg Exp $");
 
 #include "opt_compat_netbsd.h"
 #include "opt_usb.h"
@@ -229,7 +229,6 @@
 usbd_status
 usbd_close_pipe(usbd_pipe_handle pipe)
 {
-       //int s;
 
 #ifdef DIAGNOSTIC
        if (pipe == NULL) {
@@ -238,7 +237,6 @@
        }
 #endif
 
-       //usbd_lock_pipe(pipe);
        if (--pipe->refcnt != 0)
                return (USBD_NORMAL_COMPLETION);
        if (! SIMPLEQ_EMPTY(&pipe->queue))
@@ -246,7 +244,6 @@
        LIST_REMOVE(pipe, next);
        pipe->endpoint->refcnt--;
        pipe->methods->close(pipe);
-       //usbd_lock_pipe(pipe);
        if (pipe->intrxfer != NULL)
                usbd_free_xfer(pipe->intrxfer);
        free(pipe, M_USB);
@@ -319,8 +316,8 @@
                if (pipe->device->bus->use_polling)
                        panic("usbd_transfer: not done");
 
-               if (pipe->lock)
-                       cv_wait(&xfer->cv, pipe->lock);
+               if (pipe->device->bus->lock)
+                       cv_wait(&xfer->cv, pipe->device->bus->lock);
                else
                        tsleep(xfer, PRIBIO, "usbsyn", 0);
        }
@@ -838,9 +835,11 @@
 
        if (repeat) {
                if (xfer->callback) {
-                       if (pipe->lock) mutex_exit(pipe->lock);
+                       if (pipe->device->bus->lock)
+                               mutex_exit(pipe->device->bus->lock);
                        xfer->callback(xfer, xfer->priv, xfer->status);
-                       if (pipe->lock) mutex_enter(pipe->lock);
+                       if (pipe->device->bus->lock)
+                               mutex_enter(pipe->device->bus->lock);
                }
                pipe->methods->done(xfer);
        } else {
@@ -909,6 +908,8 @@
        usbd_xfer_handle xfer;
        usbd_status err;
 
+       KASSERT(pipe->device->bus->lock == NULL || mutex_owned(pipe->device->bus->lock));
+
 #ifdef DIAGNOSTIC
        if (pipe == NULL) {
                printf("usbd_start_next: pipe == NULL\n");
diff -r fc03e2e47194 -r d5a8040e9258 sys/dev/usb/usbdivar.h
--- a/sys/dev/usb/usbdivar.h    Thu Dec 08 20:21:31 2011 +0000
+++ b/sys/dev/usb/usbdivar.h    Thu Dec 08 22:04:56 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: usbdivar.h,v 1.93.8.1.2.2 2011/12/08 10:41:28 mrg Exp $        */
+/*     $NetBSD: usbdivar.h,v 1.93.8.1.2.3 2011/12/08 22:04:56 mrg Exp $        */
 /*     $FreeBSD: src/sys/dev/usb/usbdivar.h,v 1.11 1999/11/17 22:33:51 n_hibma Exp $   */
 
 /*
@@ -215,9 +215,6 @@
        char                    repeat;
        int                     interval;
 
-       kmutex_t                *intr_lock;
-       kmutex_t                *lock;
-
        /* Filled by HC driver. */
        const struct usbd_pipe_methods *methods;
 };
@@ -304,8 +301,6 @@
 void           usb_needs_reattach(usbd_device_handle);
 void           usb_schedsoftintr(struct usbd_bus *);
 
-#define usbd_lock(m)   if (m) { s = -1; mutex_enter(m); } else s = splusb()
-#define usbd_unlock(m) if (m) { s = -1; mutex_exit(m); } else splx(s)
 #define usbd_lock_pipe(p)      do { \
        if ((p)->device->bus->lock) { \
                s = -1; \



Home | Main Index | Thread Index | Old Index