Commit 5f2e5fb8 authored by David Mosberger's avatar David Mosberger Committed by Greg Kroah-Hartman

drivers: usb: core: Minimize irq disabling in usb_sg_cancel()

Restructure usb_sg_cancel() so we don't have to disable interrupts
while cancelling the URBs.
Suggested-by: default avatarAlan Stern <stern@rowland.harvard.edu>
Signed-off-by: default avatarDavid Mosberger <davidm@egauge.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 98b74b0e
...@@ -577,31 +577,28 @@ EXPORT_SYMBOL_GPL(usb_sg_wait); ...@@ -577,31 +577,28 @@ EXPORT_SYMBOL_GPL(usb_sg_wait);
void usb_sg_cancel(struct usb_sg_request *io) void usb_sg_cancel(struct usb_sg_request *io)
{ {
unsigned long flags; unsigned long flags;
int i, retval;
spin_lock_irqsave(&io->lock, flags); spin_lock_irqsave(&io->lock, flags);
if (io->status) {
spin_unlock_irqrestore(&io->lock, flags);
return;
}
/* shut everything down */
io->status = -ECONNRESET;
spin_unlock_irqrestore(&io->lock, flags);
/* shut everything down, if it didn't already */ for (i = io->entries - 1; i >= 0; --i) {
if (!io->status) { usb_block_urb(io->urbs[i]);
int i;
io->status = -ECONNRESET; retval = usb_unlink_urb(io->urbs[i]);
spin_unlock(&io->lock); if (retval != -EINPROGRESS
for (i = 0; i < io->entries; i++) { && retval != -ENODEV
int retval; && retval != -EBUSY
&& retval != -EIDRM)
usb_block_urb(io->urbs[i]); dev_warn(&io->dev->dev, "%s, unlink --> %d\n",
__func__, retval);
retval = usb_unlink_urb(io->urbs[i]);
if (retval != -EINPROGRESS
&& retval != -ENODEV
&& retval != -EBUSY
&& retval != -EIDRM)
dev_warn(&io->dev->dev, "%s, unlink --> %d\n",
__func__, retval);
}
spin_lock(&io->lock);
} }
spin_unlock_irqrestore(&io->lock, flags);
} }
EXPORT_SYMBOL_GPL(usb_sg_cancel); EXPORT_SYMBOL_GPL(usb_sg_cancel);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment