]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/usb/host/uhci-q.c
Pull utrace into release branch
[linux-2.6-omap-h63xx.git] / drivers / usb / host / uhci-q.c
index e5d60d5b105a8975979c731a401eee26b0effd62..1f0c2cf26e5d54532ad23a384c1ede813b625b3b 100644 (file)
@@ -123,14 +123,10 @@ static struct uhci_td *uhci_alloc_td(struct uhci_hcd *uhci)
 
 static void uhci_free_td(struct uhci_hcd *uhci, struct uhci_td *td)
 {
-       if (!list_empty(&td->list)) {
-               dev_warn(uhci_dev(uhci), "td %p still in list!\n", td);
-               WARN_ON(1);
-       }
-       if (!list_empty(&td->fl_list)) {
-               dev_warn(uhci_dev(uhci), "td %p still in fl_list!\n", td);
-               WARN_ON(1);
-       }
+       if (!list_empty(&td->list))
+               dev_WARN(uhci_dev(uhci), "td %p still in list!\n", td);
+       if (!list_empty(&td->fl_list))
+               dev_WARN(uhci_dev(uhci), "td %p still in fl_list!\n", td);
 
        dma_pool_free(uhci->td_pool, td, td->dma_handle);
 }
@@ -295,10 +291,8 @@ static struct uhci_qh *uhci_alloc_qh(struct uhci_hcd *uhci,
 static void uhci_free_qh(struct uhci_hcd *uhci, struct uhci_qh *qh)
 {
        WARN_ON(qh->state != QH_STATE_IDLE && qh->udev);
-       if (!list_empty(&qh->queue)) {
-               dev_warn(uhci_dev(uhci), "qh %p list not empty!\n", qh);
-               WARN_ON(1);
-       }
+       if (!list_empty(&qh->queue))
+               dev_WARN(uhci_dev(uhci), "qh %p list not empty!\n", qh);
 
        list_del(&qh->node);
        if (qh->udev) {
@@ -746,11 +740,9 @@ static void uhci_free_urb_priv(struct uhci_hcd *uhci,
 {
        struct uhci_td *td, *tmp;
 
-       if (!list_empty(&urbp->node)) {
-               dev_warn(uhci_dev(uhci), "urb %p still on QH's list!\n",
+       if (!list_empty(&urbp->node))
+               dev_WARN(uhci_dev(uhci), "urb %p still on QH's list!\n",
                                urbp->urb);
-               WARN_ON(1);
-       }
 
        list_for_each_entry_safe(td, tmp, &urbp->td_list, list) {
                uhci_remove_td_from_urbp(td);
@@ -1171,7 +1163,7 @@ static int uhci_result_common(struct uhci_hcd *uhci, struct urb *urb)
                                /* Some debugging code */
                                dev_dbg(&urb->dev->dev,
                                                "%s: failed with status %x\n",
-                                               __FUNCTION__, status);
+                                               __func__, status);
 
                                if (debug > 1 && errbuf) {
                                        /* Print the chain for debugging */
@@ -1271,7 +1263,8 @@ static int uhci_submit_isochronous(struct uhci_hcd *uhci, struct urb *urb,
        } else if (qh->period != urb->interval) {
                return -EINVAL;         /* Can't change the period */
 
-       } else {        /* Pick up where the last URB leaves off */
+       } else {
+               /* Find the next unused frame */
                if (list_empty(&qh->queue)) {
                        frame = qh->iso_frame;
                } else {
@@ -1283,10 +1276,18 @@ static int uhci_submit_isochronous(struct uhci_hcd *uhci, struct urb *urb,
                                        lurb->number_of_packets *
                                        lurb->interval;
                }
-               if (urb->transfer_flags & URB_ISO_ASAP)
-                       urb->start_frame = frame;
-               else if (urb->start_frame != frame)
-                       return -EINVAL;
+               if (urb->transfer_flags & URB_ISO_ASAP) {
+                       /* Skip some frames if necessary to insure
+                        * the start frame is in the future.
+                        */
+                       uhci_get_current_frame_number(uhci);
+                       if (uhci_frame_before_eq(frame, uhci->frame_number)) {
+                               frame = uhci->frame_number + 1;
+                               frame += ((qh->phase - frame) &
+                                       (qh->period - 1));
+                       }
+               }       /* Otherwise pick up where the last URB leaves off */
+               urb->start_frame = frame;
        }
 
        /* Make sure we won't have to go too far into the future */