Module Name:    src
Committed By:   mrg
Date:           Thu Feb 23 09:25:04 UTC 2012

Modified Files:
        src/sys/dev/usb [jmcneill-usbmp]: ehci.c ohci.c uhci.c usb.c usbdi.c
            usbdi_util.c usbdivar.h

Log Message:
update a bunch of comments for reality.  usb lock isn't a "thread lock",
which is terminology we copied from the audiomp code.


To generate a diff of this commit:
cvs rdiff -u -r1.181.6.10 -r1.181.6.11 src/sys/dev/usb/ehci.c
cvs rdiff -u -r1.218.6.11 -r1.218.6.12 src/sys/dev/usb/ohci.c
cvs rdiff -u -r1.240.6.10 -r1.240.6.11 src/sys/dev/usb/uhci.c
cvs rdiff -u -r1.125.6.9 -r1.125.6.10 src/sys/dev/usb/usb.c
cvs rdiff -u -r1.134.2.10 -r1.134.2.11 src/sys/dev/usb/usbdi.c
cvs rdiff -u -r1.55.12.1 -r1.55.12.2 src/sys/dev/usb/usbdi_util.c
cvs rdiff -u -r1.93.8.7 -r1.93.8.8 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.10 src/sys/dev/usb/ehci.c:1.181.6.11
--- src/sys/dev/usb/ehci.c:1.181.6.10	Mon Feb 20 22:42:24 2012
+++ src/sys/dev/usb/ehci.c	Thu Feb 23 09:25:04 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: ehci.c,v 1.181.6.10 2012/02/20 22:42:24 mrg Exp $ */
+/*	$NetBSD: ehci.c,v 1.181.6.11 2012/02/23 09:25:04 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.10 2012/02/20 22:42:24 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.181.6.11 2012/02/23 09:25:04 mrg Exp $");
 
 #include "ohci.h"
 #include "uhci.h"
@@ -1406,11 +1406,11 @@ ehci_freex(struct usbd_bus *bus, usbd_xf
 }
 
 Static void
-ehci_get_lock(struct usbd_bus *bus, kmutex_t **thread)
+ehci_get_lock(struct usbd_bus *bus, kmutex_t **lock)
 {
 	struct ehci_softc *sc = bus->hci_private;
 
-	*thread = &sc->sc_lock;
+	*lock = &sc->sc_lock;
 }
 
 Static void
@@ -1811,7 +1811,7 @@ ehci_open(usbd_pipe_handle pipe)
 }
 
 /*
- * Add an ED to the schedule.  Called with USB thread lock held.
+ * Add an ED to the schedule.  Called with USB lock held.
  */
 Static void
 ehci_add_qh(ehci_softc_t *sc, ehci_soft_qh_t *sqh, ehci_soft_qh_t *head)
@@ -1839,7 +1839,7 @@ ehci_add_qh(ehci_softc_t *sc, ehci_soft_
 }
 
 /*
- * Remove an ED from the schedule.  Called with USB thread lock held.
+ * Remove an ED from the schedule.  Called with USB lock held.
  */
 Static void
 ehci_rem_qh(ehci_softc_t *sc, ehci_soft_qh_t *sqh, ehci_soft_qh_t *head)

Index: src/sys/dev/usb/ohci.c
diff -u src/sys/dev/usb/ohci.c:1.218.6.11 src/sys/dev/usb/ohci.c:1.218.6.12
--- src/sys/dev/usb/ohci.c:1.218.6.11	Mon Feb 20 06:50:21 2012
+++ src/sys/dev/usb/ohci.c	Thu Feb 23 09:25:04 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: ohci.c,v 1.218.6.11 2012/02/20 06:50:21 mrg Exp $	*/
+/*	$NetBSD: ohci.c,v 1.218.6.12 2012/02/23 09:25:04 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.11 2012/02/20 06:50:21 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.218.6.12 2012/02/23 09:25:04 mrg Exp $");
 
 #include "opt_usb.h"
 
@@ -991,11 +991,11 @@ ohci_freex(struct usbd_bus *bus, usbd_xf
 }
 
 Static void
-ohci_get_lock(struct usbd_bus *bus, kmutex_t **thread)
+ohci_get_lock(struct usbd_bus *bus, kmutex_t **lock)
 {
 	struct ohci_softc *sc = bus->hci_private;
 
-	*thread = &sc->sc_lock;
+	*lock = &sc->sc_lock;
 }
 
 /*
@@ -1865,7 +1865,7 @@ ohci_device_request(usbd_xfer_handle xfe
 }
 
 /*
- * Add an ED to the schedule.  Called with USB thread lock held.
+ * Add an ED to the schedule.  Called with USB lock held.
  */
 Static void
 ohci_add_ed(ohci_softc_t *sc, ohci_soft_ed_t *sed, ohci_soft_ed_t *head)
@@ -1890,7 +1890,7 @@ ohci_add_ed(ohci_softc_t *sc, ohci_soft_
 }
 
 /*
- * Remove an ED from the schedule.  Called with USB thread lock held.
+ * Remove an ED from the schedule.  Called with USB lock held.
  */
 Static void
 ohci_rem_ed(ohci_softc_t *sc, ohci_soft_ed_t *sed, ohci_soft_ed_t *head)
@@ -1925,7 +1925,7 @@ ohci_rem_ed(ohci_softc_t *sc, ohci_soft_
  */
 
 #define HASH(a) (((a) >> 4) % OHCI_HASH_SIZE)
-/* Called with USB thread lock held. */
+/* Called with USB lock held. */
 void
 ohci_hash_add_td(ohci_softc_t *sc, ohci_soft_td_t *std)
 {
@@ -1936,7 +1936,7 @@ ohci_hash_add_td(ohci_softc_t *sc, ohci_
 	LIST_INSERT_HEAD(&sc->sc_hash_tds[h], std, hnext);
 }
 
-/* Called with USB thread lock held. */
+/* Called with USB lock held. */
 void
 ohci_hash_rem_td(ohci_softc_t *sc, ohci_soft_td_t *std)
 {
@@ -1960,7 +1960,7 @@ ohci_hash_find_td(ohci_softc_t *sc, ohci
 	return (NULL);
 }
 
-/* Called with USB thread lock held. */
+/* Called with USB lock held. */
 void
 ohci_hash_add_itd(ohci_softc_t *sc, ohci_soft_itd_t *sitd)
 {
@@ -1974,7 +1974,7 @@ ohci_hash_add_itd(ohci_softc_t *sc, ohci
 	LIST_INSERT_HEAD(&sc->sc_hash_itds[h], sitd, hnext);
 }
 
-/* Called with USB thread lock held. */
+/* Called with USB lock held. */
 void
 ohci_hash_rem_itd(ohci_softc_t *sc, ohci_soft_itd_t *sitd)
 {

Index: src/sys/dev/usb/uhci.c
diff -u src/sys/dev/usb/uhci.c:1.240.6.10 src/sys/dev/usb/uhci.c:1.240.6.11
--- src/sys/dev/usb/uhci.c:1.240.6.10	Mon Feb 20 06:50:21 2012
+++ src/sys/dev/usb/uhci.c	Thu Feb 23 09:25:04 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: uhci.c,v 1.240.6.10 2012/02/20 06:50:21 mrg Exp $	*/
+/*	$NetBSD: uhci.c,v 1.240.6.11 2012/02/23 09:25:04 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.10 2012/02/20 06:50:21 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uhci.c,v 1.240.6.11 2012/02/23 09:25:04 mrg Exp $");
 
 #include "opt_usb.h"
 
@@ -698,11 +698,11 @@ uhci_freex(struct usbd_bus *bus, usbd_xf
 }
 
 Static void
-uhci_get_lock(struct usbd_bus *bus, kmutex_t **thread)
+uhci_get_lock(struct usbd_bus *bus, kmutex_t **lock)
 {
 	struct uhci_softc *sc = bus->hci_private;
 
-	*thread = &sc->sc_lock;
+	*lock = &sc->sc_lock;
 }
 
 
@@ -1089,7 +1089,7 @@ uhci_rem_loop(uhci_softc_t *sc) {
 	}
 }
 
-/* Add high speed control QH, called with thread lock held. */
+/* Add high speed control QH, called with lock held. */
 void
 uhci_add_hs_ctrl(uhci_softc_t *sc, uhci_soft_qh_t *sqh)
 {
@@ -1116,7 +1116,7 @@ uhci_add_hs_ctrl(uhci_softc_t *sc, uhci_
 #endif
 }
 
-/* Remove high speed control QH, called with thread lock held. */
+/* Remove high speed control QH, called with lock held. */
 void
 uhci_remove_hs_ctrl(uhci_softc_t *sc, uhci_soft_qh_t *sqh)
 {
@@ -1166,7 +1166,7 @@ uhci_remove_hs_ctrl(uhci_softc_t *sc, uh
 		sc->sc_hctl_end = pqh;
 }
 
-/* Add low speed control QH, called with thread lock held. */
+/* Add low speed control QH, called with lock held. */
 void
 uhci_add_ls_ctrl(uhci_softc_t *sc, uhci_soft_qh_t *sqh)
 {
@@ -1189,7 +1189,7 @@ uhci_add_ls_ctrl(uhci_softc_t *sc, uhci_
 	sc->sc_lctl_end = sqh;
 }
 
-/* Remove low speed control QH, called with thread lock held. */
+/* Remove low speed control QH, called with lock held. */
 void
 uhci_remove_ls_ctrl(uhci_softc_t *sc, uhci_soft_qh_t *sqh)
 {
@@ -1223,7 +1223,7 @@ uhci_remove_ls_ctrl(uhci_softc_t *sc, uh
 		sc->sc_lctl_end = pqh;
 }
 
-/* Add bulk QH, called with thread lock held. */
+/* Add bulk QH, called with lock held. */
 void
 uhci_add_bulk(uhci_softc_t *sc, uhci_soft_qh_t *sqh)
 {
@@ -1247,7 +1247,7 @@ uhci_add_bulk(uhci_softc_t *sc, uhci_sof
 	uhci_add_loop(sc);
 }
 
-/* Remove bulk QH, called with thread lock held. */
+/* Remove bulk QH, called with lock held. */
 void
 uhci_remove_bulk(uhci_softc_t *sc, uhci_soft_qh_t *sqh)
 {
@@ -1499,7 +1499,7 @@ uhci_check_intr(uhci_softc_t *sc, uhci_i
 	uhci_idone(ii);
 }
 
-/* Called with USB thread lock held. */
+/* Called with USB lock held. */
 void
 uhci_idone(uhci_intr_info_t *ii)
 {

Index: src/sys/dev/usb/usb.c
diff -u src/sys/dev/usb/usb.c:1.125.6.9 src/sys/dev/usb/usb.c:1.125.6.10
--- src/sys/dev/usb/usb.c:1.125.6.9	Mon Feb 20 06:50:21 2012
+++ src/sys/dev/usb/usb.c	Thu Feb 23 09:25:04 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: usb.c,v 1.125.6.9 2012/02/20 06:50:21 mrg Exp $	*/
+/*	$NetBSD: usb.c,v 1.125.6.10 2012/02/23 09:25:04 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.9 2012/02/20 06:50:21 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usb.c,v 1.125.6.10 2012/02/23 09:25:04 mrg Exp $");
 
 #include "opt_compat_netbsd.h"
 #include "opt_usb.h"
@@ -420,7 +420,7 @@ usb_event_thread(void *arg)
 		cv_signal(&sc->sc_bus->needs_explore_cv);
 		mutex_exit(sc->sc_bus->lock);
 	} else
-		wakeup(sc);
+		wakeup(sc);	/* XXXSMP ok */
 
 	DPRINTF(("usb_event_thread: exit\n"));
 	kthread_exit(0);
@@ -839,7 +839,7 @@ usb_needs_explore(usbd_device_handle dev
 		cv_signal(&dev->bus->needs_explore_cv);
 		mutex_exit(dev->bus->lock);
 	} else
-		wakeup(&dev->bus->needs_explore);
+		wakeup(&dev->bus->needs_explore);	/* XXXSMP ok */
 }
 
 void
@@ -854,7 +854,7 @@ usb_needs_reattach(usbd_device_handle de
 		cv_signal(&dev->bus->needs_explore_cv);
 		mutex_exit(dev->bus->lock);
 	} else
-		wakeup(&dev->bus->needs_explore);
+		wakeup(&dev->bus->needs_explore);	/* XXXSMP ok */
 }
 
 /* Called at with usb_event_lock held. */
@@ -1038,7 +1038,7 @@ usb_detach(device_t self, int flags)
 			    sc->sc_bus->lock, hz * 60);
 			mutex_exit(sc->sc_bus->lock);
 		} else {
-			wakeup(&sc->sc_bus->needs_explore);
+			wakeup(&sc->sc_bus->needs_explore);	/* XXXSMP ok */
 			tsleep(sc, PWAIT, "usbdet", hz * 60);
 		}
 	}

Index: src/sys/dev/usb/usbdi.c
diff -u src/sys/dev/usb/usbdi.c:1.134.2.10 src/sys/dev/usb/usbdi.c:1.134.2.11
--- src/sys/dev/usb/usbdi.c:1.134.2.10	Mon Feb 20 22:42:47 2012
+++ src/sys/dev/usb/usbdi.c	Thu Feb 23 09:25:04 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: usbdi.c,v 1.134.2.10 2012/02/20 22:42:47 mrg Exp $	*/
+/*	$NetBSD: usbdi.c,v 1.134.2.11 2012/02/23 09:25:04 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.10 2012/02/20 22:42:47 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usbdi.c,v 1.134.2.11 2012/02/23 09:25:04 mrg Exp $");
 
 #include "opt_compat_netbsd.h"
 #include "opt_usb.h"
@@ -756,7 +756,7 @@ usbd_ar_pipe(usbd_pipe_handle pipe)
 	return (USBD_NORMAL_COMPLETION);
 }
 
-/* Called with USB thread lock held. */
+/* Called with USB lock held. */
 void
 usb_transfer_complete(usbd_xfer_handle xfer)
 {
@@ -861,7 +861,7 @@ usb_transfer_complete(usbd_xfer_handle x
 		if (pipe->device->bus->lock)
 			cv_broadcast(&xfer->cv);
 		else
-			wakeup(xfer);
+			wakeup(xfer);	/* XXXSMP ok */
 	}
 
 	if (!repeat) {
@@ -873,7 +873,7 @@ usb_transfer_complete(usbd_xfer_handle x
 	}
 }
 
-/* Called with USB thread lock held. */
+/* Called with USB lock held. */
 usbd_status
 usb_insert_transfer(usbd_xfer_handle xfer)
 {
@@ -903,7 +903,7 @@ usb_insert_transfer(usbd_xfer_handle xfe
 	return (err);
 }
 
-/* Called with USB thread lock held. */
+/* Called with USB lock held. */
 void
 usbd_start_next(usbd_pipe_handle pipe)
 {

Index: src/sys/dev/usb/usbdi_util.c
diff -u src/sys/dev/usb/usbdi_util.c:1.55.12.1 src/sys/dev/usb/usbdi_util.c:1.55.12.2
--- src/sys/dev/usb/usbdi_util.c:1.55.12.1	Thu Dec  8 03:10:09 2011
+++ src/sys/dev/usb/usbdi_util.c	Thu Feb 23 09:25:03 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: usbdi_util.c,v 1.55.12.1 2011/12/08 03:10:09 mrg Exp $	*/
+/*	$NetBSD: usbdi_util.c,v 1.55.12.2 2012/02/23 09:25:03 mrg Exp $	*/
 
 /*
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: usbdi_util.c,v 1.55.12.1 2011/12/08 03:10:09 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usbdi_util.c,v 1.55.12.2 2012/02/23 09:25:03 mrg Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -425,7 +425,7 @@ usbd_bulk_transfer_cb(usbd_xfer_handle x
 	if (xfer->pipe->device->bus->lock)
 		cv_broadcast(&xfer->cv);
 	else
-		wakeup(xfer);
+		wakeup(xfer);	/* XXXSMP ok */
 }
 
 usbd_status
@@ -474,7 +474,7 @@ usbd_intr_transfer_cb(usbd_xfer_handle x
 	if (xfer->pipe->device->bus->lock)
 		cv_broadcast(&xfer->cv);
 	else
-		wakeup(xfer);
+		wakeup(xfer);	/* XXXSMP ok */
 }
 
 usbd_status

Index: src/sys/dev/usb/usbdivar.h
diff -u src/sys/dev/usb/usbdivar.h:1.93.8.7 src/sys/dev/usb/usbdivar.h:1.93.8.8
--- src/sys/dev/usb/usbdivar.h:1.93.8.7	Mon Feb 20 22:43:12 2012
+++ src/sys/dev/usb/usbdivar.h	Thu Feb 23 09:25:03 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: usbdivar.h,v 1.93.8.7 2012/02/20 22:43:12 mrg Exp $	*/
+/*	$NetBSD: usbdivar.h,v 1.93.8.8 2012/02/23 09:25:03 mrg Exp $	*/
 /*	$FreeBSD: src/sys/dev/usb/usbdivar.h,v 1.11 1999/11/17 22:33:51 n_hibma Exp $	*/
 
 /*
@@ -37,28 +37,26 @@
 /*
  * Discussion about locking in the USB code:
  *
- * This is one lock presented by the host controller: the thread lock.
- * Host controller drivers are expected to manage interrupt state
- * internally.
+ * The host controller presents one lock at IPL_USB.
  *
  * List of hardware interface methods, and which locks are held when each
  * is called by this module:
  *
- *	BUS METHOD		THREAD  NOTES
+ *	BUS METHOD		LOCK  NOTES
  *	----------------------- -------	-------------------------
- *	open_pipe		-	might want to take thread lock?
+ *	open_pipe		-	might want to take lock?
  *	soft_intr		x
- *	do_poll			-	might want to take thread lock?
+ *	do_poll			-	might want to take lock?
  *	allocm			-
  *	freem			-
  *	allocx			-
  *	freex			-
  *	get_lock 		-	Called at attach time
  *
- *	PIPE METHOD		THREAD  NOTES
+ *	PIPE METHOD		LOCK  NOTES
  *	----------------------- -------	-------------------------
  *	transfer		-
- *	start			-	Might want to take this?
+ *	start			-	might want to take lock?
  *	abort			x
  *	close			x
  *	cleartoggle		-
@@ -66,8 +64,8 @@
  *
  * The above semantics are likely to change.
  * 
- * USB functions known to expect the thread lock taken include (this
- * list is probably not exhaustive):
+ * USB functions known to expect the lock taken include (this list is
+ * probably not exhaustive):
  *    usb_transfer_complete()
  *    usb_insert_transfer()
  *    usb_start_next()

Reply via email to