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 use usb_delay_ms_locked() in some more ...
details: https://anonhg.NetBSD.org/src/rev/b8d01fd6aa11
branches: jmcneill-usbmp
changeset: 771829:b8d01fd6aa11
user: mrg <mrg%NetBSD.org@localhost>
date: Sat Mar 03 02:29:34 2012 +0000
description:
use usb_delay_ms_locked() in some more places
diffstat:
sys/dev/usb/ohci.c | 18 +++++++-----------
sys/dev/usb/uhci.c | 22 ++++++++++++----------
2 files changed, 19 insertions(+), 21 deletions(-)
diffs (150 lines):
diff -r 813ad82cf691 -r b8d01fd6aa11 sys/dev/usb/ohci.c
--- a/sys/dev/usb/ohci.c Sat Mar 03 02:28:52 2012 +0000
+++ b/sys/dev/usb/ohci.c Sat Mar 03 02:29:34 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ohci.c,v 1.218.6.16 2012/02/26 05:05:44 mrg Exp $ */
+/* $NetBSD: ohci.c,v 1.218.6.17 2012/03/03 02:29:34 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.16 2012/02/26 05:05:44 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.218.6.17 2012/03/03 02:29:34 mrg Exp $");
#include "opt_usb.h"
@@ -2360,7 +2360,8 @@
* use of the xfer. Also make sure the soft interrupt routine
* has run.
*/
- usb_delay_ms(opipe->pipe.device->bus, 20); /* Hardware finishes in 1ms */
+ /* Hardware finishes in 1ms */
+ usb_delay_ms_locked(opipe->pipe.device->bus, 20, &sc->sc_lock);
sc->sc_softwake = 1;
usb_schedsoftintr(&sc->sc_bus);
cv_wait(&sc->sc_softwake_cv, &sc->sc_lock);
@@ -3238,7 +3239,7 @@
* TD is gone.
*/
if (ohcidebug > 5) {
- usb_delay_ms(&sc->sc_bus, 5);
+ usb_delay_ms_locked(&sc->sc_bus, 5, &sc->sc_lock);
DPRINTF(("ohci_device_intr_transfer: status=%x\n",
OREAD4(sc, OHCI_COMMAND_STATUS)));
ohci_dump_ed(sc, sed);
@@ -3290,7 +3291,7 @@
BUS_DMASYNC_PREWRITE | BUS_DMASYNC_PREREAD);
if ((O32TOH(sed->ed.ed_tailp) & OHCI_HEADMASK) !=
(O32TOH(sed->ed.ed_headp) & OHCI_HEADMASK))
- usb_delay_ms(&sc->sc_bus, 2);
+ usb_delay_ms_locked(&sc->sc_bus, 2, &sc->sc_lock);
for (p = sc->sc_eds[pos]; p && p->next != sed; p = p->next)
continue;
@@ -3617,12 +3618,7 @@
#endif
}
- /* XXXMRG is this ok? */
- mutex_exit(&sc->sc_lock);
-
- usb_delay_ms(&sc->sc_bus, OHCI_ITD_NOFFSET);
-
- mutex_enter(&sc->sc_lock);
+ usb_delay_ms_locked(&sc->sc_bus, OHCI_ITD_NOFFSET, &sc->sc_lock);
/* Run callback. */
usb_transfer_complete(xfer);
diff -r 813ad82cf691 -r b8d01fd6aa11 sys/dev/usb/uhci.c
--- a/sys/dev/usb/uhci.c Sat Mar 03 02:28:52 2012 +0000
+++ b/sys/dev/usb/uhci.c Sat Mar 03 02:29:34 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: uhci.c,v 1.240.6.15 2012/02/26 05:05:44 mrg Exp $ */
+/* $NetBSD: uhci.c,v 1.240.6.16 2012/03/03 02:29:34 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.15 2012/02/26 05:05:44 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uhci.c,v 1.240.6.16 2012/03/03 02:29:34 mrg Exp $");
#include "opt_usb.h"
@@ -736,13 +736,13 @@
UWRITE1(sc, UHCI_SOF, sc->sc_saved_sof);
UHCICMD(sc, cmd | UHCI_CMD_FGR); /* force resume */
- usb_delay_ms(&sc->sc_bus, USB_RESUME_DELAY);
+ usb_delay_ms_locked(&sc->sc_bus, USB_RESUME_DELAY, &sc->sc_intr_lock);
UHCICMD(sc, cmd & ~UHCI_CMD_EGSM); /* back to normal */
UWRITE2(sc, UHCI_INTR, UHCI_INTR_TOCRCIE |
UHCI_INTR_RIE | UHCI_INTR_IOCE | UHCI_INTR_SPIE);
UHCICMD(sc, UHCI_CMD_MAXP);
uhci_run(sc, 1); /* and start traffic again */
- usb_delay_ms(&sc->sc_bus, USB_RESUME_RECOVERY);
+ usb_delay_ms_locked(&sc->sc_bus, USB_RESUME_RECOVERY, &sc->sc_intr_lock);
sc->sc_bus.use_polling--;
if (sc->sc_intr_xfer != NULL)
callout_reset(&sc->sc_poll_handle, sc->sc_ival, uhci_poll_hub,
@@ -787,7 +787,7 @@
UWRITE2(sc, UHCI_INTR, 0); /* disable intrs */
UHCICMD(sc, cmd | UHCI_CMD_EGSM); /* enter suspend */
- usb_delay_ms(&sc->sc_bus, USB_RESUME_WAIT);
+ usb_delay_ms_locked(&sc->sc_bus, USB_RESUME_WAIT, &sc->sc_intr_lock);
sc->sc_bus.use_polling--;
mutex_spin_exit(&sc->sc_intr_lock);
@@ -1686,7 +1686,7 @@
xfer->status = USBD_IN_PROGRESS;
for (; timo >= 0; timo--) {
- usb_delay_ms(&sc->sc_bus, 1);
+ usb_delay_ms_locked(&sc->sc_bus, 1, &sc->sc_lock);
DPRINTFN(20,("uhci_waitintr: 0x%04x\n", UREAD2(sc, UHCI_STS)));
if (UREAD2(sc, UHCI_STS) & UHCI_STS_USBINT) {
mutex_spin_enter(&sc->sc_intr_lock);
@@ -1764,7 +1764,7 @@
UREAD2(sc, UHCI_CMD), UREAD2(sc, UHCI_STS)));
return (USBD_NORMAL_COMPLETION);
}
- usb_delay_ms(&sc->sc_bus, 1);
+ usb_delay_ms_locked(&sc->sc_bus, 1, &sc->sc_intr_lock);
}
mutex_spin_exit(&sc->sc_intr_lock);
printf("%s: cannot %s\n", device_xname(sc->sc_dev),
@@ -2192,7 +2192,8 @@
* use of the xfer. Also make sure the soft interrupt routine
* has run.
*/
- usb_delay_ms(upipe->pipe.device->bus, 2); /* Hardware finishes in 1ms */
+ /* Hardware finishes in 1ms */
+ usb_delay_ms_locked(upipe->pipe.device->bus, 2, &sc->sc_lock);
sc->sc_softwake = 1;
usb_schedsoftintr(&sc->sc_bus);
DPRINTFN(1,("uhci_abort_xfer: cv_wait\n"));
@@ -2437,7 +2438,7 @@
* We now have to wait for any activity on the physical
* descriptors to stop.
*/
- usb_delay_ms(&sc->sc_bus, 2);
+ usb_delay_ms_locked(&sc->sc_bus, 2, &sc->sc_lock);
for(i = 0; i < npoll; i++)
uhci_free_sqh(sc, upipe->u.intr.qhs[i]);
@@ -2832,7 +2833,8 @@
sizeof(std->td.td_status),
BUS_DMASYNC_PREWRITE | BUS_DMASYNC_PREREAD);
}
- usb_delay_ms(&sc->sc_bus, 2); /* wait for completion */
+ /* wait for completion */
+ usb_delay_ms_locked(&sc->sc_bus, 2, &sc->sc_lock);
for (i = 0; i < UHCI_VFRAMELIST_COUNT; i++) {
std = iso->stds[i];
Home |
Main Index |
Thread Index |
Old Index