Greg:

This patch is a repeat of as331 as described in

http://marc.theaimsgroup.com/?l=linux-usb-devel&m=108811725219677&w=2

It has been updated slightly to match the current source.  It should be 
non-controversial; it has nothing to do with hubs or locking.  Please 
apply.

Alan Stern



Signed-off-by: Alan Stern <[EMAIL PROTECTED]>

# 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.2120  -> 1.2121 
#       drivers/isdn/hisax/st5481_usb.c 1.36    -> 1.37   
#       drivers/usb/core/message.c      1.102   -> 1.103  
#       drivers/usb/host/hc_simple.c    1.16    -> 1.17   
#       drivers/usb/core/hub.c  1.188   -> 1.189  
#       drivers/usb/host/ohci-q.c       1.95    -> 1.96   
#       drivers/usb/core/hcd.h  1.81    -> 1.82   
#       drivers/usb/image/microtek.c    1.44    -> 1.45   
#       drivers/usb/storage/transport.c 1.144   -> 1.145  
#        include/linux/usb.h    1.201   -> 1.202  
#       drivers/usb/host/uhci-hcd.c     1.122   -> 1.123  
#       drivers/usb/core/devices.c      1.40    -> 1.41   
#       drivers/usb/core/urb.c  1.48    -> 1.49   
#       drivers/usb/host/ehci-q.c       1.97    -> 1.98   
#       drivers/usb/core/hcd.c  1.151   -> 1.152  
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 04/08/03      [EMAIL PROTECTED]       1.2121
# as331
# --------------------------------------------
#
diff -Nru a/drivers/isdn/hisax/st5481_usb.c b/drivers/isdn/hisax/st5481_usb.c
--- a/drivers/isdn/hisax/st5481_usb.c   Tue Aug  3 14:17:59 2004
+++ b/drivers/isdn/hisax/st5481_usb.c   Tue Aug  3 14:17:59 2004
@@ -143,9 +143,6 @@
        if (ctrl_msg->dr.bRequest == USB_REQ_CLEAR_FEATURE) {
                /* Special case handling for pipe reset */
                le16_to_cpus(&ctrl_msg->dr.wIndex);
-               usb_endpoint_running(adapter->usb_dev,
-                                    ctrl_msg->dr.wIndex & ~USB_DIR_IN, 
-                                    (ctrl_msg->dr.wIndex & USB_DIR_IN) == 0);
 
                /* toggle is reset on clear */
                usb_settoggle(adapter->usb_dev, 
diff -Nru a/drivers/usb/core/devices.c b/drivers/usb/core/devices.c
--- a/drivers/usb/core/devices.c        Tue Aug  3 14:17:59 2004
+++ b/drivers/usb/core/devices.c        Tue Aug  3 14:17:59 2004
@@ -283,9 +283,8 @@
 
 /* TBD:
  * 0. TBDs
- * 1. marking active config and ifaces (code lists all, but should mark
+ * 1. marking active interface altsettings (code lists all, but should mark
  *    which ones are active, if any)
- * 2. add <halted> status to each endpoint line
  */
 
 static char *usb_dump_config_descriptor(char *start, char *end, const struct 
usb_config_descriptor *desc, int active)
diff -Nru a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
--- a/drivers/usb/core/hcd.c    Tue Aug  3 14:17:59 2004
+++ b/drivers/usb/core/hcd.c    Tue Aug  3 14:17:59 2004
@@ -1311,13 +1311,10 @@
 
 rescan:
        /* (re)block new requests, as best we can */
-       if (endpoint & USB_DIR_IN) {
-               usb_endpoint_halt (udev, epnum, 0);
+       if (endpoint & USB_DIR_IN)
                udev->epmaxpacketin [epnum] = 0;
-       } else {
-               usb_endpoint_halt (udev, epnum, 1);
+       else
                udev->epmaxpacketout [epnum] = 0;
-       }
 
        /* then kill any current requests */
        spin_lock (&hcd_data_lock);
diff -Nru a/drivers/usb/core/hcd.h b/drivers/usb/core/hcd.h
--- a/drivers/usb/core/hcd.h    Tue Aug  3 14:17:59 2004
+++ b/drivers/usb/core/hcd.h    Tue Aug  3 14:17:59 2004
@@ -376,8 +376,6 @@
 extern int usb_find_interface_driver (struct usb_device *dev,
        struct usb_interface *interface);
 
-#define usb_endpoint_halt(dev, ep, out) ((dev)->halted[out] |= (1 << (ep)))
-
 #define usb_endpoint_out(ep_dir)       (!((ep_dir) & USB_DIR_IN))
 
 /*
diff -Nru a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
--- a/drivers/usb/core/hub.c    Tue Aug  3 14:17:59 2004
+++ b/drivers/usb/core/hub.c    Tue Aug  3 14:17:59 2004
@@ -2044,8 +2044,6 @@
                                != udev->descriptor.bMaxPacketSize0)) {
                usb_disable_endpoint(udev, 0 + USB_DIR_IN);
                usb_disable_endpoint(udev, 0 + USB_DIR_OUT);
-               usb_endpoint_running(udev, 0, 1);
-               usb_endpoint_running(udev, 0, 0);
                udev->epmaxpacketin [0] = udev->descriptor.bMaxPacketSize0;
                udev->epmaxpacketout[0] = udev->descriptor.bMaxPacketSize0;
        }
diff -Nru a/drivers/usb/core/message.c b/drivers/usb/core/message.c
--- a/drivers/usb/core/message.c        Tue Aug  3 14:17:59 2004
+++ b/drivers/usb/core/message.c        Tue Aug  3 14:17:59 2004
@@ -854,9 +854,8 @@
         * the copy in usb-storage, for as long as we need two copies.
         */
 
-       /* toggle was reset by the clear, then ep was reactivated */
+       /* toggle was reset by the clear */
        usb_settoggle(dev, usb_pipeendpoint(pipe), usb_pipeout(pipe), 0);
-       usb_endpoint_running(dev, usb_pipeendpoint(pipe), usb_pipeout(pipe));
 
        return 0;
 }
@@ -870,9 +869,8 @@
  * Deallocates hcd/hardware state for this endpoint ... and nukes all
  * pending urbs.
  *
- * If the HCD hasn't registered a disable() function, this marks the
- * endpoint as halted and sets its maxpacket size to 0 to prevent
- * further submissions.
+ * If the HCD hasn't registered a disable() function, this sets the
+ * endpoint's maxpacket size to 0 to prevent further submissions.
  */
 void usb_disable_endpoint(struct usb_device *dev, unsigned int epaddr)
 {
@@ -881,13 +879,10 @@
        else {
                unsigned int epnum = epaddr & USB_ENDPOINT_NUMBER_MASK;
 
-               if (usb_endpoint_out(epaddr)) {
-                       usb_endpoint_halt(dev, epnum, 1);
+               if (usb_endpoint_out(epaddr))
                        dev->epmaxpacketout[epnum] = 0;
-               } else {
-                       usb_endpoint_halt(dev, epnum, 0);
+               else
                        dev->epmaxpacketin[epnum] = 0;
-               }
        }
 }
 
@@ -930,7 +925,6 @@
                usb_disable_endpoint(dev, i + USB_DIR_IN);
        }
        dev->toggle[0] = dev->toggle[1] = 0;
-       dev->halted[0] = dev->halted[1] = 0;
 
        /* getting rid of interfaces will disconnect
         * any drivers bound to them (a key side effect)
@@ -966,9 +960,8 @@
  * @dev: the device whose interface is being enabled
  * @epd: pointer to the endpoint descriptor
  *
- * Marks the endpoint as running, resets its toggle, and stores
- * its maxpacket value.  For control endpoints, both the input
- * and output sides are handled.
+ * Resets the endpoint toggle and stores its maxpacket value.
+ * For control endpoints, both the input and output sides are handled.
  */
 void usb_enable_endpoint(struct usb_device *dev,
                struct usb_endpoint_descriptor *epd)
@@ -980,12 +973,10 @@
                                USB_ENDPOINT_XFER_CONTROL);
 
        if (usb_endpoint_out(epaddr) || is_control) {
-               usb_endpoint_running(dev, epnum, 1);
                usb_settoggle(dev, epnum, 1, 0);
                dev->epmaxpacketout[epnum] = maxsize;
        }
        if (!usb_endpoint_out(epaddr) || is_control) {
-               usb_endpoint_running(dev, epnum, 0);
                usb_settoggle(dev, epnum, 0, 0);
                dev->epmaxpacketin[epnum] = maxsize;
        }
@@ -1166,7 +1157,6 @@
        }
 
        dev->toggle[0] = dev->toggle[1] = 0;
-       dev->halted[0] = dev->halted[1] = 0;
 
        /* re-init hc/hcd interface/endpoint state */
        for (i = 0; i < config->desc.bNumInterfaces; i++) {
diff -Nru a/drivers/usb/core/urb.c b/drivers/usb/core/urb.c
--- a/drivers/usb/core/urb.c    Tue Aug  3 14:17:59 2004
+++ b/drivers/usb/core/urb.c    Tue Aug  3 14:17:59 2004
@@ -256,13 +256,6 @@
        if (!usb_pipecontrol (pipe) && dev->state < USB_STATE_CONFIGURED)
                return -ENODEV;
 
-       /* (actually HCDs may need to duplicate this, endpoint might yet
-        * stall due to queued bulk/intr transactions that complete after
-        * we check)
-        */
-       if (usb_endpoint_halted (dev, usb_pipeendpoint (pipe), is_out))
-               return -EPIPE;
-
        /* FIXME there should be a sharable lock protecting us against
         * config/altsetting changes and disconnects, kicking in here.
         * (here == before maxpacket, and eventually endpoint type,
diff -Nru a/drivers/usb/host/ehci-q.c b/drivers/usb/host/ehci-q.c
--- a/drivers/usb/host/ehci-q.c Tue Aug  3 14:17:59 2004
+++ b/drivers/usb/host/ehci-q.c Tue Aug  3 14:17:59 2004
@@ -153,17 +153,9 @@
                        usb_pipein (urb->pipe) ? "in" : "out",
                        token, urb->status);
 
-               /* stall indicates some recovery action is needed */
-               if (urb->status == -EPIPE) {
-                       int     pipe = urb->pipe;
-
-                       if (!usb_pipecontrol (pipe))
-                               usb_endpoint_halt (urb->dev,
-                                       usb_pipeendpoint (pipe),
-                                       usb_pipeout (pipe));
-
                /* if async CSPLIT failed, try cleaning out the TT buffer */
-               } else if (urb->dev->tt && !usb_pipeint (urb->pipe)
+               if (urb->status != -EPIPE
+                               && urb->dev->tt && !usb_pipeint (urb->pipe)
                                && ((token & QTD_STS_MMF) != 0
                                        || QTD_CERR(token) == 0)
                                && (!ehci_is_ARC(ehci)
diff -Nru a/drivers/usb/host/hc_simple.c b/drivers/usb/host/hc_simple.c
--- a/drivers/usb/host/hc_simple.c      Tue Aug  3 14:17:59 2004
+++ b/drivers/usb/host/hc_simple.c      Tue Aug  3 14:17:59 2004
@@ -146,11 +146,6 @@
        if (!urb->dev || !urb->dev->bus || urb->hcpriv)
                return -EINVAL;
 
-       if (usb_endpoint_halted
-           (urb->dev, usb_pipeendpoint (pipe), usb_pipeout (pipe))) {
-               printk ("hci_submit_urb: endpoint_halted\n");
-               return -EPIPE;
-       }
        hci = (hci_t *) urb->dev->bus->hcpriv;
 
        /* a request to the virtual root hub */
diff -Nru a/drivers/usb/host/ohci-q.c b/drivers/usb/host/ohci-q.c
--- a/drivers/usb/host/ohci-q.c Tue Aug  3 14:17:59 2004
+++ b/drivers/usb/host/ohci-q.c Tue Aug  3 14:17:59 2004
@@ -751,12 +751,6 @@
 
                cc = TD_CC_GET (tdINFO);
 
-               /* control endpoints only have soft stalls */
-               if (type != PIPE_CONTROL && cc == TD_CC_STALL)
-                       usb_endpoint_halt (urb->dev,
-                               usb_pipeendpoint (urb->pipe),
-                               usb_pipeout (urb->pipe));
-
                /* update packet status if needed (short is normally ok) */
                if (cc == TD_DATAUNDERRUN
                                && !(urb->transfer_flags & URB_SHORT_NOT_OK))
diff -Nru a/drivers/usb/host/uhci-hcd.c b/drivers/usb/host/uhci-hcd.c
--- a/drivers/usb/host/uhci-hcd.c       Tue Aug  3 14:17:59 2004
+++ b/drivers/usb/host/uhci-hcd.c       Tue Aug  3 14:17:59 2004
@@ -1120,10 +1120,6 @@
 
 td_error:
        ret = uhci_map_status(status, uhci_packetout(td_token(td)));
-       if (ret == -EPIPE)
-               /* endpoint has stalled - mark it halted */
-               usb_endpoint_halt(urb->dev, uhci_endpoint(td_token(td)),
-                               uhci_packetout(td_token(td)));
 
 err:
        /* 
diff -Nru a/drivers/usb/image/microtek.c b/drivers/usb/image/microtek.c
--- a/drivers/usb/image/microtek.c      Tue Aug  3 14:17:59 2004
+++ b/drivers/usb/image/microtek.c      Tue Aug  3 14:17:59 2004
@@ -214,8 +214,8 @@
 #ifdef MTS_DO_DEBUG
 
 static inline void mts_debug_dump(struct mts_desc* desc) {
-       MTS_DEBUG("desc at 0x%x: halted = %02x%02x, toggle = %02x%02x\n",
-                 
(int)desc,(int)desc->usb_dev->halted[1],(int)desc->usb_dev->halted[0],
+       MTS_DEBUG("desc at 0x%x: toggle = %02x%02x\n",
+                 (int)desc,
                  (int)desc->usb_dev->toggle[1],(int)desc->usb_dev->toggle[0]
                );
        MTS_DEBUG("ep_out=%x ep_response=%x ep_image=%x\n",
diff -Nru a/drivers/usb/storage/transport.c b/drivers/usb/storage/transport.c
--- a/drivers/usb/storage/transport.c   Tue Aug  3 14:17:59 2004
+++ b/drivers/usb/storage/transport.c   Tue Aug  3 14:17:59 2004
@@ -265,9 +265,7 @@
                USB_ENDPOINT_HALT, endp,
                NULL, 0, 3*HZ);
 
-       /* reset the toggles and endpoint flags */
-       usb_endpoint_running(us->pusb_dev, usb_pipeendpoint(pipe),
-               usb_pipeout(pipe));
+       /* reset the endpoint toggle */
        usb_settoggle(us->pusb_dev, usb_pipeendpoint(pipe),
                usb_pipeout(pipe), 0);
 
diff -Nru a/include/linux/usb.h b/include/linux/usb.h
--- a/include/linux/usb.h       Tue Aug  3 14:17:59 2004
+++ b/include/linux/usb.h       Tue Aug  3 14:17:59 2004
@@ -294,8 +294,6 @@
        struct semaphore serialize;
 
        unsigned int toggle[2];         /* one bit for each endpoint ([0] = IN, [1] = 
OUT) */
-       unsigned int halted[2];         /* endpoint halts; one bit per endpoint # & 
direction; */
-                                       /* [0] = IN, [1] = OUT */
        int epmaxpacketin[16];          /* INput endpoint specific maximums */
        int epmaxpacketout[16];         /* OUTput endpoint specific maximums */
 
@@ -1083,10 +1081,6 @@
 #define usb_gettoggle(dev, ep, out) (((dev)->toggle[out] >> (ep)) & 1)
 #define        usb_dotoggle(dev, ep, out)  ((dev)->toggle[out] ^= (1 << (ep)))
 #define usb_settoggle(dev, ep, out, bit) ((dev)->toggle[out] = ((dev)->toggle[out] & 
~(1 << (ep))) | ((bit) << (ep)))
-
-/* Endpoint halt control/status ... likewise USE WITH CAUTION */
-#define usb_endpoint_running(dev, ep, out) ((dev)->halted[out] &= ~(1 << (ep)))
-#define usb_endpoint_halted(dev, ep, out) ((dev)->halted[out] & (1 << (ep)))
 
 
 static inline unsigned int __create_pipe(struct usb_device *dev, unsigned int 
endpoint)



-------------------------------------------------------
This SF.Net email is sponsored by OSTG. Have you noticed the changes on
Linux.com, ITManagersJournal and NewsForge in the past few weeks? Now,
one more big change to announce. We are now OSTG- Open Source Technology
Group. Come see the changes on the new OSTG site. www.ostg.com
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to