Source-Changes-HG archive

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

[src/jmcneill-usbmp]: src/sys/dev/usb remove the intr_lock from the mp usb ap...



details:   https://anonhg.NetBSD.org/src/rev/d60a10591870
branches:  jmcneill-usbmp
changeset: 771802:d60a10591870
user:      mrg <mrg%NetBSD.org@localhost>
date:      Mon Feb 20 06:50:20 2012 +0000

description:
remove the intr_lock from the mp usb api, it wasn't used.

diffstat:

 sys/dev/usb/ehci.c     |  12 +++++-------
 sys/dev/usb/ohci.c     |  12 +++++-------
 sys/dev/usb/uhci.c     |  12 +++++-------
 sys/dev/usb/usb.c      |  11 +++++------
 sys/dev/usb/usbdi.c    |   6 +++---
 sys/dev/usb/usbdivar.h |  49 +++++++++++++++++++++++--------------------------
 6 files changed, 46 insertions(+), 56 deletions(-)

diffs (299 lines):

diff -r 5ed541b18880 -r d60a10591870 sys/dev/usb/ehci.c
--- a/sys/dev/usb/ehci.c        Mon Feb 20 05:24:42 2012 +0000
+++ b/sys/dev/usb/ehci.c        Mon Feb 20 06:50:20 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ehci.c,v 1.181.6.8 2012/02/20 04:05:44 mrg Exp $ */
+/*     $NetBSD: ehci.c,v 1.181.6.9 2012/02/20 06:50:20 mrg Exp $ */
 
 /*
  * Copyright (c) 2004-2011 The NetBSD Foundation, Inc.
@@ -53,7 +53,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.181.6.8 2012/02/20 04:05:44 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.181.6.9 2012/02/20 06:50:20 mrg Exp $");
 
 #include "ohci.h"
 #include "uhci.h"
@@ -153,8 +153,7 @@
 
 Static usbd_xfer_handle        ehci_allocx(struct usbd_bus *);
 Static void            ehci_freex(struct usbd_bus *, usbd_xfer_handle);
-Static void            ehci_get_locks(struct usbd_bus *, kmutex_t **,
-                                      kmutex_t **);
+Static void            ehci_get_lock(struct usbd_bus *, kmutex_t **);
 
 Static usbd_status     ehci_root_ctrl_transfer(usbd_xfer_handle);
 Static usbd_status     ehci_root_ctrl_start(usbd_xfer_handle);
@@ -269,7 +268,7 @@
        .freem =        ehci_freem,
        .allocx =       ehci_allocx,
        .freex =        ehci_freex,
-       .get_locks =    ehci_get_locks,
+       .get_lock =     ehci_get_lock,
 };
 
 Static const struct usbd_pipe_methods ehci_root_ctrl_methods = {
@@ -1407,11 +1406,10 @@
 }
 
 Static void
-ehci_get_locks(struct usbd_bus *bus, kmutex_t **intr, kmutex_t **thread)
+ehci_get_lock(struct usbd_bus *bus, kmutex_t **thread)
 {
        struct ehci_softc *sc = bus->hci_private;
 
-       *intr = &sc->sc_intr_lock;
        *thread = &sc->sc_lock;
 }
 
diff -r 5ed541b18880 -r d60a10591870 sys/dev/usb/ohci.c
--- a/sys/dev/usb/ohci.c        Mon Feb 20 05:24:42 2012 +0000
+++ b/sys/dev/usb/ohci.c        Mon Feb 20 06:50:20 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ohci.c,v 1.218.6.10 2012/02/20 03:23:26 mrg Exp $      */
+/*     $NetBSD: ohci.c,v 1.218.6.11 2012/02/20 06:50:21 mrg Exp $      */
 /*     $FreeBSD: src/sys/dev/usb/ohci.c,v 1.22 1999/11/17 22:33:40 n_hibma Exp $       */
 
 /*
@@ -42,7 +42,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.218.6.10 2012/02/20 03:23:26 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.218.6.11 2012/02/20 06:50:21 mrg Exp $");
 
 #include "opt_usb.h"
 
@@ -137,8 +137,7 @@
 
 Static usbd_xfer_handle        ohci_allocx(struct usbd_bus *);
 Static void            ohci_freex(struct usbd_bus *, usbd_xfer_handle);
-Static void            ohci_get_locks(struct usbd_bus *, kmutex_t **,
-                                      kmutex_t **);
+Static void            ohci_get_lock(struct usbd_bus *, kmutex_t **);
 
 Static usbd_status     ohci_root_ctrl_transfer(usbd_xfer_handle);
 Static usbd_status     ohci_root_ctrl_start(usbd_xfer_handle);
@@ -279,7 +278,7 @@
        .freem =        ohci_freem,
        .allocx =       ohci_allocx,
        .freex =        ohci_freex,
-       .get_locks =    ohci_get_locks,
+       .get_lock =     ohci_get_lock,
 };
 
 Static const struct usbd_pipe_methods ohci_root_ctrl_methods = {
@@ -992,11 +991,10 @@
 }
 
 Static void
-ohci_get_locks(struct usbd_bus *bus, kmutex_t **intr, kmutex_t **thread)
+ohci_get_lock(struct usbd_bus *bus, kmutex_t **thread)
 {
        struct ohci_softc *sc = bus->hci_private;
 
-       *intr = &sc->sc_intr_lock;
        *thread = &sc->sc_lock;
 }
 
diff -r 5ed541b18880 -r d60a10591870 sys/dev/usb/uhci.c
--- a/sys/dev/usb/uhci.c        Mon Feb 20 05:24:42 2012 +0000
+++ b/sys/dev/usb/uhci.c        Mon Feb 20 06:50:20 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uhci.c,v 1.240.6.9 2012/02/20 04:25:54 mrg Exp $       */
+/*     $NetBSD: uhci.c,v 1.240.6.10 2012/02/20 06:50:21 mrg Exp $      */
 /*     $FreeBSD: src/sys/dev/usb/uhci.c,v 1.33 1999/11/17 22:33:41 n_hibma Exp $       */
 
 /*
@@ -43,7 +43,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uhci.c,v 1.240.6.9 2012/02/20 04:25:54 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uhci.c,v 1.240.6.10 2012/02/20 06:50:21 mrg Exp $");
 
 #include "opt_usb.h"
 
@@ -172,8 +172,7 @@
 
 Static usbd_xfer_handle        uhci_allocx(struct usbd_bus *);
 Static void            uhci_freex(struct usbd_bus *, usbd_xfer_handle);
-Static void            uhci_get_locks(struct usbd_bus *, kmutex_t **,
-                                      kmutex_t **);
+Static void            uhci_get_lock(struct usbd_bus *, kmutex_t **);
 
 Static usbd_status     uhci_device_ctrl_transfer(usbd_xfer_handle);
 Static usbd_status     uhci_device_ctrl_start(usbd_xfer_handle);
@@ -291,7 +290,7 @@
        .freem =        uhci_freem,
        .allocx =       uhci_allocx,
        .freex =        uhci_freex,
-       .get_locks =    uhci_get_locks,
+       .get_lock =     uhci_get_lock,
 };
 
 const struct usbd_pipe_methods uhci_root_ctrl_methods = {
@@ -699,11 +698,10 @@
 }
 
 Static void
-uhci_get_locks(struct usbd_bus *bus, kmutex_t **intr, kmutex_t **thread)
+uhci_get_lock(struct usbd_bus *bus, kmutex_t **thread)
 {
        struct uhci_softc *sc = bus->hci_private;
 
-       *intr = &sc->sc_intr_lock;
        *thread = &sc->sc_lock;
 }
 
diff -r 5ed541b18880 -r d60a10591870 sys/dev/usb/usb.c
--- a/sys/dev/usb/usb.c Mon Feb 20 05:24:42 2012 +0000
+++ b/sys/dev/usb/usb.c Mon Feb 20 06:50:20 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: usb.c,v 1.125.6.8 2012/02/20 04:06:13 mrg Exp $        */
+/*     $NetBSD: usb.c,v 1.125.6.9 2012/02/20 06:50:21 mrg Exp $        */
 
 /*
  * Copyright (c) 1998, 2002, 2008 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: usb.c,v 1.125.6.8 2012/02/20 04:06:13 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usb.c,v 1.125.6.9 2012/02/20 06:50:21 mrg Exp $");
 
 #include "opt_compat_netbsd.h"
 #include "opt_usb.h"
@@ -220,7 +220,7 @@
        usbd_status err;
        int speed;
        struct usb_event *ue;
-       bool mpsafe = sc->sc_bus->methods->get_locks ? true : false;
+       bool mpsafe = sc->sc_bus->methods->get_lock ? true : false;
 
        DPRINTF(("usbd_doattach\n"));
 
@@ -240,10 +240,9 @@
        }
 
        if (mpsafe) {
-               sc->sc_bus->methods->get_locks(sc->sc_bus,
-                   &sc->sc_bus->intr_lock, &sc->sc_bus->lock);
+               sc->sc_bus->methods->get_lock(sc->sc_bus, &sc->sc_bus->lock);
        } else {
-               sc->sc_bus->intr_lock = sc->sc_bus->lock = NULL;
+               sc->sc_bus->lock = NULL;
        }
        cv_init(&sc->sc_bus->needs_explore_cv, "usbevt");
 
diff -r 5ed541b18880 -r d60a10591870 sys/dev/usb/usbdi.c
--- a/sys/dev/usb/usbdi.c       Mon Feb 20 05:24:42 2012 +0000
+++ b/sys/dev/usb/usbdi.c       Mon Feb 20 06:50:20 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: usbdi.c,v 1.134.2.8 2012/02/20 05:09:36 mrg Exp $      */
+/*     $NetBSD: usbdi.c,v 1.134.2.9 2012/02/20 06:50:21 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.8 2012/02/20 05:09:36 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usbdi.c,v 1.134.2.9 2012/02/20 06:50:21 mrg Exp $");
 
 #include "opt_compat_netbsd.h"
 #include "opt_usb.h"
@@ -388,7 +388,7 @@
                return (NULL);
        xfer->device = dev;
        callout_init(&xfer->timeout_handle,
-           dev->bus->methods->get_locks ? CALLOUT_MPSAFE : 0);
+           dev->bus->methods->get_lock ? CALLOUT_MPSAFE : 0);
        cv_init(&xfer->cv, "usbxfer");
        cv_init(&xfer->hccv, "usbhcxfer");
        DPRINTFN(5,("usbd_alloc_xfer() = %p\n", xfer));
diff -r 5ed541b18880 -r d60a10591870 sys/dev/usb/usbdivar.h
--- a/sys/dev/usb/usbdivar.h    Mon Feb 20 05:24:42 2012 +0000
+++ b/sys/dev/usb/usbdivar.h    Mon Feb 20 06:50:20 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: usbdivar.h,v 1.93.8.5 2012/02/20 02:12:24 mrg Exp $    */
+/*     $NetBSD: usbdivar.h,v 1.93.8.6 2012/02/20 06:50:21 mrg Exp $    */
 /*     $FreeBSD: src/sys/dev/usb/usbdivar.h,v 1.11 1999/11/17 22:33:51 n_hibma Exp $   */
 
 /*
@@ -37,33 +37,32 @@
 /*
  * Discussion about locking in the USB code:
  *
- * There are two locks presented by the host controller: the interrupt lock
- * and the thread lock.  The interrupt lock, either a spin or adaptive mutex,
- * manages hardware state and anything else touched in an interrupt context.
- * The thread lock has everything else.  
+ * This is one lock presented by the host controller: the thread lock.
+ * Host controller drivers are expected to manage interrupt state
+ * internally.
  *
  * List of hardware interface methods, and which locks are held when each
  * is called by this module:
  *
- *     BUS METHOD              INTR    THREAD  NOTES
- *     ----------------------- ------- ------- -------------------------
- *     open_pipe               -       -       might want to take thread lock?
- *     soft_intr               -       x       sometimes called with intr lock also held -- perhaps a problem?
- *     do_poll                 -       -       might want to take thread lock?
- *     allocm                  -       -
- *     freem                   -       -
- *     allocx                  -       -
- *     freex                   -       -
- *     get_locks               -       -       Called at attach time
+ *     BUS METHOD              THREAD  NOTES
+ *     ----------------------- ------- -------------------------
+ *     open_pipe               -       might want to take thread lock?
+ *     soft_intr               x
+ *     do_poll                 -       might want to take thread lock?
+ *     allocm                  -
+ *     freem                   -
+ *     allocx                  -
+ *     freex                   -
+ *     get_lock                -       Called at attach time
  *
- *     PIPE METHOD             INTR    THREAD  NOTES
- *     ----------------------- ------- ------- -------------------------
- *     transfer                -       -
- *     start                   -       -
- *     abort                   -       x
- *     close                   -       x
- *     cleartoggle             -       -
- *     done                    -       x
+ *     PIPE METHOD             THREAD  NOTES
+ *     ----------------------- ------- -------------------------
+ *     transfer                -
+ *     start                   -       Might want to take this?
+ *     abort                   x
+ *     close                   x
+ *     cleartoggle             -
+ *     done                    x
  *
  * The above semantics are likely to change.
  * 
@@ -99,8 +98,7 @@
        void                  (*freem)(struct usbd_bus *, usb_dma_t *);
        struct usbd_xfer *    (*allocx)(struct usbd_bus *);
        void                  (*freex)(struct usbd_bus *, struct usbd_xfer *);
-       void                  (*get_locks)(struct usbd_bus *,
-                                       kmutex_t **, kmutex_t **);
+       void                  (*get_lock)(struct usbd_bus *, kmutex_t **);
 };
 
 struct usbd_pipe_methods {
@@ -147,7 +145,6 @@
        const struct usbd_bus_methods *methods;
        u_int32_t               pipe_size; /* size of a pipe struct */
        /* Filled by usb driver */
-       kmutex_t                *intr_lock;
        kmutex_t                *lock;
        struct usbd_device      *root_hub;
        usbd_device_handle      devices[USB_MAX_DEVICES];



Home | Main Index | Thread Index | Old Index