Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=1431d2a44ccf68a547094976f363f94177ab00c6
Commit:     1431d2a44ccf68a547094976f363f94177ab00c6
Parent:     4a00027dcb088bf90fa8fb14a7e8ba3506d78f22
Author:     Alan Stern <[EMAIL PROTECTED]>
AuthorDate: Fri Aug 24 15:42:39 2007 -0400
Committer:  Greg Kroah-Hartman <[EMAIL PROTECTED]>
CommitDate: Fri Oct 12 14:55:23 2007 -0700

    USB: get rid of urb->lock
    
    Now that urb->status isn't used, urb->lock doesn't protect anything.
    This patch (as980) removes it and replaces it with a private mutex in
    the one remaining place it was still used: usb_kill_urb.
    
    Signed-off-by: Alan Stern <[EMAIL PROTECTED]>
    Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>
---
 drivers/usb/core/urb.c |   11 ++++++-----
 include/linux/usb.h    |    4 ----
 2 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/drivers/usb/core/urb.c b/drivers/usb/core/urb.c
index 19f5f66..76db76f 100644
--- a/drivers/usb/core/urb.c
+++ b/drivers/usb/core/urb.c
@@ -39,7 +39,6 @@ void usb_init_urb(struct urb *urb)
        if (urb) {
                memset(urb, 0, sizeof(*urb));
                kref_init(&urb->kref);
-               spin_lock_init(&urb->lock);
                INIT_LIST_HEAD(&urb->anchor_list);
        }
 }
@@ -541,19 +540,21 @@ int usb_unlink_urb(struct urb *urb)
  */
 void usb_kill_urb(struct urb *urb)
 {
+       static DEFINE_MUTEX(reject_mutex);
+
        might_sleep();
        if (!(urb && urb->dev && urb->ep))
                return;
-       spin_lock_irq(&urb->lock);
+       mutex_lock(&reject_mutex);
        ++urb->reject;
-       spin_unlock_irq(&urb->lock);
+       mutex_unlock(&reject_mutex);
 
        usb_hcd_unlink_urb(urb, -ENOENT);
        wait_event(usb_kill_urb_queue, atomic_read(&urb->use_count) == 0);
 
-       spin_lock_irq(&urb->lock);
+       mutex_lock(&reject_mutex);
        --urb->reject;
-       spin_unlock_irq(&urb->lock);
+       mutex_unlock(&reject_mutex);
 }
 
 /**
diff --git a/include/linux/usb.h b/include/linux/usb.h
index 5c7b790..5b14b4c 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -1241,7 +1241,6 @@ struct urb
 {
        /* private: usb core and host controller only fields in the urb */
        struct kref kref;               /* reference count of the URB */
-       spinlock_t lock;                /* lock for the URB */
        void *hcpriv;                   /* private data for host controller */
        atomic_t use_count;             /* concurrent submissions counter */
        u8 reject;                      /* submissions will fail */
@@ -1299,7 +1298,6 @@ static inline void usb_fill_control_urb (struct urb *urb,
                                         usb_complete_t complete_fn,
                                         void *context)
 {
-       spin_lock_init(&urb->lock);
        urb->dev = dev;
        urb->pipe = pipe;
        urb->setup_packet = setup_packet;
@@ -1330,7 +1328,6 @@ static inline void usb_fill_bulk_urb (struct urb *urb,
                                      usb_complete_t complete_fn,
                                      void *context)
 {
-       spin_lock_init(&urb->lock);
        urb->dev = dev;
        urb->pipe = pipe;
        urb->transfer_buffer = transfer_buffer;
@@ -1366,7 +1363,6 @@ static inline void usb_fill_int_urb (struct urb *urb,
                                     void *context,
                                     int interval)
 {
-       spin_lock_init(&urb->lock);
        urb->dev = dev;
        urb->pipe = pipe;
        urb->transfer_buffer = transfer_buffer;
-
To unsubscribe from this list: send the line "unsubscribe git-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