ChangeSet 1.2181.4.45, 2005/03/21 22:30:56-08:00, [EMAIL PROTECTED]

        [PATCH] UHCI updates
        
        This is the third of five updates to the uhci-hcd driver:
        
                Change the first argument to uhci_finish_completion from hcd
                to uhci and expand the spinlock-protected region to include
                the entire timer callback routine plus the suspend and resume
                routines.  It's a little awkward that the reset routine must
                run without the spinlock, but that whole pathway will vanish
                before long.
        
        Signed-off-by: Alan Stern <[EMAIL PROTECTED]>
        Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>



 uhci-hcd.c |   23 ++++++++++++++++++-----
 uhci-q.c   |    5 ++---
 2 files changed, 20 insertions(+), 8 deletions(-)


diff -Nru a/drivers/usb/host/uhci-hcd.c b/drivers/usb/host/uhci-hcd.c
--- a/drivers/usb/host/uhci-hcd.c       2005-03-30 15:13:42 -08:00
+++ b/drivers/usb/host/uhci-hcd.c       2005-03-30 15:13:42 -08:00
@@ -119,7 +119,7 @@
        if (!list_empty(&uhci->urb_remove_list) &&
            uhci_get_current_frame_number(uhci) != uhci->urb_remove_age) {
                uhci_remove_pending_urbps(uhci);
-               uhci_finish_completion(hcd, NULL);
+               uhci_finish_completion(uhci, NULL);
                called_uhci_finish_completion = 1;
        }
 
@@ -134,7 +134,6 @@
 
                spin_unlock(&u->lock);
        }
-       spin_unlock_irqrestore(&uhci->lock, flags);
 
        /* Wake up anyone waiting for an URB to complete */
        if (called_uhci_finish_completion)
@@ -152,6 +151,7 @@
                uhci_check_ports(uhci);
 
        init_stall_timer(hcd);
+       spin_unlock_irqrestore(&uhci->lock, flags);
 }
 
 static int init_stall_timer(struct usb_hcd *hcd)
@@ -227,7 +227,7 @@
                /* Checks the status and does all of the magic necessary */
                uhci_transfer_result(uhci, urb);
        }
-       uhci_finish_completion(hcd, regs);
+       uhci_finish_completion(uhci, regs);
 
        spin_unlock(&uhci->lock);
 
@@ -747,7 +747,7 @@
        uhci_free_pending_qhs(uhci);
        uhci_free_pending_tds(uhci);
        uhci_remove_pending_urbps(uhci);
-       uhci_finish_completion(hcd, NULL);
+       uhci_finish_completion(uhci, NULL);
 
        uhci_free_pending_qhs(uhci);
        uhci_free_pending_tds(uhci);
@@ -764,13 +764,20 @@
 {
        struct uhci_hcd *uhci = hcd_to_uhci(hcd);
 
+       spin_lock_irq(&uhci->lock);
+
        /* Don't try to suspend broken motherboards, reset instead */
        if (suspend_allowed(uhci)) {
                suspend_hc(uhci);
                uhci->saved_framenumber =
                                inw(uhci->io_addr + USBFRNUM) & 0x3ff;
-       } else
+       } else {
+               spin_unlock_irq(&uhci->lock);
                reset_hc(uhci);
+               spin_lock_irq(&uhci->lock);
+       }
+
+       spin_unlock_irq(&uhci->lock);
        return 0;
 }
 
@@ -781,6 +788,8 @@
 
        pci_set_master(to_pci_dev(uhci_dev(uhci)));
 
+       spin_lock_irq(&uhci->lock);
+
        if (uhci->state == UHCI_SUSPENDED) {
 
                /*
@@ -799,11 +808,15 @@
                pci_write_config_word(to_pci_dev(uhci_dev(uhci)), USBLEGSUP,
                                USBLEGSUP_DEFAULT);
        } else {
+               spin_unlock_irq(&uhci->lock);
                reset_hc(uhci);
                if ((rc = start_hc(uhci)) != 0)
                        return rc;
+               spin_lock_irq(&uhci->lock);
        }
        hcd->state = HC_STATE_RUNNING;
+
+       spin_unlock_irq(&uhci->lock);
        return 0;
 }
 #endif
diff -Nru a/drivers/usb/host/uhci-q.c b/drivers/usb/host/uhci-q.c
--- a/drivers/usb/host/uhci-q.c 2005-03-30 15:13:42 -08:00
+++ b/drivers/usb/host/uhci-q.c 2005-03-30 15:13:42 -08:00
@@ -1467,16 +1467,15 @@
        spin_lock(&uhci->lock);
 }
 
-static void uhci_finish_completion(struct usb_hcd *hcd, struct pt_regs *regs)
+static void uhci_finish_completion(struct uhci_hcd *uhci, struct pt_regs *regs)
 {
-       struct uhci_hcd *uhci = hcd_to_uhci(hcd);
        struct urb_priv *urbp, *tmp;
 
        list_for_each_entry_safe(urbp, tmp, &uhci->complete_list, urb_list) {
                struct urb *urb = urbp->urb;
 
                list_del_init(&urbp->urb_list);
-               uhci_finish_urb(hcd, urb, regs);
+               uhci_finish_urb(uhci_to_hcd(uhci), urb, regs);
        }
 }
 
-
To unsubscribe from this list: send the line "unsubscribe bk-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to