Module Name: src Committed By: mrg Date: Mon Feb 20 06:50:22 UTC 2012
Modified Files: src/sys/dev/usb [jmcneill-usbmp]: ehci.c ohci.c uhci.c usb.c usbdi.c usbdivar.h Log Message: remove the intr_lock from the mp usb api, it wasn't used. To generate a diff of this commit: cvs rdiff -u -r1.181.6.8 -r1.181.6.9 src/sys/dev/usb/ehci.c cvs rdiff -u -r1.218.6.10 -r1.218.6.11 src/sys/dev/usb/ohci.c cvs rdiff -u -r1.240.6.9 -r1.240.6.10 src/sys/dev/usb/uhci.c cvs rdiff -u -r1.125.6.8 -r1.125.6.9 src/sys/dev/usb/usb.c cvs rdiff -u -r1.134.2.8 -r1.134.2.9 src/sys/dev/usb/usbdi.c cvs rdiff -u -r1.93.8.5 -r1.93.8.6 src/sys/dev/usb/usbdivar.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/dev/usb/ehci.c diff -u src/sys/dev/usb/ehci.c:1.181.6.8 src/sys/dev/usb/ehci.c:1.181.6.9 --- src/sys/dev/usb/ehci.c:1.181.6.8 Mon Feb 20 04:05:44 2012 +++ src/sys/dev/usb/ehci.c Mon Feb 20 06:50:20 2012 @@ -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 void ehci_freem(struct usbd_bus 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 @@ Static const struct usbd_bus_methods ehc .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 @@ ehci_freex(struct usbd_bus *bus, usbd_xf } 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; } Index: src/sys/dev/usb/ohci.c diff -u src/sys/dev/usb/ohci.c:1.218.6.10 src/sys/dev/usb/ohci.c:1.218.6.11 --- src/sys/dev/usb/ohci.c:1.218.6.10 Mon Feb 20 03:23:26 2012 +++ src/sys/dev/usb/ohci.c Mon Feb 20 06:50:21 2012 @@ -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 void ohci_freem(struct usbd_bus 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 @@ Static const struct usbd_bus_methods ohc .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 @@ ohci_freex(struct usbd_bus *bus, usbd_xf } 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; } Index: src/sys/dev/usb/uhci.c diff -u src/sys/dev/usb/uhci.c:1.240.6.9 src/sys/dev/usb/uhci.c:1.240.6.10 --- src/sys/dev/usb/uhci.c:1.240.6.9 Mon Feb 20 04:25:54 2012 +++ src/sys/dev/usb/uhci.c Mon Feb 20 06:50:21 2012 @@ -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 void uhci_freem(struct usbd_bus 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 @@ const struct usbd_bus_methods uhci_bus_m .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 @@ uhci_freex(struct usbd_bus *bus, usbd_xf } 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; } Index: src/sys/dev/usb/usb.c diff -u src/sys/dev/usb/usb.c:1.125.6.8 src/sys/dev/usb/usb.c:1.125.6.9 --- src/sys/dev/usb/usb.c:1.125.6.8 Mon Feb 20 04:06:13 2012 +++ src/sys/dev/usb/usb.c Mon Feb 20 06:50:21 2012 @@ -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 @@ usb_doattach(device_t self) 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 @@ usb_doattach(device_t self) } 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"); Index: src/sys/dev/usb/usbdi.c diff -u src/sys/dev/usb/usbdi.c:1.134.2.8 src/sys/dev/usb/usbdi.c:1.134.2.9 --- src/sys/dev/usb/usbdi.c:1.134.2.8 Mon Feb 20 05:09:36 2012 +++ src/sys/dev/usb/usbdi.c Mon Feb 20 06:50:21 2012 @@ -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 @@ usbd_alloc_xfer(usbd_device_handle dev) 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)); Index: src/sys/dev/usb/usbdivar.h diff -u src/sys/dev/usb/usbdivar.h:1.93.8.5 src/sys/dev/usb/usbdivar.h:1.93.8.6 --- src/sys/dev/usb/usbdivar.h:1.93.8.5 Mon Feb 20 02:12:24 2012 +++ src/sys/dev/usb/usbdivar.h Mon Feb 20 06:50:21 2012 @@ -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 @@ struct usbd_bus_methods { 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 @@ struct usbd_bus { 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];