td = uhci_alloc_td(uhci, urb->dev); 
td = uhci_alloc_td(uhci); 
static int uhci_submit_common(struct uhci_hcd *uhci, struct urb *urb, struct urb *eurb, struct uhci_qh *skelqh){	struct uhci_td *td;	struct uhci_qh *qh;	unsigned long destination, status;	int maxsze = usb_maxpacket(urb->dev, urb->pipe, usb_pipeout(urb->pipe));	int len = urb->transfer_buffer_length;	struct urb_priv *urbp = (struct urb_priv *)urb->hcpriv;	dma_addr_t data = urb->transfer_dma;	if (len < 0)		return -EINVAL;	/* The "pipe" thing contains the destination in bits 8--18 */	destination = (urb->pipe & PIPE_DEVEP_MASK) | usb_packetid(urb->pipe);	status = uhci_maxerr(3) | TD_CTRL_ACTIVE;	if (urb->dev->speed == USB_SPEED_LOW)		status |= TD_CTRL_LS;	if (usb_pipein(urb->pipe))		status |= TD_CTRL_SPD;	/*	 * Build the DATA TD's	 */	do {	/* Allow zero length packets */		int pktsze = maxsze;		if (pktsze >= len) {			pktsze = len;			if (!(urb->transfer_flags & URB_SHORT_NOT_OK))				status &= ~TD_CTRL_SPD;		}		td = uhci_alloc_td(uhci, urb->dev);		if (!td)			return -ENOMEM;		uhci_add_td_to_urb(urb, td);		uhci_fill_td(td, status, destination | uhci_explen(pktsze - 1) |			(usb_gettoggle(urb->dev, usb_pipeendpoint(urb->pipe),			 usb_pipeout(urb->pipe)) << TD_TOKEN_TOGGLE_SHIFT),			data);		data += pktsze;		len -= maxsze;		usb_dotoggle(urb->dev, usb_pipeendpoint(urb->pipe),			usb_pipeout(urb->pipe));	} while (len > 0);	/*	 * URB_ZERO_PACKET means adding a 0-length packet, if direction	 * is OUT and the transfer_length was an exact multiple of maxsze,	 * hence (len = transfer_length - N * maxsze) == 0	 * however, if transfer_length == 0, the zero packet was already	 * prepared above.	 */	if (usb_pipeout(urb->pipe) && (urb->transfer_flags & URB_ZERO_PACKET) &&	    !len && urb->transfer_buffer_length) {		td = uhci_alloc_td(uhci, urb->dev);		if (!td)			return -ENOMEM;		uhci_add_td_to_urb(urb, td);		uhci_fill_td(td, status, destination | uhci_explen(UHCI_NULL_DATA_SIZE) |			(usb_gettoggle(urb->dev, usb_pipeendpoint(urb->pipe),			 usb_pipeout(urb->pipe)) << TD_TOKEN_TOGGLE_SHIFT),			data);		usb_dotoggle(urb->dev, usb_pipeendpoint(urb->pipe),			usb_pipeout(urb->pipe));	}	/* Set the interrupt-on-completion flag on the last packet.	 * A more-or-less typical 4 KB URB (= size of one memory page)	 * will require about 3 ms to transfer; that's a little on the	 * fast side but not enough to justify delaying an interrupt	 * more than 2 or 3 URBs, so we will ignore the URB_NO_INTERRUPT	 * flag setting. */	td->status |= cpu_to_le32(TD_CTRL_IOC);	qh = uhci_alloc_qh(uhci, urb->dev);	if (!qh)		return -ENOMEM;	urbp->qh = qh;	qh->urbp = urbp;	/* Always breadth first */	uhci_insert_tds_in_qh(qh, urb, UHCI_PTR_BREADTH);	if (eurb)		uhci_append_queued_urb(uhci, eurb, urb);	else		uhci_insert_qh(uhci, skelqh, urb);	return -EINPROGRESS;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/2532178a68b5ce4e421d50ea1b1dcc0a1359f19d/uhci-q.c/buggy/drivers/usb/host/uhci-q.c