PERFORCE change 131807 for review
Hans Petter Selasky
hselasky at FreeBSD.org
Thu Dec 27 13:59:40 PST 2007
http://perforce.freebsd.org/chv.cgi?CH=131807
Change 131807 by hselasky at hselasky_laptop001 on 2007/12/27 21:58:59
Style change by "usb_style.sh".
Affected files ...
.. //depot/projects/usb/src/sys/dev/usb/usb_transfer.c#94 edit
Differences ...
==== //depot/projects/usb/src/sys/dev/usb/usb_transfer.c#94 (text+ko) ====
@@ -1046,10 +1046,10 @@
uint32_t temp = 0;
if (bus->methods->get_dma_delay) {
- (bus->methods->get_dma_delay)(bus, &temp);
- /* round up and convert to milliseconds */
- temp += 0x3FF;
- temp /= 0x400;
+ (bus->methods->get_dma_delay) (bus, &temp);
+ /* round up and convert to milliseconds */
+ temp += 0x3FF;
+ temp /= 0x400;
}
return (temp);
}
@@ -1066,7 +1066,6 @@
temp = usbd_get_dma_delay(info->bus);
usbd_pause_mtx(info->usb_mtx, temp);
}
-
/* wait for interrupt thread to exit */
while (info->done_thread) {
@@ -1194,8 +1193,8 @@
info->setup_refcount--;
if (info->setup_refcount == 0) {
- usbd_transfer_unsetup_sub(info,
- needs_delay);
+ usbd_transfer_unsetup_sub(info,
+ needs_delay);
} else {
mtx_unlock(info->usb_mtx);
}
@@ -1548,7 +1547,6 @@
PRINTFN(-1, ("sanity checks failed\n"));
return;
}
-
/* Only open the USB transfer once! */
if (!xfer->flags_int.open) {
xfer->flags_int.open = 1;
@@ -1557,7 +1555,6 @@
(xfer->pipe->methods->open) (xfer);
mtx_unlock(xfer->usb_mtx);
}
-
/* set "transferring" and "recursed_2" flags */
xfer->flags_int.transferring = 1;
xfer->flags_int.recursed_2 = 1;
@@ -1704,48 +1701,48 @@
xfer = info->dma_curr_xfer;
if (xfer) {
- /* prepare next USB transfer to load, if any */
- info->dma_curr_xfer =
- LIST_PREV(&(info->dma_head), xfer, dma_list);
- LIST_REMOVE(xfer, dma_list);
- xfer->dma_list.le_prev = NULL;
+ /* prepare next USB transfer to load, if any */
+ info->dma_curr_xfer =
+ LIST_PREV(&(info->dma_head), xfer, dma_list);
+ LIST_REMOVE(xfer, dma_list);
+ xfer->dma_list.le_prev = NULL;
- /* check for DMA error */
+ /* check for DMA error */
- if (!xfer->flags_int.open) {
+ if (!xfer->flags_int.open) {
- /* we got cancelled */
+ /* we got cancelled */
- info->dma_refcount++;
- usbd_premature_callback(xfer,
- USBD_CANCELLED);
- info->dma_refcount--;
+ info->dma_refcount++;
+ usbd_premature_callback(xfer,
+ USBD_CANCELLED);
+ info->dma_refcount--;
- } else if (info->dma_error) {
+ } else if (info->dma_error) {
- /* prevent recursion by increasing refcount */
+ /* prevent recursion by increasing refcount */
- info->dma_refcount++;
+ info->dma_refcount++;
- /* report error */
+ /* report error */
- usbd_premature_callback(xfer,
- USBD_DMA_LOAD_FAILED);
+ usbd_premature_callback(xfer,
+ USBD_DMA_LOAD_FAILED);
- info->dma_refcount--;
+ info->dma_refcount--;
- } else {
+ } else {
/* go ahead */
usbd_bdma_pre_sync(xfer);
/* finally start the hardware */
usbd_pipe_enter_wrapper(xfer);
- }
+ }
} else {
/* get first USB transfer */
- info->dma_curr_xfer =
- LIST_FIRST(&(info->dma_head));
+ info->dma_curr_xfer =
+ LIST_FIRST(&(info->dma_head));
}
xfer = info->dma_curr_xfer;
@@ -1753,12 +1750,10 @@
/* nothing more to do */
return;
}
-
if (!xfer->flags_int.open) {
/* we got cancelled */
goto load_complete;
}
-
/* reset BUS-DMA load state */
info->dma_refcount = 1;
@@ -1925,15 +1920,13 @@
/* mark the USB transfer started */
if (!xfer->flags_int.started) {
- xfer->flags_int.started = 1;
+ xfer->flags_int.started = 1;
}
-
/* check if the USB transfer callback is already transferring */
if (xfer->flags_int.transferring) {
return;
}
-
/* call callback */
usbd_callback_wrapper(xfer, NULL, USBD_CONTEXT_START);
@@ -1946,7 +1939,7 @@
*
* NOTE: Calling this function more than one time will only
* result in a single transfer stop.
- * NOTE: When this function returns it is not safe to free nor
+ * NOTE: When this function returns it is not safe to free nor
* reuse any DMA buffers. See "usbd_transfer_drain()".
*------------------------------------------------------------------------*/
void
@@ -2344,29 +2337,28 @@
if (xfer->flags_int.transferring &&
xfer->flags_int.bdma_enable &&
((xfer->error == USBD_CANCELLED) ||
- (xfer->error == USBD_TIMEOUT)) &&
+ (xfer->error == USBD_TIMEOUT)) &&
(!xfer->flags_int.did_dma_delay)) {
- /* only do this one time */
- xfer->flags_int.did_dma_delay = 1;
+ /* only do this one time */
+ xfer->flags_int.did_dma_delay = 1;
- temp = usbd_get_dma_delay(xfer->udev->bus);
+ temp = usbd_get_dma_delay(xfer->udev->bus);
- PRINTFN(2, ("DMA delay, %u ms, "
- "on %p\n", temp, xfer));
+ PRINTFN(2, ("DMA delay, %u ms, "
+ "on %p\n", temp, xfer));
- if (xfer->flags.use_polling) {
- DELAY(temp * 1024);
- } else {
- mtx_lock(xfer->usb_mtx);
- usb_callout_reset(&(xfer->timeout_handle),
- USBD_MS_TO_TICKS(temp) + 1,
- (void *)&usbd_dma_delay_done_cb, xfer);
- mtx_unlock(xfer->usb_mtx);
- break; /* wait for callback */
- }
+ if (xfer->flags.use_polling) {
+ DELAY(temp * 1024);
+ } else {
+ mtx_lock(xfer->usb_mtx);
+ usb_callout_reset(&(xfer->timeout_handle),
+ USBD_MS_TO_TICKS(temp) + 1,
+ (void *)&usbd_dma_delay_done_cb, xfer);
+ mtx_unlock(xfer->usb_mtx);
+ break; /* wait for callback */
+ }
}
-
/* set both recurse flags */
xfer->flags_int.recursed_1 = 1;
xfer->flags_int.recursed_2 = 1;
@@ -2475,7 +2467,6 @@
xfer->flags_int.draining = 0;
wakeup(&(xfer->flags_int));
}
-
/* clear first recurse flag */
xfer->flags_int.recursed_1 = 0;
} else {
More information about the p4-projects
mailing list