Deleted Added
full compact
usb_request.c (190731) usb_request.c (190734)
1/* $FreeBSD: head/sys/dev/usb/usb_request.c 190731 2009-04-05 18:20:03Z thompsa $ */
1/* $FreeBSD: head/sys/dev/usb/usb_request.c 190734 2009-04-05 18:20:38Z thompsa $ */
2/*-
3 * Copyright (c) 1998 The NetBSD Foundation, Inc. All rights reserved.
4 * Copyright (c) 1998 Lennart Augustsson. All rights reserved.
5 * Copyright (c) 2008 Hans Petter Selasky. All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:

--- 304 unchanged lines hidden (view full) ---

314 xfer = udev->default_xfer[0];
315 if (xfer == NULL) {
316 /* most likely out of memory */
317 err = USB_ERR_NOMEM;
318 goto done;
319 }
320 USB_XFER_LOCK(xfer);
321
2/*-
3 * Copyright (c) 1998 The NetBSD Foundation, Inc. All rights reserved.
4 * Copyright (c) 1998 Lennart Augustsson. All rights reserved.
5 * Copyright (c) 2008 Hans Petter Selasky. All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:

--- 304 unchanged lines hidden (view full) ---

314 xfer = udev->default_xfer[0];
315 if (xfer == NULL) {
316 /* most likely out of memory */
317 err = USB_ERR_NOMEM;
318 goto done;
319 }
320 USB_XFER_LOCK(xfer);
321
322 if (flags & USB_DELAY_STATUS_STAGE) {
322 if (flags & USB_DELAY_STATUS_STAGE)
323 xfer->flags.manual_status = 1;
323 xfer->flags.manual_status = 1;
324 } else {
324 else
325 xfer->flags.manual_status = 0;
325 xfer->flags.manual_status = 0;
326 }
327
326
327 if (flags & USB_SHORT_XFER_OK)
328 xfer->flags.short_xfer_ok = 1;
329 else
330 xfer->flags.short_xfer_ok = 0;
331
328 xfer->timeout = timeout;
329
330 start_ticks = ticks;
331
332 max_ticks = USB_MS_TO_TICKS(timeout);
333
334 usb2_copy_in(xfer->frbuffers, 0, req, sizeof(*req));
335

--- 68 unchanged lines hidden (view full) ---

404 } else {
405 xfer->actlen = 0;
406 }
407
408 /* check for short packet */
409
410 if (temp > xfer->actlen) {
411 temp = xfer->actlen;
332 xfer->timeout = timeout;
333
334 start_ticks = ticks;
335
336 max_ticks = USB_MS_TO_TICKS(timeout);
337
338 usb2_copy_in(xfer->frbuffers, 0, req, sizeof(*req));
339

--- 68 unchanged lines hidden (view full) ---

408 } else {
409 xfer->actlen = 0;
410 }
411
412 /* check for short packet */
413
414 if (temp > xfer->actlen) {
415 temp = xfer->actlen;
412 if (!(flags & USB_SHORT_XFER_OK)) {
413 err = USB_ERR_SHORT_XFER;
414 }
415 length = temp;
416 }
417 if (temp > 0) {
418 if (req->bmRequestType & UT_READ) {
419#if USB_HAVE_USER_IO
420 if (flags & USB_USER_DATA_PTR) {
421 USB_XFER_UNLOCK(xfer);
422 err = usb2_copy_out_user(xfer->frbuffers + 1,

--- 1111 unchanged lines hidden ---
416 length = temp;
417 }
418 if (temp > 0) {
419 if (req->bmRequestType & UT_READ) {
420#if USB_HAVE_USER_IO
421 if (flags & USB_USER_DATA_PTR) {
422 USB_XFER_UNLOCK(xfer);
423 err = usb2_copy_out_user(xfer->frbuffers + 1,

--- 1111 unchanged lines hidden ---