From owner-p4-projects@FreeBSD.ORG Thu Jun 4 22:58:46 2009 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 7981B106573B; Thu, 4 Jun 2009 22:58:45 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6338A106566C for ; Thu, 4 Jun 2009 22:58:45 +0000 (UTC) (envelope-from thompsa@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 5057B8FC1D for ; Thu, 4 Jun 2009 22:58:45 +0000 (UTC) (envelope-from thompsa@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id n54MwjCU056760 for ; Thu, 4 Jun 2009 22:58:45 GMT (envelope-from thompsa@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id n54MwjVl056758 for perforce@freebsd.org; Thu, 4 Jun 2009 22:58:45 GMT (envelope-from thompsa@freebsd.org) Date: Thu, 4 Jun 2009 22:58:45 GMT Message-Id: <200906042258.n54MwjVl056758@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to thompsa@freebsd.org using -f From: Andrew Thompson To: Perforce Change Reviews Cc: Subject: PERFORCE change 163532 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Jun 2009 22:58:47 -0000 http://perforce.freebsd.org/chv.cgi?CH=163532 Change 163532 by thompsa@thompsa_burger on 2009/06/04 22:58:04 Rename usb2_transfer_setup and usb2_transfer_unsetup Affected files ... .. //depot/projects/usb_buf/src/sys/dev/usb/usb_compat_linux.c#8 edit .. //depot/projects/usb_buf/src/sys/dev/usb/usb_core.h#11 edit .. //depot/projects/usb_buf/src/sys/dev/usb/usb_device.c#10 edit .. //depot/projects/usb_buf/src/sys/dev/usb/usb_generic.c#10 edit .. //depot/projects/usb_buf/src/sys/dev/usb/usb_hub.c#9 edit .. //depot/projects/usb_buf/src/sys/dev/usb/usb_msctest.c#6 edit .. //depot/projects/usb_buf/src/sys/dev/usb/usb_transfer.c#10 edit Differences ... ==== //depot/projects/usb_buf/src/sys/dev/usb/usb_compat_linux.c#8 (text+ko) ==== @@ -720,7 +720,7 @@ /* optimize */ return (0); } - usb2_transfer_unsetup(uhe->bsd_xfer, 2); + usb_pipe_close(uhe->bsd_xfer, 2); uhe->fbsd_buf_size = bufsize; @@ -759,8 +759,8 @@ /* Allocate and setup two generic FreeBSD USB transfers */ - if (usb2_transfer_setup(dev, &uhe->bsd_iface_index, - uhe->bsd_xfer, cfg, 2, uhe, &Giant)) { + if (usb_pipe_open(dev, &uhe->bsd_iface_index, + uhe->bsd_xfer, cfg, 2, uhe)) { return (-EINVAL); } } else { @@ -779,8 +779,8 @@ cfg[0].flags.proxy_buffer = 1; cfg[0].flags.short_xfer_ok = 1; - if (usb2_transfer_setup(dev, &uhe->bsd_iface_index, - uhe->bsd_xfer, cfg, 1, uhe, &Giant)) { + if (usb_pipe_open(dev, &uhe->bsd_iface_index, + uhe->bsd_xfer, cfg, 1, uhe)) { return (-EINVAL); } } ==== //depot/projects/usb_buf/src/sys/dev/usb/usb_core.h#11 (text+ko) ==== @@ -539,17 +539,12 @@ enum usb_hc_mode usb2_get_mode(struct usb_device *udev); enum usb_dev_speed usb2_get_speed(struct usb_device *udev); uint32_t usb2_get_isoc_fps(struct usb_device *udev); -usb_error_t usb2_transfer_setup(struct usb_device *udev, - const uint8_t *ifaces, struct usb_pipe **pipe, - const struct usb_config *setup_start, uint16_t n_setup, - void *priv_sc, struct mtx *priv_mtx); void usb2_set_frame_data(struct usb_pipe *pipe, void *ptr, usb_frcount_t frindex); void usb2_set_frame_offset(struct usb_pipe *pipe, usb_frlength_t offset, usb_frcount_t frindex); void usb2_transfer_clear_stall(struct usb_pipe *pipe); void usb2_transfer_set_stall(struct usb_pipe *pipe); -void usb2_transfer_unsetup(struct usb_pipe **pipe, uint16_t n_setup); void usb2_set_parent_iface(struct usb_device *udev, uint8_t iface_index, uint8_t parent_index); uint8_t usb2_get_bus_index(struct usb_device *udev); @@ -564,6 +559,11 @@ void usb_free_urb(struct usb_urb *); void usb_submit_urb(struct usb_urb *urb); void usb_submit_urb_sync(struct usb_urb *urb); +usb_error_t usb_pipe_open(struct usb_device *udev, + const uint8_t *ifaces, struct usb_pipe **pipe, + const struct usb_config *setup_start, uint16_t n_setup, + void *priv_sc); +void usb_pipe_close(struct usb_pipe **pipe, uint16_t n_setup); void usb_pipe_halt(struct usb_pipe *pipe); void usb_pipe_drain(struct usb_pipe *pipe); #endif /* _USB2_CORE_H_ */ ==== //depot/projects/usb_buf/src/sys/dev/usb/usb_device.c#10 (text+ko) ==== @@ -1965,14 +1965,14 @@ if (udev->flags.usb_mode == USB_MODE_DEVICE) { /* stop receiving any control transfers (Device Side Mode) */ - usb2_transfer_unsetup(udev->default_pipe, USB_DEFAULT_XFER_MAX); + usb_pipe_close(udev->default_pipe, USB_DEFAULT_XFER_MAX); } /* the following will get the device unconfigured in software */ usb2_unconfigure(udev, flag); /* unsetup any leftover default USB transfers */ - usb2_transfer_unsetup(udev->default_pipe, USB_DEFAULT_XFER_MAX); + usb_pipe_close(udev->default_pipe, USB_DEFAULT_XFER_MAX); /* template unsetup, if any */ (usb2_temp_unsetup_p) (udev); ==== //depot/projects/usb_buf/src/sys/dev/usb/usb_generic.c#10 (text+ko) ==== @@ -125,11 +125,10 @@ mtx_unlock(f->priv_mtx); /* - * "usb2_transfer_setup()" can sleep so one needs to make a wrapper, + * "usb_pipe_open()" can sleep so one needs to make a wrapper, * exiting the mutex and checking things */ - error = usb2_transfer_setup(udev, &iface_index, f->pipe, - setup, n_setup, f, f->priv_mtx); + error = usb_pipe_open(udev, &iface_index, f->pipe, setup, n_setup, f); if (error == 0) { if (f->pipe[0]->nframes == 1) { @@ -141,7 +140,7 @@ 2 * f->pipe[0]->nframes); } if (error) { - usb2_transfer_unsetup(f->pipe, n_setup); + usb_pipe_close(f->pipe, n_setup); } } mtx_lock(f->priv_mtx); @@ -195,7 +194,7 @@ usb_pipe_halt(f->pipe[1]); mtx_unlock(f->priv_mtx); - usb2_transfer_unsetup(f->pipe, 2); + usb_pipe_close(f->pipe, 2); usb2_fifo_free_buffer(f); if (ugen_fs_uninit(f)) { @@ -920,7 +919,7 @@ if (f->fs_pipe == NULL) { return (EINVAL); } - usb2_transfer_unsetup(f->fs_pipe, f->fs_ep_max); + usb_pipe_close(f->fs_pipe, f->fs_ep_max); free(f->fs_pipe, M_USB); f->fs_pipe = NULL; f->fs_ep_max = 0; @@ -1450,9 +1449,8 @@ } } } - error = usb2_transfer_setup(f->udev, &iface_index, - f->fs_pipe + u.popen->ep_index, usb_config, 1, - f, f->priv_mtx); + error = usb_pipe_open(f->udev, &iface_index, + f->fs_pipe + u.popen->ep_index, usb_config, 1, f); if (error == 0) { /* update maximums */ u.popen->max_packet_length = @@ -1475,7 +1473,7 @@ error = EINVAL; break; } - usb2_transfer_unsetup(f->fs_pipe + u.pclose->ep_index, 1); + usb_pipe_close(f->fs_pipe + u.pclose->ep_index, 1); break; case USB_FS_CLEAR_STALL_SYNC: ==== //depot/projects/usb_buf/src/sys/dev/usb/usb_hub.c#9 (text+ko) ==== @@ -752,8 +752,8 @@ err = 0; } else { /* normal HUB */ - err = usb2_transfer_setup(udev, &iface_index, sc->sc_xfer, - uhub_config, UHUB_N_TRANSFER, sc, &Giant); + err = usb_pipe_open(udev, &iface_index, sc->sc_xfer, + uhub_config, UHUB_N_TRANSFER, sc); } if (err) { DPRINTFN(0, "cannot setup interrupt transfer, " @@ -841,7 +841,7 @@ return (0); error: - usb2_transfer_unsetup(sc->sc_xfer, UHUB_N_TRANSFER); + usb_pipe_close(sc->sc_xfer, UHUB_N_TRANSFER); if (udev->hub) { free(udev->hub, M_USBDEV); @@ -883,7 +883,7 @@ USB_UNCFG_FLAG_FREE_EP0); } - usb2_transfer_unsetup(sc->sc_xfer, UHUB_N_TRANSFER); + usb_pipe_close(sc->sc_xfer, UHUB_N_TRANSFER); free(hub, M_USBDEV); sc->sc_udev->hub = NULL; ==== //depot/projects/usb_buf/src/sys/dev/usb/usb_msctest.c#6 (text+ko) ==== @@ -510,9 +510,8 @@ mtx_init(&sc->mtx, "USB autoinstall", NULL, MTX_DEF); usb2_cv_init(&sc->cv, "WBBB"); - err = usb2_transfer_setup(udev, - &iface_index, sc->xfer, bbb_config, - ST_MAX, sc, &sc->mtx); + err = usb_pipe_open(udev, &iface_index, sc->xfer, bbb_config, + ST_MAX, sc); if (err) { goto done; @@ -566,7 +565,7 @@ done: mtx_unlock(&sc->mtx); - usb2_transfer_unsetup(sc->xfer, ST_MAX); + usb_pipe_close(sc->xfer, ST_MAX); mtx_destroy(&sc->mtx); usb2_cv_destroy(&sc->cv); free(sc, M_USB); ==== //depot/projects/usb_buf/src/sys/dev/usb/usb_transfer.c#10 (text+ko) ==== @@ -90,7 +90,6 @@ static void usb2_callback_ss_done_defer(struct usb_urb *); static void usb2_callback_wrapper(struct usb_xfer_queue *); static void usb2_dma_delay_done_cb(void *); -//static void usb2_transfer_start_cb(void *); static uint8_t usb2_callback_wrapper_sub(struct usb_urb *); static void usb2_get_std_packet_size(struct usb2_std_packet_size *ptr, uint8_t type, enum usb_dev_speed speed); @@ -710,10 +709,10 @@ } /*------------------------------------------------------------------------* - * usb2_transfer_setup - setup an array of USB transfers + * usb_pipe_open - setup an array of USB transfers * - * NOTE: You must always call "usb2_transfer_unsetup" after calling - * "usb2_transfer_setup" if success was returned. + * NOTE: You must always call "usb_pipe_close" after calling + * "usb_pipe_open" if success was returned. * * The idea is that the USB device driver should pre-allocate all its * transfers by one call to this function. @@ -723,10 +722,10 @@ * Else: Failure *------------------------------------------------------------------------*/ usb_error_t -usb2_transfer_setup(struct usb_device *udev, +usb_pipe_open(struct usb_device *udev, const uint8_t *ifaces, struct usb_pipe **ppxfer, const struct usb_config *setup_start, uint16_t n_setup, - void *priv_sc, struct mtx *fer_mtx) + void *priv_sc) { struct usb_pipe dummy; struct usb_setup_params parm; @@ -744,7 +743,7 @@ info = NULL; WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, - "usb2_transfer_setup can sleep!"); + "usb_pipe_open can sleep!"); /* do some checking first */ @@ -1040,7 +1039,7 @@ } } if (parm.err) { - usb2_transfer_unsetup(ppxfer, n_setup); + usb_pipe_close(ppxfer, n_setup); } return (parm.err); } @@ -1098,21 +1097,21 @@ } /*------------------------------------------------------------------------* - * usb2_transfer_unsetup - unsetup/free an array of USB transfers + * usb_pipe_close - unsetup/free an array of USB transfers * * NOTE: All USB transfers in progress will get called back passing * the error code "USB_ERR_CANCELLED" before this function * returns. *------------------------------------------------------------------------*/ void -usb2_transfer_unsetup(struct usb_pipe **pxfer, uint16_t n_setup) +usb_pipe_close(struct usb_pipe **pxfer, uint16_t n_setup) { struct usb_pipe *pipe; struct usb_xfer_root *info; uint8_t needs_delay = 0; WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, - "usb2_transfer_unsetup can sleep!"); + "usb_pipe_close can sleep!"); while (n_setup--) { pipe = pxfer[n_setup]; @@ -1653,7 +1652,7 @@ /* * Any additional DMA delay is done by - * "usb2_transfer_unsetup()". + * "usb_pipe_close()". */ } @@ -2471,16 +2470,15 @@ /* * Unsetup any existing USB transfer: */ - usb2_transfer_unsetup(udev->default_pipe, USB_DEFAULT_XFER_MAX); + usb_pipe_close(udev->default_pipe, USB_DEFAULT_XFER_MAX); /* * Try to setup a new USB transfer for the * default control endpoint: */ iface_index = 0; - if (usb2_transfer_setup(udev, &iface_index, - udev->default_pipe, usb2_control_ep_cfg, USB_DEFAULT_XFER_MAX, NULL, - udev->default_mtx)) { + if (usb_pipe_open(udev, &iface_index, udev->default_pipe, + usb2_control_ep_cfg, USB_DEFAULT_XFER_MAX, NULL)) { DPRINTFN(0, "could not setup default " "USB transfer!\n"); } else {