summaryrefslogtreecommitdiff
path: root/sys/dev/usb/usbdi.c
diff options
context:
space:
mode:
authorMartin Pieuchot <mpi@cvs.openbsd.org>2013-04-12 12:58:40 +0000
committerMartin Pieuchot <mpi@cvs.openbsd.org>2013-04-12 12:58:40 +0000
commitbc9e417bf2fcdab799ae6192301d0575099a3770 (patch)
tree2e4dc75c8988cef5d331f784569681d48405d39d /sys/dev/usb/usbdi.c
parent92e308dc2a89dd51e9ea7d9fcd56aa6a4f3fc119 (diff)
Instead of using a wrapper around usbd_transfer() when submitting a
transfer synchronously just pass the USBD_SYNCHRONOUS flag like any other flags when creating a transfer. ok sthen@, mglocker@
Diffstat (limited to 'sys/dev/usb/usbdi.c')
-rw-r--r--sys/dev/usb/usbdi.c22
1 files changed, 7 insertions, 15 deletions
diff --git a/sys/dev/usb/usbdi.c b/sys/dev/usb/usbdi.c
index fe7472b67a1..a2f14eb21fb 100644
--- a/sys/dev/usb/usbdi.c
+++ b/sys/dev/usb/usbdi.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: usbdi.c,v 1.47 2013/04/11 07:50:56 mpi Exp $ */
+/* $OpenBSD: usbdi.c,v 1.48 2013/04/12 12:58:39 mpi Exp $ */
/* $NetBSD: usbdi.c,v 1.103 2002/09/27 15:37:38 provos Exp $ */
/* $FreeBSD: src/sys/dev/usb/usbdi.c,v 1.28 1999/11/17 22:33:49 n_hibma Exp $ */
@@ -379,14 +379,6 @@ usbd_transfer(usbd_xfer_handle xfer)
return (xfer->status);
}
-/* Like usbd_transfer(), but waits for completion. */
-usbd_status
-usbd_sync_transfer(usbd_xfer_handle xfer)
-{
- xfer->flags |= USBD_SYNCHRONOUS;
- return (usbd_transfer(xfer));
-}
-
void *
usbd_alloc_buffer(usbd_xfer_handle xfer, u_int32_t size)
{
@@ -962,9 +954,9 @@ usbd_do_request_flags(usbd_device_handle dev, usb_device_request_t *req,
if (xfer == NULL)
return (USBD_NOMEM);
usbd_setup_default_xfer(xfer, dev, 0, timeout, req, data,
- UGETW(req->wLength), flags, 0);
+ UGETW(req->wLength), flags | USBD_SYNCHRONOUS, 0);
xfer->pipe = pipe;
- err = usbd_sync_transfer(xfer);
+ err = usbd_transfer(xfer);
#if defined(USB_DEBUG) || defined(DIAGNOSTIC)
if (xfer->actlen > xfer->length)
DPRINTF(("usbd_do_request: overrun addr=%d type=0x%02x req=0x"
@@ -993,8 +985,8 @@ usbd_do_request_flags(usbd_device_handle dev, usb_device_request_t *req,
USETW(treq.wIndex, 0);
USETW(treq.wLength, sizeof(usb_status_t));
usbd_setup_default_xfer(xfer, dev, 0, USBD_DEFAULT_TIMEOUT,
- &treq, &status,sizeof(usb_status_t), 0, 0);
- nerr = usbd_sync_transfer(xfer);
+ &treq, &status, sizeof(usb_status_t), USBD_SYNCHRONOUS, 0);
+ nerr = usbd_transfer(xfer);
if (nerr)
goto bad;
s = UGETW(status.wStatus);
@@ -1007,8 +999,8 @@ usbd_do_request_flags(usbd_device_handle dev, usb_device_request_t *req,
USETW(treq.wIndex, 0);
USETW(treq.wLength, 0);
usbd_setup_default_xfer(xfer, dev, 0, USBD_DEFAULT_TIMEOUT,
- &treq, &status, 0, 0, 0);
- nerr = usbd_sync_transfer(xfer);
+ &treq, &status, 0, USBD_SYNCHRONOUS, 0);
+ nerr = usbd_transfer(xfer);
if (nerr)
goto bad;
}