Module Name: src
Committed By: simonb
Date: Mon Jul 13 13:53:04 UTC 2020
Modified Files:
src/sys/dev/usb: ualea.c
Log Message:
Set up the USB xfer for every transfer, not just once in the attach
function. Caught by DIAGNOSTIC on a similar driver. Thanks to phone@
for USB xfer clue and martin@ for testing.
To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/dev/usb/ualea.c
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/ualea.c
diff -u src/sys/dev/usb/ualea.c:1.11 src/sys/dev/usb/ualea.c:1.12
--- src/sys/dev/usb/ualea.c:1.11 Thu Apr 30 03:40:53 2020
+++ src/sys/dev/usb/ualea.c Mon Jul 13 13:53:04 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: ualea.c,v 1.11 2020/04/30 03:40:53 riastradh Exp $ */
+/* $NetBSD: ualea.c,v 1.12 2020/07/13 13:53:04 simonb Exp $ */
/*-
* Copyright (c) 2017 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ualea.c,v 1.11 2020/04/30 03:40:53 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ualea.c,v 1.12 2020/07/13 13:53:04 simonb Exp $");
#include <sys/types.h>
#include <sys/atomic.h>
@@ -139,11 +139,6 @@ ualea_attach(device_t parent, device_t s
return;
}
- /* Setup the xfer to call ualea_xfer_done with sc. */
- usbd_setup_xfer(sc->sc_xfer, sc, usbd_get_buffer(sc->sc_xfer),
- sc->sc_maxpktsize, USBD_SHORT_XFER_OK, USBD_NO_TIMEOUT,
- ualea_xfer_done);
-
/* Success! We are ready to run. */
sc->sc_attached = true;
rndsource_setcb(&sc->sc_rnd, ualea_get, sc);
@@ -188,6 +183,11 @@ ualea_xfer(struct ualea_softc *sc)
if (sc->sc_needed == 0)
return;
+ /* Setup the xfer to call ualea_xfer_done with sc. */
+ usbd_setup_xfer(sc->sc_xfer, sc, usbd_get_buffer(sc->sc_xfer),
+ sc->sc_maxpktsize, USBD_SHORT_XFER_OK, USBD_NO_TIMEOUT,
+ ualea_xfer_done);
+
/* Issue xfer or complain if we can't. */
status = usbd_transfer(sc->sc_xfer);
KASSERT(status != USBD_NORMAL_COMPLETION); /* asynchronous xfer */