PERFORCE change 163532 for review

Andrew Thompson thompsa at FreeBSD.org
Thu Jun 4 22:58:47 UTC 2009


http://perforce.freebsd.org/chv.cgi?CH=163532

Change 163532 by thompsa at 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 {


More information about the p4-projects mailing list