PERFORCE change 129389 for review
Hans Petter Selasky
hselasky at FreeBSD.org
Thu Nov 22 12:00:28 PST 2007
http://perforce.freebsd.org/chv.cgi?CH=129389
Change 129389 by hselasky at hselasky_laptop001 on 2007/11/22 20:00:04
Style code by running "usb_style.sh".
Affected files ...
.. //depot/projects/usb/src/sys/dev/usb/usb_transfer.c#44 edit
Differences ...
==== //depot/projects/usb/src/sys/dev/usb/usb_transfer.c#44 (text+ko) ====
@@ -1264,75 +1264,74 @@
if (!xfer->flags_int.open) {
return;
}
+ /* set "transferring" and "recursed_2" flags */
+ xfer->flags_int.transferring = 1;
+ xfer->flags_int.recursed_2 = 1;
- /* set "transferring" and "recursed_2" flags */
- xfer->flags_int.transferring = 1;
- xfer->flags_int.recursed_2 = 1;
+ /* clear lengths and frame counts by default */
+ xfer->sumlen = 0;
+ xfer->actlen = 0;
+ xfer->aframes = 0;
- /* clear lengths and frame counts by default */
- xfer->sumlen = 0;
- xfer->actlen = 0;
- xfer->aframes = 0;
+ /* sanity check */
- /* sanity check */
+ if (xfer->nframes == 0) {
+ usbd_premature_callback(xfer, USBD_INVAL);
+ return;
+ }
+ /* compute total transfer length */
- if (xfer->nframes == 0) {
+ for (x = 0; x != xfer->nframes; x++) {
+ xfer->sumlen += xfer->frlengths[x];
+ if (xfer->sumlen < xfer->frlengths[x]) {
+ /* length wrapped around */
usbd_premature_callback(xfer, USBD_INVAL);
return;
}
- /* compute total transfer length */
+ }
- for (x = 0; x != xfer->nframes; x++) {
- xfer->sumlen += xfer->frlengths[x];
- if (xfer->sumlen < xfer->frlengths[x]) {
- /* length wrapped around */
- usbd_premature_callback(xfer, USBD_INVAL);
- return;
- }
- }
+ /* filter some flags */
- /* filter some flags */
+ xfer->flags_int.short_xfer_ok = 0;
+ xfer->flags_int.short_frames_ok = 0;
- xfer->flags_int.short_xfer_ok = 0;
- xfer->flags_int.short_frames_ok = 0;
+ /* check if this is a control transfer */
- /* check if this is a control transfer */
+ if (xfer->flags_int.control_xfr) {
- if (xfer->flags_int.control_xfr) {
-
- if (usbd_start_hardware_sub(xfer)) {
- usbd_premature_callback(xfer, USBD_STALLED);
- return;
+ if (usbd_start_hardware_sub(xfer)) {
+ usbd_premature_callback(xfer, USBD_STALLED);
+ return;
+ }
+ if (xfer->endpoint & UE_DIR_IN) {
+ if (xfer->flags.short_xfer_ok) {
+ xfer->flags_int.short_xfer_ok = 1;
}
- if (xfer->endpoint & UE_DIR_IN) {
- if (xfer->flags.short_xfer_ok) {
- xfer->flags_int.short_xfer_ok = 1;
- }
- }
- } else {
+ }
+ } else {
- if (xfer->endpoint & UE_DIR_IN) {
- if (xfer->flags.short_frames_ok) {
- xfer->flags_int.short_xfer_ok = 1;
- xfer->flags_int.short_frames_ok = 1;
- } else if (xfer->flags.short_xfer_ok) {
- xfer->flags_int.short_xfer_ok = 1;
- }
+ if (xfer->endpoint & UE_DIR_IN) {
+ if (xfer->flags.short_frames_ok) {
+ xfer->flags_int.short_xfer_ok = 1;
+ xfer->flags_int.short_frames_ok = 1;
+ } else if (xfer->flags.short_xfer_ok) {
+ xfer->flags_int.short_xfer_ok = 1;
}
}
+ }
- mtx_lock(xfer->usb_mtx);
+ mtx_lock(xfer->usb_mtx);
- /*
- * Setup "usb_thread"
- */
- xfer->usb_thread = (xfer->flags.use_polling) ?
- curthread : NULL;
+ /*
+ * Setup "usb_thread"
+ */
+ xfer->usb_thread = (xfer->flags.use_polling) ?
+ curthread : NULL;
- /* enter the transfer */
- (xfer->pipe->methods->enter) (xfer);
+ /* enter the transfer */
+ (xfer->pipe->methods->enter) (xfer);
- mtx_unlock(xfer->usb_mtx);
+ mtx_unlock(xfer->usb_mtx);
return;
}
More information about the p4-projects
mailing list