ChangeSet 1.1595.8.9, 2003/07/30 10:36:26-07:00, [EMAIL PROTECTED]

[PATCH] USB: Fix irq problem in hcd_endpoint_disable()

The recent change made to the irq handling in hcd_endpoint_disable()
caused a problem.  The statement

        local_irq_save (flags);

needs to be outside the rescan loop.  Otherwise, on loop iterations after
the first, flags is always set to indicate that interrupts are disabled.

In fact, since the routine ends with might_sleep() anyway, I don't see any
reason to save the interrupt state at all.  My patch just disables
interrupts at the start and enables them at the end.  I'm not sure that's
how you intended it to work, so you may want to change it a little.


 drivers/usb/core/hcd.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)


diff -Nru a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
--- a/drivers/usb/core/hcd.c    Fri Aug  1 10:56:13 2003
+++ b/drivers/usb/core/hcd.c    Fri Aug  1 10:56:13 2003
@@ -1273,7 +1273,6 @@
  */
 static void hcd_endpoint_disable (struct usb_device *udev, int endpoint)
 {
-       unsigned long   flags;
        struct hcd_dev  *dev;
        struct usb_hcd  *hcd;
        struct urb      *urb;
@@ -1282,6 +1281,8 @@
        dev = udev->hcpriv;
        hcd = udev->bus->hcpriv;
 
+       local_irq_disable ();
+
 rescan:
        /* (re)block new requests, as best we can */
        if (endpoint & USB_DIR_IN) {
@@ -1293,7 +1294,6 @@
        }
 
        /* then kill any current requests */
-       local_irq_save (flags);
        spin_lock (&hcd_data_lock);
        list_for_each_entry (urb, &dev->urb_list, urb_list) {
                int     tmp = urb->pipe;
@@ -1342,7 +1342,7 @@
                goto rescan;
        }
        spin_unlock (&hcd_data_lock);
-       local_irq_restore (flags);
+       local_irq_enable ();
 
        /* synchronize with the hardware, so old configuration state
         * clears out immediately (and will be freed).



-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to