aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorAlan Stern <stern@rowland.harvard.edu>2007-07-13 15:47:16 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2007-07-19 20:46:05 -0400
commitbeafef072af10bc8497c9ee51ce2804aa7da26be (patch)
tree93ffc881e2916c3250d69735826af2f4a0381b91 /drivers
parente7e7c360fb07020b24652843aec442325baad0ce (diff)
USB: documentation update for usb_unlink_urb
This patch (as936) updates the kerneldoc for usb_unlink_urb. The explanation of how endpoint queues are meant to work is now clearer and in better agreement with reality. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/usb/core/urb.c88
1 files changed, 45 insertions, 43 deletions
diff --git a/drivers/usb/core/urb.c b/drivers/usb/core/urb.c
index 52ec44b828f3..be630228461c 100644
--- a/drivers/usb/core/urb.c
+++ b/drivers/usb/core/urb.c
@@ -440,55 +440,57 @@ int usb_submit_urb(struct urb *urb, gfp_t mem_flags)
440 * @urb: pointer to urb describing a previously submitted request, 440 * @urb: pointer to urb describing a previously submitted request,
441 * may be NULL 441 * may be NULL
442 * 442 *
443 * This routine cancels an in-progress request. URBs complete only 443 * This routine cancels an in-progress request. URBs complete only once
444 * once per submission, and may be canceled only once per submission. 444 * per submission, and may be canceled only once per submission.
445 * Successful cancellation means the requests's completion handler will 445 * Successful cancellation means termination of @urb will be expedited
446 * be called with a status code indicating that the request has been 446 * and the completion handler will be called with a status code
447 * canceled (rather than any other code) and will quickly be removed 447 * indicating that the request has been canceled (rather than any other
448 * from host controller data structures. 448 * code).
449 * 449 *
450 * This request is always asynchronous. 450 * This request is always asynchronous. Success is indicated by
451 * Success is indicated by returning -EINPROGRESS, 451 * returning -EINPROGRESS, at which time the URB will probably not yet
452 * at which time the URB will normally have been unlinked but not yet 452 * have been given back to the device driver. When it is eventually
453 * given back to the device driver. When it is called, the completion 453 * called, the completion function will see @urb->status == -ECONNRESET.
454 * function will see urb->status == -ECONNRESET. Failure is indicated 454 * Failure is indicated by usb_unlink_urb() returning any other value.
455 * by any other return value. Unlinking will fail when the URB is not 455 * Unlinking will fail when @urb is not currently "linked" (i.e., it was
456 * currently "linked" (i.e., it was never submitted, or it was unlinked 456 * never submitted, or it was unlinked before, or the hardware is already
457 * before, or the hardware is already finished with it), even if the 457 * finished with it), even if the completion handler has not yet run.
458 * completion handler has not yet run.
459 * 458 *
460 * Unlinking and Endpoint Queues: 459 * Unlinking and Endpoint Queues:
461 * 460 *
461 * [The behaviors and guarantees described below do not apply to virtual
462 * root hubs but only to endpoint queues for physical USB devices.]
463 *
462 * Host Controller Drivers (HCDs) place all the URBs for a particular 464 * Host Controller Drivers (HCDs) place all the URBs for a particular
463 * endpoint in a queue. Normally the queue advances as the controller 465 * endpoint in a queue. Normally the queue advances as the controller
464 * hardware processes each request. But when an URB terminates with an 466 * hardware processes each request. But when an URB terminates with an
465 * error its queue stops, at least until that URB's completion routine 467 * error its queue generally stops (see below), at least until that URB's
466 * returns. It is guaranteed that the queue will not restart until all 468 * completion routine returns. It is guaranteed that a stopped queue
467 * its unlinked URBs have been fully retired, with their completion 469 * will not restart until all its unlinked URBs have been fully retired,
468 * routines run, even if that's not until some time after the original 470 * with their completion routines run, even if that's not until some time
469 * completion handler returns. Normally the same behavior and guarantees 471 * after the original completion handler returns. The same behavior and
470 * apply when an URB terminates because it was unlinked; however if an 472 * guarantee apply when an URB terminates because it was unlinked.
471 * URB is unlinked before the hardware has started to execute it, then 473 *
472 * its queue is not guaranteed to stop until all the preceding URBs have 474 * Bulk and interrupt endpoint queues are guaranteed to stop whenever an
473 * completed. 475 * URB terminates with any sort of error, including -ECONNRESET, -ENOENT,
474 * 476 * and -EREMOTEIO. Control endpoint queues behave the same way except
475 * This means that USB device drivers can safely build deep queues for 477 * that they are not guaranteed to stop for -EREMOTEIO errors. Queues
476 * large or complex transfers, and clean them up reliably after any sort 478 * for isochronous endpoints are treated differently, because they must
477 * of aborted transfer by unlinking all pending URBs at the first fault. 479 * advance at fixed rates. Such queues do not stop when an URB
478 * 480 * encounters an error or is unlinked. An unlinked isochronous URB may
479 * Note that an URB terminating early because a short packet was received 481 * leave a gap in the stream of packets; it is undefined whether such
480 * will count as an error if and only if the URB_SHORT_NOT_OK flag is set. 482 * gaps can be filled in.
481 * Also, that all unlinks performed in any URB completion handler must 483 *
482 * be asynchronous. 484 * Note that early termination of an URB because a short packet was
483 * 485 * received will generate a -EREMOTEIO error if and only if the
484 * Queues for isochronous endpoints are treated differently, because they 486 * URB_SHORT_NOT_OK flag is set. By setting this flag, USB device
485 * advance at fixed rates. Such queues do not stop when an URB is unlinked. 487 * drivers can build deep queues for large or complex bulk transfers
486 * An unlinked URB may leave a gap in the stream of packets. It is undefined 488 * and clean them up reliably after any sort of aborted transfer by
487 * whether such gaps can be filled in. 489 * unlinking all pending URBs at the first fault.
488 * 490 *
489 * When a control URB terminates with an error, it is likely that the 491 * When a control URB terminates with an error other than -EREMOTEIO, it
490 * status stage of the transfer will not take place, even if it is merely 492 * is quite likely that the status stage of the transfer will not take
491 * a soft error resulting from a short-packet with URB_SHORT_NOT_OK set. 493 * place.
492 */ 494 */
493int usb_unlink_urb(struct urb *urb) 495int usb_unlink_urb(struct urb *urb)
494{ 496{