diff options
author | Alan Stern <stern@rowland.harvard.edu> | 2007-08-24 15:42:39 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2007-10-12 17:55:23 -0400 |
commit | 1431d2a44ccf68a547094976f363f94177ab00c6 (patch) | |
tree | ea02b1f45fe22214778d4986bc2d1b7051dcdced /drivers/usb/core | |
parent | 4a00027dcb088bf90fa8fb14a7e8ba3506d78f22 (diff) |
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 <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/core')
-rw-r--r-- | drivers/usb/core/urb.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/usb/core/urb.c b/drivers/usb/core/urb.c index 19f5f66c2733..76db76fdb4ec 100644 --- a/drivers/usb/core/urb.c +++ b/drivers/usb/core/urb.c | |||
@@ -39,7 +39,6 @@ void usb_init_urb(struct urb *urb) | |||
39 | if (urb) { | 39 | if (urb) { |
40 | memset(urb, 0, sizeof(*urb)); | 40 | memset(urb, 0, sizeof(*urb)); |
41 | kref_init(&urb->kref); | 41 | kref_init(&urb->kref); |
42 | spin_lock_init(&urb->lock); | ||
43 | INIT_LIST_HEAD(&urb->anchor_list); | 42 | INIT_LIST_HEAD(&urb->anchor_list); |
44 | } | 43 | } |
45 | } | 44 | } |
@@ -541,19 +540,21 @@ int usb_unlink_urb(struct urb *urb) | |||
541 | */ | 540 | */ |
542 | void usb_kill_urb(struct urb *urb) | 541 | void usb_kill_urb(struct urb *urb) |
543 | { | 542 | { |
543 | static DEFINE_MUTEX(reject_mutex); | ||
544 | |||
544 | might_sleep(); | 545 | might_sleep(); |
545 | if (!(urb && urb->dev && urb->ep)) | 546 | if (!(urb && urb->dev && urb->ep)) |
546 | return; | 547 | return; |
547 | spin_lock_irq(&urb->lock); | 548 | mutex_lock(&reject_mutex); |
548 | ++urb->reject; | 549 | ++urb->reject; |
549 | spin_unlock_irq(&urb->lock); | 550 | mutex_unlock(&reject_mutex); |
550 | 551 | ||
551 | usb_hcd_unlink_urb(urb, -ENOENT); | 552 | usb_hcd_unlink_urb(urb, -ENOENT); |
552 | wait_event(usb_kill_urb_queue, atomic_read(&urb->use_count) == 0); | 553 | wait_event(usb_kill_urb_queue, atomic_read(&urb->use_count) == 0); |
553 | 554 | ||
554 | spin_lock_irq(&urb->lock); | 555 | mutex_lock(&reject_mutex); |
555 | --urb->reject; | 556 | --urb->reject; |
556 | spin_unlock_irq(&urb->lock); | 557 | mutex_unlock(&reject_mutex); |
557 | } | 558 | } |
558 | 559 | ||
559 | /** | 560 | /** |