Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 67883
b: refs/heads/master
c: 1431d2a
h: refs/heads/master
i:
  67881: bb49e62
  67879: f0f97aa
v: v3
  • Loading branch information
Alan Stern authored and Greg Kroah-Hartman committed Oct 12, 2007
1 parent aa48097 commit 43117c1
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 10 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 4a00027dcb088bf90fa8fb14a7e8ba3506d78f22
refs/heads/master: 1431d2a44ccf68a547094976f363f94177ab00c6
11 changes: 6 additions & 5 deletions trunk/drivers/usb/core/urb.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand Down Expand Up @@ -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);
}

/**
Expand Down
4 changes: 0 additions & 4 deletions trunk/include/linux/usb.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 43117c1

Please sign in to comment.