Fix several nits. Mostly from SOMEYA Yoshihiko.

- Call usbd_transfer_complete at splusb.
- Fix a botched for loop in ohci_rem_ed.
- In ohci_close_pipe, wait 1ms after removing an ED to avoid possible race
 condition.
This commit is contained in:
toshii 2002-12-07 07:14:28 +00:00
parent 384b45d203
commit 44f269f8ff
1 changed files with 9 additions and 3 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: ohci.c,v 1.132 2002/12/07 06:52:11 toshii Exp $ */ /* $NetBSD: ohci.c,v 1.133 2002/12/07 07:14:28 toshii Exp $ */
/* $FreeBSD: src/sys/dev/usb/ohci.c,v 1.22 1999/11/17 22:33:40 n_hibma Exp $ */ /* $FreeBSD: src/sys/dev/usb/ohci.c,v 1.22 1999/11/17 22:33:40 n_hibma Exp $ */
/* /*
@ -46,7 +46,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.132 2002/12/07 06:52:11 toshii Exp $"); __KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.133 2002/12/07 07:14:28 toshii Exp $");
#include <sys/param.h> #include <sys/param.h>
#include <sys/systm.h> #include <sys/systm.h>
@ -1331,7 +1331,9 @@ ohci_softintr(void *v)
xfer->actlen += len; xfer->actlen += len;
if (std->flags & OHCI_CALL_DONE) { if (std->flags & OHCI_CALL_DONE) {
xfer->status = USBD_NORMAL_COMPLETION; xfer->status = USBD_NORMAL_COMPLETION;
s = splusb();
usb_transfer_complete(xfer); usb_transfer_complete(xfer);
splx(s);
} }
ohci_free_std(sc, std); ohci_free_std(sc, std);
} else { } else {
@ -1362,7 +1364,9 @@ ohci_softintr(void *v)
xfer->status = USBD_STALLED; xfer->status = USBD_STALLED;
else else
xfer->status = USBD_IOERROR; xfer->status = USBD_IOERROR;
s = splusb();
usb_transfer_complete(xfer); usb_transfer_complete(xfer);
splx(s);
} }
} }
@ -1748,7 +1752,7 @@ ohci_rem_ed(ohci_soft_ed_t *sed, ohci_soft_ed_t *head)
SPLUSBCHECK; SPLUSBCHECK;
/* XXX */ /* XXX */
for (p = head; p == NULL && p->next != sed; p = p->next) for (p = head; p != NULL && p->next != sed; p = p->next)
; ;
if (p == NULL) if (p == NULL)
panic("ohci_rem_ed: ED not found"); panic("ohci_rem_ed: ED not found");
@ -2103,6 +2107,8 @@ ohci_close_pipe(usbd_pipe_handle pipe, ohci_soft_ed_t *head)
} }
#endif #endif
ohci_rem_ed(sed, head); ohci_rem_ed(sed, head);
/* Make sure the host controller is not touching this ED */
usb_delay_ms(&sc->sc_bus, 1);
splx(s); splx(s);
ohci_free_sed(sc, opipe->sed); ohci_free_sed(sc, opipe->sed);
} }