Commit 96479c16 authored by David Brownell's avatar David Brownell Committed by Greg Kroah-Hartman

[PATCH] usbcore, remove urb->next

Given the discussions of last week, this removes urb->next from
the USB core API.  This change simplifies the driver API by getting
rid of a superfluous feature (and related new-developer confusion),
gets rid of a hidden failure mode (drivers can now see resubmit
failures), lets us get rid of a HCD feature that isn't consistently
implemented, and so on.

This will break some code.  There are ISO drivers that don't use
urb->next (like audio), but most video drivers do.  My patch #2
fixes one such driver.  My patch #3 fixes host controller drivers,
most of which were already converted.
parent bacf358b
......@@ -892,7 +892,6 @@ static int proc_submiturb(struct dev_state *ps, void *arg)
free_async(as);
return -ENOMEM;
}
as->urb->next = NULL;
as->urb->dev = ps->dev;
as->urb->pipe = (uurb.type << 30) | __create_pipe(ps->dev, uurb.endpoint & 0xf) | (uurb.endpoint & USB_DIR_IN);
as->urb->transfer_flags = uurb.flags;
......
......@@ -1407,11 +1407,6 @@ static int hcd_submit_urb (struct urb *urb, int mem_flags)
if (urb->transfer_buffer_length < 0)
return -EINVAL;
if (urb->next) {
warn ("use explicit queuing not urb->next");
return -EINVAL;
}
#ifdef DEBUG
/* stuff that drivers shouldn't do, but which shouldn't
* cause problems in HCDs if they get it wrong.
......@@ -1785,10 +1780,6 @@ static void hcd_irq (int irq, void *__hcd, struct pt_regs * r)
* HCDs must not use this for periodic URBs that are still scheduled
* and will be reissued. They should just call their completion handlers
* until the urb is returned to the device driver by unlinking.
*
* NOTE that no urb->next processing is done, even for isochronous URBs.
* ISO streaming functionality can be achieved by having completion handlers
* re-queue URBs. Such explicit queuing doesn't discard error reports.
*/
void usb_hcd_giveback_urb (struct usb_hcd *hcd, struct urb *urb)
{
......
......@@ -184,7 +184,6 @@ void usb_show_string(struct usb_device *dev, char *id, int index)
void usb_dump_urb (struct urb *urb)
{
printk ("urb :%p\n", urb);
printk ("next :%p\n", urb->next);
printk ("dev :%p\n", urb->dev);
printk ("pipe :%08X\n", urb->pipe);
printk ("status :%d\n", urb->status);
......
......@@ -767,7 +767,6 @@ typedef void (*usb_complete_t)(struct urb *);
/**
* struct urb - USB Request Block
* @urb_list: For use by current owner of the URB.
* @next: Used to link ISO requests into rings.
* @pipe: Holds endpoint number, direction, type, and max packet size.
* Create these values with the eight macros available;
* usb_{snd,rcv}TYPEpipe(dev,endpoint), where the type is "ctrl"
......@@ -827,7 +826,7 @@ typedef void (*usb_complete_t)(struct urb *);
*
* Initialization:
*
* All URBs submitted must initialize dev, pipe, next (may be null),
* All URBs submitted must initialize dev, pipe,
* transfer_flags (may be zero), complete, timeout (may be zero).
* The USB_ASYNC_UNLINK transfer flag affects later invocations of
* the usb_unlink_urb() routine.
......@@ -873,7 +872,9 @@ typedef void (*usb_complete_t)(struct urb *);
* the quality of service is only "best effort". Callers provide specially
* allocated URBs, with number_of_packets worth of iso_frame_desc structures
* at the end. Each such packet is an individual ISO transfer. Isochronous
* URBs are normally submitted with urb->next fields set up as a ring, so
* URBs are normally queued (no flag like USB_BULK_QUEUE is needed) so that
* transfers are at least double buffered, and then explicitly resubmitted
* in completion handlers, so
* that data (such as audio or video) streams at as constant a rate as the
* host controller scheduler can support.
*
......@@ -891,14 +892,15 @@ typedef void (*usb_complete_t)(struct urb *);
* When completion callback is invoked for non-isochronous URBs, the
* actual_length field tells how many bytes were transferred.
*
* For interrupt and isochronous URBs, the URB provided to the callback
* For interrupt URBs, the URB provided to the callback
* function is still "owned" by the USB core subsystem unless the status
* indicates that the URB has been unlinked. Completion handlers should
* not modify such URBs until they have been unlinked.
*
* ISO transfer status is reported in the status and actual_length fields
* of the iso_frame_desc array, and the number of errors is reported in
* error_count.
* error_count. Completion callbacks for ISO transfers will normally
* (re)submit URBs to ensure a constant transfer rate.
*/
struct urb
{
......@@ -906,7 +908,6 @@ struct urb
atomic_t count; /* reference count of the URB */
void *hcpriv; /* private data for host controller */
struct list_head urb_list; /* list pointer to all active urbs */
struct urb *next; /* (in) pointer to next URB */
struct usb_device *dev; /* (in) pointer to associated device */
unsigned int pipe; /* (in) pipe information */
int status; /* (return) non-ISO status */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment