Merge to Fedora kernel-2.6.17-1.2187_FC5 patched with stable patch-2.6.17.13-vs2...
[linux-2.6.git] / drivers / usb / host / uhci-q.c
index a06d84c..5f44354 100644 (file)
@@ -264,7 +264,7 @@ static void uhci_fixup_toggles(struct uhci_qh *qh, int skip_first)
                 * need to change any toggles in this URB */
                td = list_entry(urbp->td_list.next, struct uhci_td, list);
                if (toggle > 1 || uhci_toggle(td_token(td)) == toggle) {
-                       td = list_entry(urbp->td_list.next, struct uhci_td,
+                       td = list_entry(urbp->td_list.prev, struct uhci_td,
                                        list);
                        toggle = uhci_toggle(td_token(td)) ^ 1;
 
@@ -896,12 +896,14 @@ static int uhci_result_common(struct uhci_hcd *uhci, struct urb *urb)
                        /*
                         * This URB stopped short of its end.  We have to
                         * fix up the toggles of the following URBs on the
-                        * queue and restart the queue.
+                        * queue and restart the queue.  But only if this
+                        * TD isn't the last one in the URB.
                         *
                         * Do this only the first time we encounter the
                         * short URB.
                         */
-                       if (!urbp->short_transfer) {
+                       if (!urbp->short_transfer &&
+                                       &td->list != urbp->td_list.prev) {
                                urbp->short_transfer = 1;
                                urbp->qh->initial_toggle =
                                                uhci_toggle(td_token(td)) ^ 1;