PERFORCE change 148446 for review

Hans Petter Selasky hselasky at FreeBSD.org
Mon Aug 25 20:54:41 UTC 2008


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

Change 148446 by hselasky at hselasky_laptop001 on 2008/08/25 20:54:16

	
	Some bugfixes:
	
	1) "usb2_transfer_timeout_ms" must be called with usb2_mtx locked.
	2) Fix regression: If the pipe is stalled we should return from
	starting the transfer. This only affects USB device side mode.
	3) Simplify dma-delay logic.

Affected files ...

.. //depot/projects/usb/src/sys/dev/usb2/core/usb2_transfer.c#22 edit

Differences ...

==== //depot/projects/usb/src/sys/dev/usb2/core/usb2_transfer.c#22 (text+ko) ====

@@ -1312,13 +1312,8 @@
 		usb2_transfer_dequeue(xfer);
 		mtx_unlock(xfer->usb2_mtx);
 	}
-	if (xfer->flags_int.bdma_enable) {
-		/* no need for DMA delay */
-		xfer->flags_int.did_dma_delay = 1;
-	} else {
-		/* clear "did_dma_delay" flag */
-		xfer->flags_int.did_dma_delay = 0;
-	}
+	/* clear "did_dma_delay" flag */
+	xfer->flags_int.did_dma_delay = 0;
 
 	/* clear "did_close" flag */
 	xfer->flags_int.did_close = 0;
@@ -2115,7 +2110,14 @@
 				    &udev->cs_msg[0], &(udev->cs_msg[1]))) {
 					/* ignore */
 				}
+			} else {
+				/* should not happen */
+				DPRINTFN(0, "No stall handler!\n");
 			}
+			/*
+			 * We get started again when the stall is cleared!
+			 */
+			return;
 		}
 	}
 	/*
@@ -2230,9 +2232,13 @@
 		DPRINTFN(3, "DMA delay, %u ms, "
 		    "on %p\n", temp, xfer);
 
-		usb2_transfer_timeout_ms(xfer,
-		    &usb2_dma_delay_done_cb, temp);
-		return (1);		/* wait for new callback */
+		if (temp != 0) {
+			mtx_lock(xfer->usb2_mtx);
+			usb2_transfer_timeout_ms(xfer,
+			    &usb2_dma_delay_done_cb, temp);
+			mtx_unlock(xfer->usb2_mtx);
+			return (1);	/* wait for new callback */
+		}
 	}
 	/* check actual number of frames */
 	if (xfer->aframes > xfer->nframes) {


More information about the p4-projects mailing list