From cdaec29859c86a727b70b2e6cc64e7a24b9da9a9 Mon Sep 17 00:00:00 2001 From: augustss Date: Wed, 17 Nov 1999 23:00:49 +0000 Subject: [PATCH] A few more purely stylistic changes that I missed in the last round. --- sys/dev/usb/ohci.c | 30 ++++++------ sys/dev/usb/uaudio.c | 24 +++++----- sys/dev/usb/ugen.c | 12 ++--- sys/dev/usb/uhci.c | 28 +++++------ sys/dev/usb/ulpt.c | 8 ++-- sys/dev/usb/umass.c | 12 ++--- sys/dev/usb/umodem.c | 100 +++++++++++++++++++-------------------- sys/dev/usb/usbdi.c | 60 +++++++++++------------ sys/dev/usb/usbdi.h | 14 +++--- sys/dev/usb/usbdi_util.c | 8 ++-- 10 files changed, 148 insertions(+), 148 deletions(-) diff --git a/sys/dev/usb/ohci.c b/sys/dev/usb/ohci.c index d9ab44c6ce9a..21766966fc76 100644 --- a/sys/dev/usb/ohci.c +++ b/sys/dev/usb/ohci.c @@ -1,4 +1,4 @@ -/* $NetBSD: ohci.c,v 1.53 1999/11/12 00:34:57 augustss Exp $ */ +/* $NetBSD: ohci.c,v 1.54 1999/11/17 23:00:49 augustss Exp $ */ /* * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -188,9 +188,9 @@ static void ohci_rhsc_able __P((ohci_softc_t *, int)); static void ohci_close_pipe __P((usbd_pipe_handle pipe, ohci_soft_ed_t *head)); -static void ohci_abort_req __P((usbd_xfer_handle xfer, +static void ohci_abort_xfer __P((usbd_xfer_handle xfer, usbd_status status)); -static void ohci_abort_req_end __P((void *)); +static void ohci_abort_xfer_end __P((void *)); static void ohci_device_clear_toggle __P((usbd_pipe_handle pipe)); static void ohci_noop __P((usbd_pipe_handle pipe)); @@ -1393,7 +1393,7 @@ ohci_timeout(addr) s = splusb(); xfer->device->bus->intr_context++; - ohci_abort_req(xfer, USBD_TIMEOUT); + ohci_abort_xfer(xfer, USBD_TIMEOUT); xfer->device->bus->intr_context--; splx(s); } @@ -1578,34 +1578,34 @@ ohci_close_pipe(pipe, head) * interrupt processing to process it. */ void -ohci_abort_req(xfer, status) +ohci_abort_xfer(xfer, status) usbd_xfer_handle xfer; usbd_status status; { struct ohci_pipe *opipe = (struct ohci_pipe *)xfer->pipe; ohci_soft_ed_t *sed; - DPRINTF(("ohci_abort_req: xfer=%p pipe=%p\n", xfer, opipe)); + DPRINTF(("ohci_abort_xfer: xfer=%p pipe=%p\n", xfer, opipe)); xfer->status = status; usb_untimeout(ohci_timeout, xfer, xfer->timo_handle); sed = opipe->sed; - DPRINTFN(1,("ohci_abort_req: stop ed=%p\n", sed)); + DPRINTFN(1,("ohci_abort_xfer: stop ed=%p\n", sed)); sed->ed.ed_flags |= LE(OHCI_ED_SKIP); /* force hardware skip */ if (xfer->device->bus->intr_context) { /* We have no process context, so we can't use tsleep(). */ - timeout(ohci_abort_req_end, xfer, hz / USB_FRAMES_PER_SECOND); + timeout(ohci_abort_xfer_end, xfer, hz / USB_FRAMES_PER_SECOND); } else { usb_delay_ms(opipe->pipe.device->bus, 1); - ohci_abort_req_end(xfer); + ohci_abort_xfer_end(xfer); } } void -ohci_abort_req_end(v) +ohci_abort_xfer_end(v) void *v; { usbd_xfer_handle xfer = v; @@ -1620,7 +1620,7 @@ ohci_abort_req_end(v) p = xfer->hcpriv; #ifdef DIAGNOSTIC if (!p) { - printf("ohci_abort_req: hcpriv==0\n"); + printf("ohci_abort_xfer: hcpriv==0\n"); return; } #endif @@ -1631,7 +1631,7 @@ ohci_abort_req_end(v) } sed = opipe->sed; - DPRINTFN(2,("ohci_abort_req: set hd=%x, tl=%x\n", + DPRINTFN(2,("ohci_abort_xfer: set hd=%x, tl=%x\n", (int)LE(p->physaddr), (int)LE(sed->ed.ed_tailp))); sed->ed.ed_headp = p->physaddr; /* unlink TDs */ sed->ed.ed_flags &= LE(~OHCI_ED_SKIP); /* remove hardware skip */ @@ -2158,7 +2158,7 @@ ohci_device_ctrl_abort(xfer) usbd_xfer_handle xfer; { DPRINTF(("ohci_device_ctrl_abort: xfer=%p\n", xfer)); - ohci_abort_req(xfer, USBD_CANCELLED); + ohci_abort_xfer(xfer, USBD_CANCELLED); } /* Close a device control pipe. */ @@ -2301,7 +2301,7 @@ ohci_device_bulk_abort(xfer) usbd_xfer_handle xfer; { DPRINTF(("ohci_device_bulk_abort: xfer=%p\n", xfer)); - ohci_abort_req(xfer, USBD_CANCELLED); + ohci_abort_xfer(xfer, USBD_CANCELLED); } /* @@ -2420,7 +2420,7 @@ ohci_device_intr_abort(xfer) DPRINTF(("ohci_device_intr_abort: remove\n")); xfer->pipe->intrxfer = 0; } - ohci_abort_req(xfer, USBD_CANCELLED); + ohci_abort_xfer(xfer, USBD_CANCELLED); } /* Close a device interrupt pipe. */ diff --git a/sys/dev/usb/uaudio.c b/sys/dev/usb/uaudio.c index 4001af5c5f1f..99b6df943f8d 100644 --- a/sys/dev/usb/uaudio.c +++ b/sys/dev/usb/uaudio.c @@ -1,4 +1,4 @@ -/* $NetBSD: uaudio.c,v 1.10 1999/11/15 22:04:14 augustss Exp $ */ +/* $NetBSD: uaudio.c,v 1.11 1999/11/17 23:00:50 augustss Exp $ */ /* * Copyright (c) 1999 The NetBSD Foundation, Inc. @@ -1822,7 +1822,7 @@ uaudio_chan_alloc_buffers(sc, ch) size = (ch->bytes_per_frame + ch->sample_size) * UAUDIO_NFRAMES; for (i = 0; i < UAUDIO_NCHANBUFS; i++) { - xfer = usbd_alloc_request(sc->sc_udev); + xfer = usbd_alloc_xfer(sc->sc_udev); if (xfer == 0) goto bad; ch->chanbufs[i].xfer = xfer; @@ -1840,7 +1840,7 @@ uaudio_chan_alloc_buffers(sc, ch) bad: while (--i >= 0) /* implicit buffer free */ - usbd_free_request(ch->chanbufs[i].xfer); + usbd_free_xfer(ch->chanbufs[i].xfer); return (USBD_NOMEM); } @@ -1852,7 +1852,7 @@ uaudio_chan_free_buffers(sc, ch) int i; for (i = 0; i < UAUDIO_NCHANBUFS; i++) - usbd_free_request(ch->chanbufs[i].xfer); + usbd_free_xfer(ch->chanbufs[i].xfer); } /* Called at splusb() */ @@ -1914,9 +1914,9 @@ uaudio_chan_ptransfer(ch) DPRINTFN(5,("uaudio_chan_transfer: ptransfer xfer=%p\n", cb->xfer)); /* Fill the request */ - usbd_setup_isoc_request(cb->xfer, ch->pipe, cb, cb->sizes, - UAUDIO_NFRAMES, USBD_NO_COPY, - uaudio_chan_pintr); + usbd_setup_isoc_xfer(cb->xfer, ch->pipe, cb, cb->sizes, + UAUDIO_NFRAMES, USBD_NO_COPY, + uaudio_chan_pintr); (void)usbd_transfer(cb->xfer); } @@ -1936,7 +1936,7 @@ uaudio_chan_pintr(xfer, priv, status) if (status == USBD_CANCELLED) return; - usbd_get_request_status(xfer, 0, 0, &count, 0); + usbd_get_xfer_status(xfer, 0, 0, &count, 0); DPRINTFN(5,("uaudio_chan_pintr: count=%d, transferred=%d\n", count, ch->transferred)); #ifdef DIAGNOSTIC @@ -2005,9 +2005,9 @@ uaudio_chan_rtransfer(ch) DPRINTFN(5,("uaudio_chan_rtransfer: transfer xfer=%p\n", cb->xfer)); /* Fill the request */ - usbd_setup_isoc_request(cb->xfer, ch->pipe, cb, cb->sizes, - UAUDIO_NFRAMES, USBD_NO_COPY, - uaudio_chan_rintr); + usbd_setup_isoc_xfer(cb->xfer, ch->pipe, cb, cb->sizes, + UAUDIO_NFRAMES, USBD_NO_COPY, + uaudio_chan_rintr); (void)usbd_transfer(cb->xfer); } @@ -2027,7 +2027,7 @@ uaudio_chan_rintr(xfer, priv, status) if (status == USBD_CANCELLED) return; - usbd_get_request_status(xfer, 0, 0, &count, 0); + usbd_get_xfer_status(xfer, 0, 0, &count, 0); DPRINTFN(5,("uaudio_chan_rintr: count=%d, transferred=%d\n", count, ch->transferred)); #ifdef DIAGNOSTIC diff --git a/sys/dev/usb/ugen.c b/sys/dev/usb/ugen.c index a909630fbdca..6a016b8da7e2 100644 --- a/sys/dev/usb/ugen.c +++ b/sys/dev/usb/ugen.c @@ -1,4 +1,4 @@ -/* $NetBSD: ugen.c,v 1.28 1999/11/12 00:34:57 augustss Exp $ */ +/* $NetBSD: ugen.c,v 1.29 1999/11/17 23:00:50 augustss Exp $ */ /* * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -458,7 +458,7 @@ ugen_do_read(sc, endpt, uio, flag) } break; case UE_BULK: - xfer = usbd_alloc_request(sc->sc_udev); + xfer = usbd_alloc_xfer(sc->sc_udev); if (xfer == 0) return (ENOMEM); while ((n = min(UGEN_BBSIZE, uio->uio_resid)) != 0) { @@ -483,7 +483,7 @@ ugen_do_read(sc, endpt, uio, flag) if (error || tn < n) break; } - usbd_free_request(xfer); + usbd_free_xfer(xfer); break; default: return (ENXIO); @@ -546,7 +546,7 @@ ugen_do_write(sc, endpt, uio, flag) switch (sce->edesc->bmAttributes & UE_XFERTYPE) { case UE_BULK: - xfer = usbd_alloc_request(sc->sc_udev); + xfer = usbd_alloc_xfer(sc->sc_udev); if (xfer == 0) return (EIO); while ((n = min(UGEN_BBSIZE, uio->uio_resid)) != 0) { @@ -564,7 +564,7 @@ ugen_do_write(sc, endpt, uio, flag) break; } } - usbd_free_request(xfer); + usbd_free_xfer(xfer); break; default: return (ENXIO); @@ -681,7 +681,7 @@ ugenintr(xfer, addr, status) return; } - usbd_get_request_status(xfer, 0, 0, &count, 0); + usbd_get_xfer_status(xfer, 0, 0, &count, 0); ibuf = sce->ibuf; DPRINTFN(5, ("ugenintr: xfer=%p status=%d count=%d\n", diff --git a/sys/dev/usb/uhci.c b/sys/dev/usb/uhci.c index c41f666fc36d..45e7788b6d2f 100644 --- a/sys/dev/usb/uhci.c +++ b/sys/dev/usb/uhci.c @@ -1,4 +1,4 @@ -/* $NetBSD: uhci.c,v 1.65 1999/11/16 22:19:03 augustss Exp $ */ +/* $NetBSD: uhci.c,v 1.66 1999/11/17 23:00:50 augustss Exp $ */ /* * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -173,9 +173,9 @@ static void uhci_waitintr __P((uhci_softc_t *, static void uhci_check_intr __P((uhci_softc_t *, uhci_intr_info_t *)); static void uhci_idone __P((uhci_intr_info_t *)); -static void uhci_abort_req __P((usbd_xfer_handle, +static void uhci_abort_xfer __P((usbd_xfer_handle, usbd_status status)); -static void uhci_abort_req_end __P((void *v)); +static void uhci_abort_xfer_end __P((void *v)); static void uhci_timeout __P((void *)); static void uhci_lock_frames __P((uhci_softc_t *)); static void uhci_unlock_frames __P((uhci_softc_t *)); @@ -1071,7 +1071,7 @@ uhci_timeout(addr) DPRINTF(("uhci_timeout: ii=%p\n", ii)); ii->xfer->device->bus->intr_context++; - uhci_abort_req(ii->xfer, USBD_TIMEOUT); + uhci_abort_xfer(ii->xfer, USBD_TIMEOUT); ii->xfer->device->bus->intr_context--; } @@ -1485,11 +1485,11 @@ uhci_device_bulk_abort(xfer) usbd_xfer_handle xfer; { DPRINTF(("uhci_device_bulk_abort:\n")); - uhci_abort_req(xfer, USBD_CANCELLED); + uhci_abort_xfer(xfer, USBD_CANCELLED); } void -uhci_abort_req(xfer, status) +uhci_abort_xfer(xfer, status) usbd_xfer_handle xfer; usbd_status status; { @@ -1497,7 +1497,7 @@ uhci_abort_req(xfer, status) uhci_intr_info_t *ii = upipe->iinfo; uhci_soft_td_t *std; - DPRINTFN(1,("uhci_abort_req: xfer=%p, status=%d\n", xfer, status)); + DPRINTFN(1,("uhci_abort_xfer: xfer=%p, status=%d\n", xfer, status)); /* Make interrupt routine ignore it, */ xfer->status = status; @@ -1514,16 +1514,16 @@ uhci_abort_req(xfer, status) /* make sure hardware has completed, */ if (xfer->device->bus->intr_context) { /* We have no process context, so we can't use tsleep(). */ - timeout(uhci_abort_req_end, xfer, hz / USB_FRAMES_PER_SECOND); + timeout(uhci_abort_xfer_end, xfer, hz / USB_FRAMES_PER_SECOND); } else { usb_delay_ms(xfer->pipe->device->bus, 1); /* and call final part of interrupt handler. */ - uhci_abort_req_end(xfer); + uhci_abort_xfer_end(xfer); } } void -uhci_abort_req_end(v) +uhci_abort_xfer_end(v) void *v; { usbd_xfer_handle xfer = v; @@ -1673,7 +1673,7 @@ uhci_device_ctrl_abort(xfer) usbd_xfer_handle xfer; { DPRINTF(("uhci_device_ctrl_abort:\n")); - uhci_abort_req(xfer, USBD_CANCELLED); + uhci_abort_xfer(xfer, USBD_CANCELLED); } /* Close a device control pipe. */ @@ -1697,7 +1697,7 @@ uhci_device_intr_abort(xfer) DPRINTFN(1,("uhci_device_intr_abort: remove\n")); xfer->pipe->intrxfer = 0; } - uhci_abort_req(xfer, USBD_CANCELLED); + uhci_abort_xfer(xfer, USBD_CANCELLED); } /* Close a device interrupt pipe. */ @@ -2024,11 +2024,11 @@ uhci_device_isoc_abort(xfer) /* make sure hardware has completed, */ if (xfer->device->bus->intr_context) { /* We have no process context, so we can't use tsleep(). */ - timeout(uhci_abort_req_end, xfer, hz / USB_FRAMES_PER_SECOND); + timeout(uhci_abort_xfer_end, xfer, hz / USB_FRAMES_PER_SECOND); } else { usb_delay_ms(xfer->pipe->device->bus, 1); /* and call final part of interrupt handler. */ - uhci_abort_req_end(xfer); + uhci_abort_xfer_end(xfer); } } diff --git a/sys/dev/usb/ulpt.c b/sys/dev/usb/ulpt.c index 6104b1845ca5..cc6639bcb0d9 100644 --- a/sys/dev/usb/ulpt.c +++ b/sys/dev/usb/ulpt.c @@ -1,4 +1,4 @@ -/* $NetBSD: ulpt.c,v 1.28 1999/11/12 00:34:57 augustss Exp $ */ +/* $NetBSD: ulpt.c,v 1.29 1999/11/17 23:00:50 augustss Exp $ */ /* * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -492,12 +492,12 @@ ulpt_do_write(sc, uio, flags) usbd_status err; DPRINTF(("ulptwrite\n")); - xfer = usbd_alloc_request(sc->sc_udev); + xfer = usbd_alloc_xfer(sc->sc_udev); if (xfer == NULL) return (ENOMEM); bufp = usbd_alloc_buffer(xfer, ULPT_BSIZE); if (bufp == NULL) { - usbd_free_request(xfer); + usbd_free_xfer(xfer); return (ENOMEM); } while ((n = min(ULPT_BSIZE, uio->uio_resid)) != 0) { @@ -514,7 +514,7 @@ ulpt_do_write(sc, uio, flags) break; } } - usbd_free_request(xfer); + usbd_free_xfer(xfer); return (error); } diff --git a/sys/dev/usb/umass.c b/sys/dev/usb/umass.c index f6cdb1b8fd44..56991eebf166 100644 --- a/sys/dev/usb/umass.c +++ b/sys/dev/usb/umass.c @@ -1,4 +1,4 @@ -/* $NetBSD: umass.c,v 1.22 1999/11/12 00:34:58 augustss Exp $ */ +/* $NetBSD: umass.c,v 1.23 1999/11/17 23:00:50 augustss Exp $ */ /*- * Copyright (c) 1999 The NetBSD Foundation, Inc. @@ -463,28 +463,28 @@ umass_usb_transfer(umass_softc_t *sc, usbd_pipe_handle pipe, * transfer and then wait for it to complete */ - xfer = usbd_alloc_request(usbd_pipe2device_handle(pipe)); + xfer = usbd_alloc_xfer(usbd_pipe2device_handle(pipe)); if (xfer == NULL) { DPRINTF(UDMASS_USB, ("%s: not enough memory\n", USBDEVNAME(sc->sc_dev))); return USBD_NOMEM; } - usbd_setup_request(xfer, pipe, 0, buf, buflen,flags, 3000/*ms*/, NULL); + usbd_setup_xfer(xfer, pipe, 0, buf, buflen,flags, 3000/*ms*/, NULL); err = usbd_sync_transfer(xfer); if (err) { DPRINTF(UDMASS_USB, ("%s: transfer failed: %s\n", USBDEVNAME(sc->sc_dev), usbd_errstr(err))); - usbd_free_request(xfer); + usbd_free_xfer(xfer); return(err); } - usbd_get_request_status(xfer, &priv, &buffer, &size, &err); + usbd_get_xfer_status(xfer, &priv, &buffer, &size, &err); if (xfer_size != NULL) *xfer_size = size; - usbd_free_request(xfer); + usbd_free_xfer(xfer); return(USBD_NORMAL_COMPLETION); } diff --git a/sys/dev/usb/umodem.c b/sys/dev/usb/umodem.c index 797716703181..b051d4b12830 100644 --- a/sys/dev/usb/umodem.c +++ b/sys/dev/usb/umodem.c @@ -1,4 +1,4 @@ -/* $NetBSD: umodem.c,v 1.17 1999/11/16 10:21:11 augustss Exp $ */ +/* $NetBSD: umodem.c,v 1.18 1999/11/17 23:00:50 augustss Exp $ */ /* * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -193,7 +193,7 @@ USB_ATTACH(umodem) usb_endpoint_descriptor_t *ed; usb_cdc_cm_descriptor_t *cmd; char devinfo[1024]; - usbd_status r; + usbd_status err; int data_ifaceno; int i; struct tty *tp; @@ -213,7 +213,7 @@ USB_ATTACH(umodem) /* Get the data interface no. */ cmd = umodem_get_desc(dev, UDESC_CS_INTERFACE, UDESCSUB_CDC_CM); - if (!cmd) { + if (cmd == NULL) { DPRINTF(("%s: no CM desc\n", USBDEVNAME(sc->sc_dev))); goto bad; } @@ -235,7 +235,7 @@ USB_ATTACH(umodem) } } } - if (!sc->sc_data_iface) { + if (sc->sc_data_iface == NULL) { printf("%s: no data interface\n", USBDEVNAME(sc->sc_dev)); goto bad; } @@ -249,7 +249,7 @@ USB_ATTACH(umodem) id = usbd_get_interface_descriptor(sc->sc_data_iface); for (i = 0; i < id->bNumEndpoints; i++) { ed = usbd_interface2endpoint_descriptor(sc->sc_data_iface, i); - if (!ed) { + if (ed == NULL) { printf("%s: no endpoint descriptor for %d\n", USBDEVNAME(sc->sc_dev), i); goto bad; @@ -275,9 +275,9 @@ USB_ATTACH(umodem) } if (sc->sc_cm_cap & USB_CDC_CM_OVER_DATA) { - r = umodem_set_comm_feature(sc, UCDC_ABSTRACT_STATE, + err = umodem_set_comm_feature(sc, UCDC_ABSTRACT_STATE, UCDC_DATA_MULTIPLEXED); - if (r != USBD_NORMAL_COMPLETION) + if (err) goto bad; sc->sc_cm_over_data = 1; } @@ -373,9 +373,9 @@ umodemstart(tp) DPRINTFN(4,("umodemstart: %d chars\n", cnt)); /* XXX what can we do on error? */ - usbd_setup_request(sc->sc_oxfer, sc->sc_bulkout_pipe, - (usbd_private_handle)sc, sc->sc_obuf, cnt, - USBD_NO_COPY, USBD_NO_TIMEOUT, umodemwritecb); + usbd_setup_xfer(sc->sc_oxfer, sc->sc_bulkout_pipe, + (usbd_private_handle)sc, sc->sc_obuf, cnt, + USBD_NO_COPY, USBD_NO_TIMEOUT, umodemwritecb); (void)usbd_transfer(sc->sc_oxfer); out: @@ -405,7 +405,7 @@ umodemwritecb(xfer, p, status) return; } - usbd_get_request_status(xfer, 0, 0, &cc, 0); + usbd_get_xfer_status(xfer, 0, 0, &cc, 0); DPRINTFN(5,("umodemwritecb: cc=%d\n", cc)); s = spltty(); @@ -495,7 +495,7 @@ umodemopen(dev, flag, mode, p) struct proc *p; { int unit = UMODEMUNIT(dev); - usbd_status r; + usbd_status err; struct umodem_softc *sc; struct tty *tp; int s; @@ -504,7 +504,7 @@ umodemopen(dev, flag, mode, p) if (unit >= umodem_cd.cd_ndevs) return (ENXIO); sc = umodem_cd.cd_devs[unit]; - if (sc == 0) + if (sc == NULL) return (ENXIO); if (sc->sc_dying) @@ -563,16 +563,16 @@ umodemopen(dev, flag, mode, p) DPRINTF(("umodemopen: open pipes\n")); /* Open the bulk pipes */ - r = usbd_open_pipe(sc->sc_data_iface, sc->sc_bulkin_no, 0, - &sc->sc_bulkin_pipe); - if (r != USBD_NORMAL_COMPLETION) { + err = usbd_open_pipe(sc->sc_data_iface, sc->sc_bulkin_no, 0, + &sc->sc_bulkin_pipe); + if (err) { DPRINTF(("%s: cannot open bulk out pipe (addr %d)\n", USBDEVNAME(sc->sc_dev), sc->sc_bulkin_no)); return (EIO); } - r = usbd_open_pipe(sc->sc_data_iface, sc->sc_bulkout_no, - USBD_EXCLUSIVE_USE, &sc->sc_bulkout_pipe); - if (r != USBD_NORMAL_COMPLETION) { + err = usbd_open_pipe(sc->sc_data_iface, sc->sc_bulkout_no, + USBD_EXCLUSIVE_USE, &sc->sc_bulkout_pipe); + if (err) { DPRINTF(("%s: cannot open bulk in pipe (addr %d)\n", USBDEVNAME(sc->sc_dev), sc->sc_bulkout_no)); usbd_close_pipe(sc->sc_bulkin_pipe); @@ -580,7 +580,7 @@ umodemopen(dev, flag, mode, p) } /* Allocate a request and an input buffer and start reading. */ - sc->sc_ixfer = usbd_alloc_request(sc->sc_udev); + sc->sc_ixfer = usbd_alloc_xfer(sc->sc_udev); if (sc->sc_ixfer == NULL) { usbd_close_pipe(sc->sc_bulkin_pipe); usbd_close_pipe(sc->sc_bulkout_pipe); @@ -588,23 +588,23 @@ umodemopen(dev, flag, mode, p) } sc->sc_ibuf = usbd_alloc_buffer(sc->sc_ixfer, UMODEMIBUFSIZE); if (sc->sc_ibuf == NULL) { - usbd_free_request(sc->sc_ixfer); + usbd_free_xfer(sc->sc_ixfer); usbd_close_pipe(sc->sc_bulkin_pipe); usbd_close_pipe(sc->sc_bulkout_pipe); return (ENOMEM); } - sc->sc_oxfer = usbd_alloc_request(sc->sc_udev); + sc->sc_oxfer = usbd_alloc_xfer(sc->sc_udev); if (sc->sc_oxfer == NULL) { - usbd_free_request(sc->sc_ixfer); + usbd_free_xfer(sc->sc_ixfer); usbd_close_pipe(sc->sc_bulkin_pipe); usbd_close_pipe(sc->sc_bulkout_pipe); return (ENOMEM); } sc->sc_obuf = usbd_alloc_buffer(sc->sc_oxfer, UMODEMOBUFSIZE); if (sc->sc_obuf == NULL) { - usbd_free_request(sc->sc_oxfer); - usbd_free_request(sc->sc_ixfer); + usbd_free_xfer(sc->sc_oxfer); + usbd_free_xfer(sc->sc_ixfer); usbd_close_pipe(sc->sc_bulkin_pipe); usbd_close_pipe(sc->sc_bulkout_pipe); return (ENOMEM); @@ -642,17 +642,17 @@ usbd_status umodemstartread(sc) struct umodem_softc *sc; { - usbd_status r; + usbd_status err; DPRINTFN(5,("umodemstartread: start\n")); - usbd_setup_request(sc->sc_ixfer, sc->sc_bulkin_pipe, - (usbd_private_handle)sc, - sc->sc_ibuf, UMODEMIBUFSIZE, - USBD_SHORT_XFER_OK | USBD_NO_COPY, - USBD_NO_TIMEOUT, umodemreadcb); - r = usbd_transfer(sc->sc_ixfer); - if (r != USBD_IN_PROGRESS) - return (r); + usbd_setup_xfer(sc->sc_ixfer, sc->sc_bulkin_pipe, + (usbd_private_handle)sc, + sc->sc_ibuf, UMODEMIBUFSIZE, + USBD_SHORT_XFER_OK | USBD_NO_COPY, + USBD_NO_TIMEOUT, umodemreadcb); + err = usbd_transfer(sc->sc_ixfer); + if (err) + return (err); return (USBD_NORMAL_COMPLETION); } @@ -665,7 +665,7 @@ umodemreadcb(xfer, p, status) struct umodem_softc *sc = (struct umodem_softc *)p; struct tty *tp = sc->sc_tty; int (*rint) __P((int c, struct tty *tp)) = linesw[tp->t_line].l_rint; - usbd_status r; + usbd_status err; u_int32_t cc; u_char *cp; int s; @@ -680,7 +680,7 @@ umodemreadcb(xfer, p, status) return; } - usbd_get_request_status(xfer, 0, (void **)&cp, &cc, 0); + usbd_get_xfer_status(xfer, 0, (void **)&cp, &cc, 0); DPRINTFN(5,("umodemreadcb: got %d chars, tp=%p\n", cc, tp)); s = spltty(); /* Give characters to tty layer. */ @@ -693,8 +693,8 @@ umodemreadcb(xfer, p, status) } splx(s); - r = umodemstartread(sc); - if (r != USBD_NORMAL_COMPLETION) { + err = umodemstartread(sc); + if (err) { printf("%s: read start failed\n", USBDEVNAME(sc->sc_dev)); /* XXX what should we dow now? */ } @@ -741,8 +741,8 @@ umodem_cleanup(sc) usbd_close_pipe(sc->sc_bulkin_pipe); usbd_abort_pipe(sc->sc_bulkout_pipe); usbd_close_pipe(sc->sc_bulkout_pipe); - usbd_free_request(sc->sc_ixfer); - usbd_free_request(sc->sc_oxfer); + usbd_free_xfer(sc->sc_ixfer); + usbd_free_xfer(sc->sc_oxfer); } int @@ -963,7 +963,7 @@ umodem_set_comm_feature(sc, feature, state) int state; { usb_device_request_t req; - usbd_status r; + usbd_status err; usb_cdc_abstract_state_t ast; req.bmRequestType = UT_WRITE_CLASS_INTERFACE; @@ -973,11 +973,11 @@ umodem_set_comm_feature(sc, feature, state) USETW(req.wLength, UCDC_ABSTRACT_STATE_LENGTH); USETW(ast.wState, state); - r = usbd_do_request(sc->sc_udev, &req, &ast); - if (r != USBD_NORMAL_COMPLETION) { + err = usbd_do_request(sc->sc_udev, &req, &ast); + if (err) { DPRINTF(("umodem_set_comm_feature: feature=%d failed, r=%d\n", - feature, r)); - return (r); + feature, err)); + return (err); } return (USBD_NORMAL_COMPLETION); @@ -989,7 +989,7 @@ umodem_set_line_coding(sc, state) usb_cdc_line_state_t *state; { usb_device_request_t req; - usbd_status r; + usbd_status err; DPRINTF(("umodem_set_line_coding: rate=%d fmt=%d parity=%d bits=%d\n", UGETDW(state->dwDTERate), state->bCharFormat, @@ -1006,10 +1006,10 @@ umodem_set_line_coding(sc, state) USETW(req.wIndex, sc->sc_ctl_iface_no); USETW(req.wLength, UCDC_LINE_STATE_LENGTH); - r = usbd_do_request(sc->sc_udev, &req, state); - if (r != USBD_NORMAL_COMPLETION) { - DPRINTF(("umodem_set_line_coding: failed, r=%d\n", r)); - return (r); + err = usbd_do_request(sc->sc_udev, &req, state); + if (err) { + DPRINTF(("umodem_set_line_coding: failed, err=%d\n", err)); + return (err); } sc->sc_line_state = *state; diff --git a/sys/dev/usb/usbdi.c b/sys/dev/usb/usbdi.c index e826eae35938..bdc2896ec185 100644 --- a/sys/dev/usb/usbdi.c +++ b/sys/dev/usb/usbdi.c @@ -1,4 +1,4 @@ -/* $NetBSD: usbdi.c,v 1.49 1999/11/16 22:19:03 augustss Exp $ */ +/* $NetBSD: usbdi.c,v 1.50 1999/11/17 23:00:50 augustss Exp $ */ /* * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -73,8 +73,8 @@ static void usbd_do_request_async_cb __P((usbd_xfer_handle, usbd_private_handle, usbd_status)); static void usbd_start_next __P((usbd_pipe_handle pipe)); -static SIMPLEQ_HEAD(, usbd_xfer) usbd_free_requests = - SIMPLEQ_HEAD_INITIALIZER(usbd_free_requests); +static SIMPLEQ_HEAD(, usbd_xfer) usbd_free_xfers = + SIMPLEQ_HEAD_INITIALIZER(usbd_free_xfers); static int usbd_nbuses = 0; @@ -90,12 +90,12 @@ usbd_finish() usbd_xfer_handle xfer; if (--usbd_nbuses == 0) { - /* Last controller is gone, free all requests. */ + /* Last controller is gone, free all xfers. */ for (;;) { - xfer = SIMPLEQ_FIRST(&usbd_free_requests); + xfer = SIMPLEQ_FIRST(&usbd_free_xfers); if (xfer == NULL) break; - SIMPLEQ_REMOVE_HEAD(&usbd_free_requests, xfer, next); + SIMPLEQ_REMOVE_HEAD(&usbd_free_xfers, xfer, next); free(xfer, M_USB); } } @@ -181,12 +181,12 @@ usbd_open_pipe_intr(iface, address, flags, pipe, priv, buffer, length, cb) err = usbd_open_pipe(iface, address, USBD_EXCLUSIVE_USE, &ipipe); if (err) return (err); - xfer = usbd_alloc_request(iface->device); + xfer = usbd_alloc_xfer(iface->device); if (xfer == NULL) { err = USBD_NOMEM; goto bad1; } - usbd_setup_request(xfer, ipipe, priv, buffer, length, flags, + usbd_setup_xfer(xfer, ipipe, priv, buffer, length, flags, USBD_NO_TIMEOUT, cb); ipipe->intrxfer = xfer; ipipe->repeat = 1; @@ -199,7 +199,7 @@ usbd_open_pipe_intr(iface, address, flags, pipe, priv, buffer, length, cb) bad2: ipipe->intrxfer = NULL; ipipe->repeat = 0; - usbd_free_request(xfer); + usbd_free_xfer(xfer); bad1: usbd_close_pipe(ipipe); return (err); @@ -224,7 +224,7 @@ usbd_close_pipe(pipe) pipe->endpoint->refcnt--; pipe->methods->close(pipe); if (pipe->intrxfer != NULL) - usbd_free_request(pipe->intrxfer); + usbd_free_xfer(pipe->intrxfer); free(pipe, M_USB); return (USBD_NORMAL_COMPLETION); } @@ -343,37 +343,37 @@ usbd_get_buffer(xfer) } usbd_xfer_handle -usbd_alloc_request(dev) +usbd_alloc_xfer(dev) usbd_device_handle dev; { usbd_xfer_handle xfer; - xfer = SIMPLEQ_FIRST(&usbd_free_requests); + xfer = SIMPLEQ_FIRST(&usbd_free_xfers); if (xfer != NULL) - SIMPLEQ_REMOVE_HEAD(&usbd_free_requests, xfer, next); + SIMPLEQ_REMOVE_HEAD(&usbd_free_xfers, xfer, next); else xfer = malloc(sizeof(*xfer), M_USB, M_NOWAIT); if (xfer == NULL) return (0); memset(xfer, 0, sizeof *xfer); xfer->device = dev; - DPRINTFN(5,("usbd_alloc_request() = %p\n", xfer)); + DPRINTFN(5,("usbd_alloc_xfer() = %p\n", xfer)); return (xfer); } usbd_status -usbd_free_request(xfer) +usbd_free_xfer(xfer) usbd_xfer_handle xfer; { - DPRINTFN(5,("usbd_free_request: %p\n", xfer)); + DPRINTFN(5,("usbd_free_xfer: %p\n", xfer)); if (xfer->rqflags & (URQ_DEV_DMABUF | URQ_AUTO_DMABUF)) usbd_free_buffer(xfer); - SIMPLEQ_INSERT_HEAD(&usbd_free_requests, xfer, next); + SIMPLEQ_INSERT_HEAD(&usbd_free_xfers, xfer, next); return (USBD_NORMAL_COMPLETION); } void -usbd_setup_request(xfer, pipe, priv, buffer, length, flags, timeout, callback) +usbd_setup_xfer(xfer, pipe, priv, buffer, length, flags, timeout, callback) usbd_xfer_handle xfer; usbd_pipe_handle pipe; usbd_private_handle priv; @@ -399,7 +399,7 @@ usbd_setup_request(xfer, pipe, priv, buffer, length, flags, timeout, callback) } void -usbd_setup_default_request(xfer, dev, priv, timeout, req, buffer, +usbd_setup_default_xfer(xfer, dev, priv, timeout, req, buffer, length, flags, callback) usbd_xfer_handle xfer; usbd_device_handle dev; @@ -428,7 +428,7 @@ usbd_setup_default_request(xfer, dev, priv, timeout, req, buffer, } void -usbd_setup_isoc_request(xfer, pipe, priv, frlengths, nframes, flags, callback) +usbd_setup_isoc_xfer(xfer, pipe, priv, frlengths, nframes, flags, callback) usbd_xfer_handle xfer; usbd_pipe_handle pipe; usbd_private_handle priv; @@ -452,7 +452,7 @@ usbd_setup_isoc_request(xfer, pipe, priv, frlengths, nframes, flags, callback) } void -usbd_get_request_status(xfer, priv, buffer, count, status) +usbd_get_xfer_status(xfer, priv, buffer, count, status) usbd_xfer_handle xfer; usbd_private_handle *priv; void **buffer; @@ -894,10 +894,10 @@ usbd_do_request_flags(dev, req, data, flags, actlen) } #endif - xfer = usbd_alloc_request(dev); + xfer = usbd_alloc_xfer(dev); if (xfer == NULL) return (USBD_NOMEM); - usbd_setup_default_request(xfer, dev, 0, USBD_DEFAULT_TIMEOUT, req, + usbd_setup_default_xfer(xfer, dev, 0, USBD_DEFAULT_TIMEOUT, req, data, UGETW(req->wLength), flags, 0); err = usbd_sync_transfer(xfer); #if defined(USB_DEBUG) || defined(DIAGNOSTIC) @@ -928,7 +928,7 @@ usbd_do_request_flags(dev, req, data, flags, actlen) USETW(treq.wValue, 0); USETW(treq.wIndex, 0); USETW(treq.wLength, sizeof(usb_status_t)); - usbd_setup_default_request(xfer, dev, 0, USBD_DEFAULT_TIMEOUT, + usbd_setup_default_xfer(xfer, dev, 0, USBD_DEFAULT_TIMEOUT, &treq, &status,sizeof(usb_status_t), 0, 0); nerr = usbd_sync_transfer(xfer); @@ -943,7 +943,7 @@ usbd_do_request_flags(dev, req, data, flags, actlen) USETW(treq.wValue, UF_ENDPOINT_HALT); USETW(treq.wIndex, 0); USETW(treq.wLength, 0); - usbd_setup_default_request(xfer, dev, 0, USBD_DEFAULT_TIMEOUT, + usbd_setup_default_xfer(xfer, dev, 0, USBD_DEFAULT_TIMEOUT, &treq, &status, 0, 0, 0); nerr = usbd_sync_transfer(xfer); if (nerr) @@ -951,7 +951,7 @@ usbd_do_request_flags(dev, req, data, flags, actlen) } bad: - usbd_free_request(xfer); + usbd_free_xfer(xfer); return (err); } @@ -972,7 +972,7 @@ usbd_do_request_async_cb(xfer, priv, status) UGETW(xfer->request.wLength), xfer->length, xfer->actlen)); #endif - usbd_free_request(xfer); + usbd_free_xfer(xfer); } /* @@ -988,14 +988,14 @@ usbd_do_request_async(dev, req, data) usbd_xfer_handle xfer; usbd_status err; - xfer = usbd_alloc_request(dev); + xfer = usbd_alloc_xfer(dev); if (xfer == NULL) return (USBD_NOMEM); - usbd_setup_default_request(xfer, dev, 0, USBD_DEFAULT_TIMEOUT, req, + usbd_setup_default_xfer(xfer, dev, 0, USBD_DEFAULT_TIMEOUT, req, data, UGETW(req->wLength), 0, usbd_do_request_async_cb); err = usbd_transfer(xfer); if (err != USBD_IN_PROGRESS) { - usbd_free_request(xfer); + usbd_free_xfer(xfer); return (err); } return (USBD_NORMAL_COMPLETION); diff --git a/sys/dev/usb/usbdi.h b/sys/dev/usb/usbdi.h index 1838aa5da6c0..15434658d837 100644 --- a/sys/dev/usb/usbdi.h +++ b/sys/dev/usb/usbdi.h @@ -1,4 +1,4 @@ -/* $NetBSD: usbdi.h,v 1.32 1999/11/12 00:34:58 augustss Exp $ */ +/* $NetBSD: usbdi.h,v 1.33 1999/11/17 23:00:50 augustss Exp $ */ /* * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -94,23 +94,23 @@ usbd_status usbd_open_pipe u_int8_t flags, usbd_pipe_handle *pipe)); usbd_status usbd_close_pipe __P((usbd_pipe_handle pipe)); usbd_status usbd_transfer __P((usbd_xfer_handle req)); -usbd_xfer_handle usbd_alloc_request __P((usbd_device_handle)); -usbd_status usbd_free_request __P((usbd_xfer_handle xfer)); -void usbd_setup_request +usbd_xfer_handle usbd_alloc_xfer __P((usbd_device_handle)); +usbd_status usbd_free_xfer __P((usbd_xfer_handle xfer)); +void usbd_setup_xfer __P((usbd_xfer_handle xfer, usbd_pipe_handle pipe, usbd_private_handle priv, void *buffer, u_int32_t length, u_int16_t flags, u_int32_t timeout, usbd_callback)); -void usbd_setup_default_request +void usbd_setup_default_xfer __P((usbd_xfer_handle xfer, usbd_device_handle dev, usbd_private_handle priv, u_int32_t timeout, usb_device_request_t *req, void *buffer, u_int32_t length, u_int16_t flags, usbd_callback)); -void usbd_setup_isoc_request +void usbd_setup_isoc_xfer __P((usbd_xfer_handle xfer, usbd_pipe_handle pipe, usbd_private_handle priv, u_int16_t *frlengths, u_int32_t nframes, u_int16_t flags, usbd_callback)); -void usbd_get_request_status +void usbd_get_xfer_status __P((usbd_xfer_handle xfer, usbd_private_handle *priv, void **buffer, u_int32_t *count, usbd_status *status)); usb_endpoint_descriptor_t *usbd_interface2endpoint_descriptor diff --git a/sys/dev/usb/usbdi_util.c b/sys/dev/usb/usbdi_util.c index b1ee3f035045..7e1649816c5f 100644 --- a/sys/dev/usb/usbdi_util.c +++ b/sys/dev/usb/usbdi_util.c @@ -1,4 +1,4 @@ -/* $NetBSD: usbdi_util.c,v 1.23 1999/11/12 00:34:58 augustss Exp $ */ +/* $NetBSD: usbdi_util.c,v 1.24 1999/11/17 23:00:50 augustss Exp $ */ /* * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -504,8 +504,8 @@ usbd_bulk_transfer(xfer, pipe, flags, timeout, buf, size, lbl) usbd_status err; int s, error; - usbd_setup_request(xfer, pipe, 0, buf, *size, - flags, timeout, usbd_bulk_transfer_cb); + usbd_setup_xfer(xfer, pipe, 0, buf, *size, + flags, timeout, usbd_bulk_transfer_cb); DPRINTFN(1, ("usbd_bulk_transfer: start transfer %d bytes\n", *size)); s = splusb(); /* don't want callback until tsleep() */ err = usbd_transfer(xfer); @@ -520,7 +520,7 @@ usbd_bulk_transfer(xfer, pipe, flags, timeout, buf, size, lbl) usbd_abort_pipe(pipe); return (USBD_INTERRUPTED); } - usbd_get_request_status(xfer, 0, 0, size, &err); + usbd_get_xfer_status(xfer, 0, 0, size, &err); DPRINTFN(1,("usbd_bulk_transfer: transferred %d\n", *size)); if (err) { DPRINTF(("usbd_bulk_transfer: error=%d\n", err));