Johannes:

This patch fixes the problems in the UHCI driver I identified last week:

        It stores the status for a completed URB in urb rather than urbp.

        It avoids setting the status of unlinked URBs to -ECONNRESET,
        since the hcd glue layer already does that.

        It gives back unlinked URBs in the order they were unlinked.

        It sets the SPD flag for all queued IN packets that don't also
        have IOC set.  We need to know as soon as possible if a non-iso.
        transfer gets a short read.

If this looks okay to you, please ask Greg to apply it.

Alan Stern


# This is a BitKeeper generated patch for the following project:
# Project Name: greg k-h's linux 2.5 USB kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher.
# This patch includes the following deltas:
#                  ChangeSet    1.1655  -> 1.1656 
#       drivers/usb/host/uhci-debug.c   1.9     -> 1.10   
#       drivers/usb/host/uhci-hcd.h     1.13    -> 1.14   
#       drivers/usb/host/uhci-hcd.c     1.54    -> 1.55   
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 03/07/22      [EMAIL PROTECTED]       1.1656
# Use urb->status rather than urbp->status.
# Always set the SPD flag for queued IN TDs that aren't at the end of their URB.
# Giveback unlinked URBs in the order they were unlinked.
# --------------------------------------------
#
diff -Nru a/drivers/usb/host/uhci-debug.c b/drivers/usb/host/uhci-debug.c
--- a/drivers/usb/host/uhci-debug.c     Tue Jul 22 11:20:09 2003
+++ b/drivers/usb/host/uhci-debug.c     Tue Jul 22 11:20:09 2003
@@ -320,8 +320,8 @@
        out += sprintf(out, "%s", (urbp->fsbr ? "FSBR " : ""));
        out += sprintf(out, "%s", (urbp->fsbr_timeout ? "FSBR_TO " : ""));
 
-       if (urbp->status != -EINPROGRESS)
-               out += sprintf(out, "Status=%d ", urbp->status);
+       if (urbp->urb->status != -EINPROGRESS)
+               out += sprintf(out, "Status=%d ", urbp->urb->status);
        //out += sprintf(out, "Inserttime=%lx ",urbp->inserttime);
        //out += sprintf(out, "FSBRtime=%lx ",urbp->fsbrtime);
 
diff -Nru a/drivers/usb/host/uhci-hcd.c b/drivers/usb/host/uhci-hcd.c
--- a/drivers/usb/host/uhci-hcd.c       Tue Jul 22 11:20:09 2003
+++ b/drivers/usb/host/uhci-hcd.c       Tue Jul 22 11:20:09 2003
@@ -829,10 +829,12 @@
         * If direction is "send", change the frame from SETUP (0x2D)
         * to OUT (0xE1). Else change it from SETUP to IN (0x69).
         */
-       destination ^= (USB_PID_SETUP ^ usb_packetid(urb->pipe));
-
-       if (!(urb->transfer_flags & URB_SHORT_NOT_OK))
+       if (usb_pipeout(urb->pipe))
+               destination ^= (USB_PID_SETUP ^ USB_PID_OUT);
+       else {
+               destination ^= (USB_PID_SETUP ^ USB_PID_IN);
                status |= TD_CTRL_SPD;
+       }
 
        /*
         * Build the DATA TD's
@@ -1087,7 +1089,7 @@
        status = uhci_maxerr(3) | TD_CTRL_ACTIVE;
        if (urb->dev->speed == USB_SPEED_LOW)
                status |= TD_CTRL_LS;
-       if (!(urb->transfer_flags & URB_SHORT_NOT_OK))
+       if (usb_pipein(urb->pipe))
                status |= TD_CTRL_SPD;
 
        /*
@@ -1534,11 +1536,11 @@
                break;
        }
 
-       urbp->status = ret;
-
        if (ret == -EINPROGRESS)
                goto out;
 
+       urb->status = ret;
+
        switch (usb_pipetype(urb->pipe)) {
        case PIPE_CONTROL:
        case PIPE_BULK:
@@ -1639,12 +1641,8 @@
        unsigned long flags;
        struct urb_priv *urbp = urb->hcpriv;
 
-       /* If this is an interrupt URB that is being killed in urb->complete, */
-       /* then just set its status and return */
-       if (!urbp) {
-         urb->status = -ECONNRESET;
-         return 0;
-       }
+       if (!urbp)
+               return 0;
 
        spin_lock_irqsave(&uhci->urb_list_lock, flags);
 
@@ -1657,7 +1655,7 @@
        /* If we're the first, set the next interrupt bit */
        if (list_empty(&uhci->urb_remove_list))
                uhci_set_next_interrupt(uhci);
-       list_add(&urbp->urb_list, &uhci->urb_remove_list);
+       list_add_tail(&urbp->urb_list, &uhci->urb_remove_list);
 
        spin_unlock(&uhci->urb_remove_list_lock);
        spin_unlock_irqrestore(&uhci->urb_list_lock, flags);
@@ -1803,17 +1801,11 @@
 
 static void uhci_finish_urb(struct usb_hcd *hcd, struct urb *urb, struct pt_regs 
*regs)
 {
-       struct urb_priv *urbp = (struct urb_priv *)urb->hcpriv;
        struct uhci_hcd *uhci = hcd_to_uhci(hcd);
-       int status;
        unsigned long flags;
 
        spin_lock_irqsave(&urb->lock, flags);
-       status = urbp->status;
        uhci_destroy_urb_priv(uhci, urb);
-
-       if (urb->status != -ENOENT && urb->status != -ECONNRESET)
-               urb->status = status;
        spin_unlock_irqrestore(&urb->lock, flags);
 
        usb_hcd_giveback_urb(hcd, urb, regs);
@@ -1859,8 +1851,6 @@
                tmp = tmp->next;
 
                list_del_init(&urbp->urb_list);
-
-               urbp->status = urb->status = -ECONNRESET;
 
                uhci_add_complete(uhci, urb);
        }
diff -Nru a/drivers/usb/host/uhci-hcd.h b/drivers/usb/host/uhci-hcd.h
--- a/drivers/usb/host/uhci-hcd.h       Tue Jul 22 11:20:09 2003
+++ b/drivers/usb/host/uhci-hcd.h       Tue Jul 22 11:20:09 2003
@@ -379,8 +379,6 @@
                                        /*  a control transfer, retrigger */
                                        /*  the status phase */
 
-       int status;                     /* Final status */
-
        unsigned long inserttime;       /* In jiffies */
        unsigned long fsbrtime;         /* In jiffies */
 



-------------------------------------------------------
This SF.net email is sponsored by: VM Ware
With VMware you can run multiple operating systems on a single machine.
WITHOUT REBOOTING! Mix Linux / Windows / Novell virtual machines at the
same time. Free trial click here: http://www.vmware.com/wl/offer/345/0
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to