diff options
author | Martin Pieuchot <mpi@cvs.openbsd.org> | 2013-04-12 12:58:40 +0000 |
---|---|---|
committer | Martin Pieuchot <mpi@cvs.openbsd.org> | 2013-04-12 12:58:40 +0000 |
commit | bc9e417bf2fcdab799ae6192301d0575099a3770 (patch) | |
tree | 2e4dc75c8988cef5d331f784569681d48405d39d /sys/dev/usb | |
parent | 92e308dc2a89dd51e9ea7d9fcd56aa6a4f3fc119 (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')
-rw-r--r-- | sys/dev/usb/if_athn_usb.c | 7 | ||||
-rw-r--r-- | sys/dev/usb/if_atu.c | 6 | ||||
-rw-r--r-- | sys/dev/usb/if_otus.c | 7 | ||||
-rw-r--r-- | sys/dev/usb/if_ral.c | 11 | ||||
-rw-r--r-- | sys/dev/usb/if_rsu.c | 12 | ||||
-rw-r--r-- | sys/dev/usb/if_uath.c | 19 | ||||
-rw-r--r-- | sys/dev/usb/ueagle.c | 14 | ||||
-rw-r--r-- | sys/dev/usb/umbg.c | 10 | ||||
-rw-r--r-- | sys/dev/usb/uow.c | 12 | ||||
-rw-r--r-- | sys/dev/usb/usbdi.c | 22 | ||||
-rw-r--r-- | sys/dev/usb/usbdi.h | 3 | ||||
-rw-r--r-- | sys/dev/usb/uticom.c | 4 |
12 files changed, 62 insertions, 65 deletions
diff --git a/sys/dev/usb/if_athn_usb.c b/sys/dev/usb/if_athn_usb.c index c03234a286b..ff31dcc6e42 100644 --- a/sys/dev/usb/if_athn_usb.c +++ b/sys/dev/usb/if_athn_usb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_athn_usb.c,v 1.14 2013/04/05 05:39:46 brad Exp $ */ +/* $OpenBSD: if_athn_usb.c,v 1.15 2013/04/12 12:58:39 mpi Exp $ */ /*- * Copyright (c) 2011 Damien Bergamini <damien.bergamini@free.fr> @@ -730,8 +730,9 @@ athn_usb_htc_msg(struct athn_usb_softc *usc, uint16_t msg_id, void *buf, usbd_setup_xfer(data->xfer, usc->tx_intr_pipe, NULL, data->buf, sizeof(*htc) + sizeof(*msg) + len, - USBD_SHORT_XFER_OK | USBD_NO_COPY, ATHN_USB_CMD_TIMEOUT, NULL); - return (usbd_sync_transfer(data->xfer)); + USBD_SHORT_XFER_OK | USBD_NO_COPY | USBD_SYNCHRONOUS, + ATHN_USB_CMD_TIMEOUT, NULL); + return (usbd_transfer(data->xfer)); } int diff --git a/sys/dev/usb/if_atu.c b/sys/dev/usb/if_atu.c index adf88148695..be670b829ad 100644 --- a/sys/dev/usb/if_atu.c +++ b/sys/dev/usb/if_atu.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_atu.c,v 1.101 2012/02/24 06:19:00 guenther Exp $ */ +/* $OpenBSD: if_atu.c,v 1.102 2013/04/12 12:58:39 mpi Exp $ */ /* * Copyright (c) 2003, 2004 * Daan Vreeken <Danovitsch@Vitsch.net>. All rights reserved. @@ -330,9 +330,9 @@ atu_usb_request(struct atu_softc *sc, u_int8_t type, xfer = usbd_alloc_xfer(sc->atu_udev); usbd_setup_default_xfer(xfer, sc->atu_udev, 0, 500000, &req, data, - length, USBD_SHORT_XFER_OK, 0); + length, USBD_SHORT_XFER_OK | USBD_SYNCHRONOUS, 0); - err = usbd_sync_transfer(xfer); + err = usbd_transfer(xfer); usbd_get_xfer_status(xfer, NULL, NULL, &total_len, NULL); diff --git a/sys/dev/usb/if_otus.c b/sys/dev/usb/if_otus.c index fb08645ebb9..368aa54ca0c 100644 --- a/sys/dev/usb/if_otus.c +++ b/sys/dev/usb/if_otus.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_otus.c,v 1.32 2012/10/12 19:53:24 haesbaert Exp $ */ +/* $OpenBSD: if_otus.c,v 1.33 2013/04/12 12:58:39 mpi Exp $ */ /*- * Copyright (c) 2009 Damien Bergamini <damien.bergamini@free.fr> @@ -867,8 +867,9 @@ otus_cmd(struct otus_softc *sc, uint8_t code, const void *idata, int ilen, cmd->done = 0; usbd_setup_xfer(cmd->xfer, sc->cmd_tx_pipe, cmd, cmd->buf, xferlen, - USBD_FORCE_SHORT_XFER | USBD_NO_COPY, OTUS_CMD_TIMEOUT, NULL); - error = usbd_sync_transfer(cmd->xfer); + USBD_FORCE_SHORT_XFER | USBD_NO_COPY | USBD_SYNCHRONOUS, + OTUS_CMD_TIMEOUT, NULL); + error = usbd_transfer(cmd->xfer); if (error != 0) { splx(s); printf("%s: could not send command 0x%x (error=%s)\n", diff --git a/sys/dev/usb/if_ral.c b/sys/dev/usb/if_ral.c index a764fa4ea20..7d14a32e800 100644 --- a/sys/dev/usb/if_ral.c +++ b/sys/dev/usb/if_ral.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ral.c,v 1.121 2011/07/03 15:47:17 matthew Exp $ */ +/* $OpenBSD: if_ral.c,v 1.122 2013/04/12 12:58:39 mpi Exp $ */ /*- * Copyright (c) 2005, 2006 @@ -1018,9 +1018,9 @@ ural_tx_bcn(struct ural_softc *sc, struct mbuf *m0, struct ieee80211_node *ni) } usbd_setup_xfer(xfer, sc->sc_tx_pipeh, NULL, &cmd, sizeof cmd, - USBD_FORCE_SHORT_XFER, RAL_TX_TIMEOUT, NULL); + USBD_FORCE_SHORT_XFER | USBD_SYNCHRONOUS, RAL_TX_TIMEOUT, NULL); - error = usbd_sync_transfer(xfer); + error = usbd_transfer(xfer); if (error != 0) { usbd_free_xfer(xfer); return error; @@ -1036,9 +1036,10 @@ ural_tx_bcn(struct ural_softc *sc, struct mbuf *m0, struct ieee80211_node *ni) m0->m_pkthdr.len, rate, xferlen)); usbd_setup_xfer(xfer, sc->sc_tx_pipeh, NULL, buf, xferlen, - USBD_FORCE_SHORT_XFER | USBD_NO_COPY, RAL_TX_TIMEOUT, NULL); + USBD_FORCE_SHORT_XFER | USBD_NO_COPY | USBD_SYNCHRONOUS, + RAL_TX_TIMEOUT, NULL); - error = usbd_sync_transfer(xfer); + error = usbd_transfer(xfer); usbd_free_xfer(xfer); return error; diff --git a/sys/dev/usb/if_rsu.c b/sys/dev/usb/if_rsu.c index 9fa93340eb3..367c948382b 100644 --- a/sys/dev/usb/if_rsu.c +++ b/sys/dev/usb/if_rsu.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_rsu.c,v 1.15 2013/02/04 23:13:41 kettenis Exp $ */ +/* $OpenBSD: if_rsu.c,v 1.16 2013/04/12 12:58:39 mpi Exp $ */ /*- * Copyright (c) 2010 Damien Bergamini <damien.bergamini@free.fr> @@ -776,8 +776,9 @@ rsu_fw_cmd(struct rsu_softc *sc, uint8_t code, void *buf, int len) DPRINTFN(2, ("Tx cmd code=%d len=%d\n", code, cmdsz)); pipe = sc->pipe[sc->qid2idx[RSU_QID_H2C]]; usbd_setup_xfer(data->xfer, pipe, NULL, data->buf, xferlen, - USBD_SHORT_XFER_OK | USBD_NO_COPY, RSU_CMD_TIMEOUT, NULL); - return (usbd_sync_transfer(data->xfer)); + USBD_SHORT_XFER_OK | USBD_NO_COPY | USBD_SYNCHRONOUS, + RSU_CMD_TIMEOUT, NULL); + return (usbd_transfer(data->xfer)); } int @@ -2013,9 +2014,10 @@ rsu_fw_loadsection(struct rsu_softc *sc, uint8_t *buf, int len) memcpy(&txd[1], buf, mlen); usbd_setup_xfer(data->xfer, pipe, NULL, data->buf, - sizeof(*txd) + mlen, USBD_SHORT_XFER_OK | USBD_NO_COPY, + sizeof(*txd) + mlen, + USBD_SHORT_XFER_OK | USBD_NO_COPY | USBD_SYNCHRONOUS, RSU_TX_TIMEOUT, NULL); - error = usbd_sync_transfer(data->xfer); + error = usbd_transfer(data->xfer); if (error != 0) return (error); buf += mlen; diff --git a/sys/dev/usb/if_uath.c b/sys/dev/usb/if_uath.c index be84d463c89..be0659acb64 100644 --- a/sys/dev/usb/if_uath.c +++ b/sys/dev/usb/if_uath.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_uath.c,v 1.52 2012/10/03 08:05:26 sthen Exp $ */ +/* $OpenBSD: if_uath.c,v 1.53 2013/04/12 12:58:39 mpi Exp $ */ /*- * Copyright (c) 2006 @@ -1319,8 +1319,8 @@ uath_tx_null(struct uath_softc *sc) usbd_setup_xfer(data->xfer, sc->data_tx_pipe, data, data->buf, sizeof (uint32_t) + sizeof (struct uath_tx_desc), USBD_NO_COPY | - USBD_FORCE_SHORT_XFER, UATH_DATA_TIMEOUT, NULL); - if (usbd_sync_transfer(data->xfer) != 0) + USBD_FORCE_SHORT_XFER | USBD_SYNCHRONOUS, UATH_DATA_TIMEOUT, NULL); + if (usbd_transfer(data->xfer) != 0) return EIO; sc->data_idx = (sc->data_idx + 1) % UATH_TX_DATA_LIST_COUNT; @@ -2081,9 +2081,10 @@ uath_loadfirmware(struct uath_softc *sc, const u_char *fw, int len) /* send firmware block meta-data */ usbd_setup_xfer(ctlxfer, sc->cmd_tx_pipe, sc, txblock, - sizeof (struct uath_fwblock), USBD_NO_COPY, + sizeof (struct uath_fwblock), + USBD_NO_COPY | USBD_SYNCHRONOUS, UATH_CMD_TIMEOUT, NULL); - if ((error = usbd_sync_transfer(ctlxfer)) != 0) { + if ((error = usbd_transfer(ctlxfer)) != 0) { printf("%s: could not send firmware block info\n", sc->sc_dev.dv_xname); break; @@ -2092,8 +2093,8 @@ uath_loadfirmware(struct uath_softc *sc, const u_char *fw, int len) /* send firmware block data */ bcopy(fw, txdata, mlen); usbd_setup_xfer(txxfer, sc->data_tx_pipe, sc, txdata, mlen, - USBD_NO_COPY, UATH_DATA_TIMEOUT, NULL); - if ((error = usbd_sync_transfer(txxfer)) != 0) { + USBD_NO_COPY | USBD_SYNCHRONOUS, UATH_DATA_TIMEOUT, NULL); + if ((error = usbd_transfer(txxfer)) != 0) { printf("%s: could not send firmware block data\n", sc->sc_dev.dv_xname); break; @@ -2102,8 +2103,8 @@ uath_loadfirmware(struct uath_softc *sc, const u_char *fw, int len) /* wait for ack from firmware */ usbd_setup_xfer(rxxfer, sc->cmd_rx_pipe, sc, rxblock, sizeof (struct uath_fwblock), USBD_SHORT_XFER_OK | - USBD_NO_COPY, UATH_CMD_TIMEOUT, NULL); - if ((error = usbd_sync_transfer(rxxfer)) != 0) { + USBD_NO_COPY | USBD_SYNCHRONOUS, UATH_CMD_TIMEOUT, NULL); + if ((error = usbd_transfer(rxxfer)) != 0) { printf("%s: could not read firmware answer\n", sc->sc_dev.dv_xname); break; diff --git a/sys/dev/usb/ueagle.c b/sys/dev/usb/ueagle.c index 0311c7b840b..d61da52d60c 100644 --- a/sys/dev/usb/ueagle.c +++ b/sys/dev/usb/ueagle.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ueagle.c,v 1.36 2011/11/27 09:20:57 claudio Exp $ */ +/* $OpenBSD: ueagle.c,v 1.37 2013/04/12 12:58:39 mpi Exp $ */ /*- * Copyright (c) 2003-2006 @@ -356,18 +356,18 @@ ueagle_loadpage(void *xsc) USETW(bi.wLast, (i == blockcount - 1) ? 1 : 0); /* send block info through the IDMA pipe */ - usbd_setup_xfer(xfer, sc->pipeh_idma, sc, &bi, sizeof bi, 0, - UEAGLE_IDMA_TIMEOUT, NULL); - if (usbd_sync_transfer(xfer) != 0) { + usbd_setup_xfer(xfer, sc->pipeh_idma, sc, &bi, sizeof bi, + USBD_SYNCHRONOUS, UEAGLE_IDMA_TIMEOUT, NULL); + if (usbd_transfer(xfer) != 0) { printf("%s: could not transfer block info\n", sc->sc_dev.dv_xname); break; } /* send block data through the IDMA pipe */ - usbd_setup_xfer(xfer, sc->pipeh_idma, sc, p, blocksize, 0, - UEAGLE_IDMA_TIMEOUT, NULL); - if (usbd_sync_transfer(xfer) != 0) { + usbd_setup_xfer(xfer, sc->pipeh_idma, sc, p, blocksize, + USBD_SYNCHRONOUS, UEAGLE_IDMA_TIMEOUT, NULL); + if (usbd_transfer(xfer) != 0) { printf("%s: could not transfer block data\n", sc->sc_dev.dv_xname); break; diff --git a/sys/dev/usb/umbg.c b/sys/dev/usb/umbg.c index 1cdc726dd69..9ce5172f871 100644 --- a/sys/dev/usb/umbg.c +++ b/sys/dev/usb/umbg.c @@ -1,4 +1,4 @@ -/* $OpenBSD: umbg.c,v 1.19 2013/03/28 03:58:03 tedu Exp $ */ +/* $OpenBSD: umbg.c,v 1.20 2013/04/12 12:58:39 mpi Exp $ */ /* * Copyright (c) 2007 Marc Balmer <mbalmer@openbsd.org> @@ -402,10 +402,10 @@ umbg_read(struct umbg_softc *sc, u_int8_t cmd, char *buf, size_t len, } usbd_setup_xfer(xfer, sc->sc_bulkout_pipe, NULL, &cmd, sizeof(cmd), - USBD_SHORT_XFER_OK, USBD_DEFAULT_TIMEOUT, NULL); + USBD_SHORT_XFER_OK | USBD_SYNCHRONOUS, USBD_DEFAULT_TIMEOUT, NULL); if (tstamp) nanotime(tstamp); - err = usbd_sync_transfer(xfer); + err = usbd_transfer(xfer); if (err) { DPRINTF(("%s: sending of command failed: %s\n", sc->sc_dev.dv_xname, usbd_errstr(err))); @@ -414,9 +414,9 @@ umbg_read(struct umbg_softc *sc, u_int8_t cmd, char *buf, size_t len, } usbd_setup_xfer(xfer, sc->sc_bulkin_pipe, NULL, buf, len, - USBD_SHORT_XFER_OK, USBD_DEFAULT_TIMEOUT, NULL); + USBD_SHORT_XFER_OK | USBD_SYNCHRONOUS, USBD_DEFAULT_TIMEOUT, NULL); - err = usbd_sync_transfer(xfer); + err = usbd_transfer(xfer); usbd_free_xfer(xfer); if (err) { DPRINTF(("%s: reading data failed: %s\n", diff --git a/sys/dev/usb/uow.c b/sys/dev/usb/uow.c index a4434a6e19d..3f65108eca4 100644 --- a/sys/dev/usb/uow.c +++ b/sys/dev/usb/uow.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uow.c,v 1.31 2013/03/28 03:58:03 tedu Exp $ */ +/* $OpenBSD: uow.c,v 1.32 2013/04/12 12:58:39 mpi Exp $ */ /* * Copyright (c) 2006 Alexander Yurchenko <grange@openbsd.org> @@ -462,8 +462,8 @@ uow_read(struct uow_softc *sc, void *buf, int len) return (-1); } usbd_setup_xfer(sc->sc_xfer, sc->sc_ph_ibulk, sc, buf, len, - USBD_SHORT_XFER_OK, UOW_TIMEOUT, NULL); - error = usbd_sync_transfer(sc->sc_xfer); + USBD_SHORT_XFER_OK | USBD_SYNCHRONOUS, UOW_TIMEOUT, NULL); + error = usbd_transfer(sc->sc_xfer); usbd_free_xfer(sc->sc_xfer); if (error != 0) { printf("%s: read failed, len %d: %s\n", @@ -492,9 +492,9 @@ uow_write(struct uow_softc *sc, const void *buf, int len) printf("%s: failed to alloc xfer\n", sc->sc_dev.dv_xname); return (-1); } - usbd_setup_xfer(sc->sc_xfer, sc->sc_ph_obulk, sc, (void *)buf, len, 0, - UOW_TIMEOUT, NULL); - error = usbd_sync_transfer(sc->sc_xfer); + usbd_setup_xfer(sc->sc_xfer, sc->sc_ph_obulk, sc, (void *)buf, len, + USBD_SYNCHRONOUS, UOW_TIMEOUT, NULL); + error = usbd_transfer(sc->sc_xfer); usbd_free_xfer(sc->sc_xfer); if (error != 0) { printf("%s: write failed, len %d: %s\n", 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; } diff --git a/sys/dev/usb/usbdi.h b/sys/dev/usb/usbdi.h index a6e83252fca..86648b6bca4 100644 --- a/sys/dev/usb/usbdi.h +++ b/sys/dev/usb/usbdi.h @@ -1,4 +1,4 @@ -/* $OpenBSD: usbdi.h,v 1.46 2013/04/10 07:39:43 mpi Exp $ */ +/* $OpenBSD: usbdi.h,v 1.47 2013/04/12 12:58:39 mpi Exp $ */ /* $NetBSD: usbdi.h,v 1.62 2002/07/11 21:14:35 augustss Exp $ */ /* $FreeBSD: src/sys/dev/usb/usbdi.h,v 1.18 1999/11/17 22:33:49 n_hibma Exp $ */ @@ -118,7 +118,6 @@ usbd_device_handle usbd_pipe2device_handle(usbd_pipe_handle); void *usbd_alloc_buffer(usbd_xfer_handle xfer, u_int32_t size); void usbd_free_buffer(usbd_xfer_handle xfer); void *usbd_get_buffer(usbd_xfer_handle xfer); -usbd_status usbd_sync_transfer(usbd_xfer_handle req); usbd_status usbd_open_pipe_intr(usbd_interface_handle iface, u_int8_t address, u_int8_t flags, usbd_pipe_handle *pipe, usbd_private_handle priv, void *buffer, u_int32_t length, usbd_callback, int); diff --git a/sys/dev/usb/uticom.c b/sys/dev/usb/uticom.c index de1b981a3c2..2c2651a3ba6 100644 --- a/sys/dev/usb/uticom.c +++ b/sys/dev/usb/uticom.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uticom.c,v 1.18 2011/08/17 18:58:45 jasper Exp $ */ +/* $OpenBSD: uticom.c,v 1.19 2013/04/12 12:58:39 mpi Exp $ */ /* * Copyright (c) 2005 Dmitry Komissaroff <dxi@mail.ru>. * @@ -971,7 +971,7 @@ uticom_download_fw(struct uticom_softc *sc, int pipeno, usbd_setup_xfer(oxfer, pipe, (usbd_private_handle)sc, obuf, buffer_size, USBD_NO_COPY | USBD_SYNCHRONOUS, USBD_NO_TIMEOUT, 0); - err = usbd_sync_transfer(oxfer); + err = usbd_transfer(oxfer); if (err != USBD_NORMAL_COMPLETION) printf("%s: uticom_download_fw: error: %s\n", |