summaryrefslogtreecommitdiff
path: root/drivers/usb
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2020-03-21 14:25:47 +0300
committerPeter Zijlstra <peterz@infradead.org>2020-03-21 18:00:20 +0300
commitc1d51dd505577b189bf33867a9c20015ca7efb46 (patch)
tree0585f54e6948e240e10abfab649193aa8a9e972f /drivers/usb
parentdeaa0a8a74d86573f190e21ae9a444ea5e3bceee (diff)
downloadlinux-c1d51dd505577b189bf33867a9c20015ca7efb46.tar.xz
usb: gadget: Use completion interface instead of open coding it
ep_io() uses a completion on stack and open codes the waiting with: wait_event_interruptible (done.wait, done.done); and wait_event (done.wait, done.done); This waits in non-exclusive mode for complete(), but there is no reason to do so because the completion can only be waited for by the task itself and complete() wakes exactly one exlusive waiter. Replace the open coded implementation with the corresponding wait_for_completion*() functions. No functional change. Reported-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Link: https://lkml.kernel.org/r/20200321113241.043380271@linutronix.de
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/gadget/legacy/inode.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/usb/gadget/legacy/inode.c b/drivers/usb/gadget/legacy/inode.c
index b47938dff1a2..4c3aff987289 100644
--- a/drivers/usb/gadget/legacy/inode.c
+++ b/drivers/usb/gadget/legacy/inode.c
@@ -344,7 +344,7 @@ ep_io (struct ep_data *epdata, void *buf, unsigned len)
spin_unlock_irq (&epdata->dev->lock);
if (likely (value == 0)) {
- value = wait_event_interruptible (done.wait, done.done);
+ value = wait_for_completion_interruptible(&done);
if (value != 0) {
spin_lock_irq (&epdata->dev->lock);
if (likely (epdata->ep != NULL)) {
@@ -353,7 +353,7 @@ ep_io (struct ep_data *epdata, void *buf, unsigned len)
usb_ep_dequeue (epdata->ep, epdata->req);
spin_unlock_irq (&epdata->dev->lock);
- wait_event (done.wait, done.done);
+ wait_for_completion(&done);
if (epdata->status == -ECONNRESET)
epdata->status = -EINTR;
} else {