PERFORCE change 107766 for review

Hans Petter Selasky hselasky at FreeBSD.org
Thu Oct 12 09:24:32 PDT 2006


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

Change 107766 by hselasky at hselasky_mini_itx on 2006/10/12 16:23:04

	Remove USBD_SELF_DESTRUCT. The flag is broken, and
	currently not used. Calling "usbd_transfer_unsetup()"
	from the callback of a USB transfer is depreciated.

Affected files ...

.. //depot/projects/usb/src/sys/dev/usb/README#12 edit
.. //depot/projects/usb/src/sys/dev/usb/usb_subr.h#25 edit
.. //depot/projects/usb/src/sys/dev/usb/usb_transfer.c#19 edit

Differences ...

==== //depot/projects/usb/src/sys/dev/usb/README#12 (text+ko) ====

@@ -148,6 +148,8 @@
   should be unsetup
 
 NOTE: This function can sleep, waiting for active mutexes to become unlocked!
+NOTE: It is not allowed to call "usbd_transfer_unsetup" from the callback
+      of a USB transfer.
 
 /*------------------------------------------------------------------------*
  * void
@@ -229,10 +231,6 @@
 	without exiting any mutexes, until the transfer is finished or
 	has timed out.
 
-  USBD_SELF_DESTRUCT
-	This flag allows one to free a transfer from its
-	callback function.
-
   USBD_USE_DMA
 	This flag will cause the USB host controller driver to not
 	allocate a second data buffer, "xfer->buffer". Instead of

==== //depot/projects/usb/src/sys/dev/usb/usb_subr.h#25 (text+ko) ====

@@ -312,7 +312,7 @@
 #define USBD_USE_POLLING         0x0200 /* used to make synchronous transfers
 					 * use polling instead of sleep/wakeup
 					 */
-#define USBD_SELF_DESTRUCT       0x0400 /* set if callback is allowed to unsetup itself */
+#define USBD_UNUSED_3            0x0400
 #define USBD_USE_DMA             0x0800
 #define USBD_UNUSED_4            0x1000
 #define USBD_UNUSED_5            0x2000

==== //depot/projects/usb/src/sys/dev/usb/usb_transfer.c#19 (text+ko) ====

@@ -286,7 +286,6 @@
 		      USBD_SHORT_XFER_OK|
 		      USBD_CUSTOM_CLEARSTALL|
 		      USBD_USE_POLLING|
-		      USBD_SELF_DESTRUCT|
 		      USBD_USE_DMA)))
 		{
 		    error = USBD_BAD_FLAG;
@@ -740,17 +739,6 @@
 	 */
 	if(!(xfer->flags & (USBD_DEV_TRANSFERRING)))
 	{
-		if(xfer->flags & USBD_SELF_DESTRUCT)
-		{
-		    /* increment refcount 
-		     * in case the callback
-		     * frees itself:
-		     */
-		    mtx_lock(xfer->usb_mtx);
-		    xfer->usb_root->memory_refcount++;
-		    mtx_unlock(xfer->usb_mtx);
-		}
-
 		/* call callback */
 		__usbd_callback(xfer);
 
@@ -800,10 +788,6 @@
 				}
 			}
 		}
-		if(xfer->flags & USBD_SELF_DESTRUCT)
-		{
-		    usbd_drop_refcount(xfer->usb_root);
-		}
 	}
 	return;
 }
@@ -839,17 +823,6 @@
 		/* always set error */
 		xfer->error = USBD_CANCELLED;
 
-		if(xfer->flags & USBD_SELF_DESTRUCT)
-		{
-		    /* increment refcount 
-		     * in case the callback
-		     * frees itself:
-		     */
-		    mtx_lock(xfer->usb_mtx);
-		    xfer->usb_root->memory_refcount++;
-		    mtx_unlock(xfer->usb_mtx);
-		}
-
 		if(xfer->flags & USBD_DEV_TRANSFERRING)
 		{
 		    /* increment refcount so that scheduled
@@ -864,11 +837,6 @@
 		    __usbd_callback(xfer);
 		}
 		mtx_unlock(xfer->usb_mtx);
-
-		if(xfer->flags & USBD_SELF_DESTRUCT)
-		{
-		    usbd_drop_refcount(xfer->usb_root);
-		}
 	}
 	return;
 }


More information about the p4-projects mailing list