summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Wagner2016-09-16 13:18:22 +0200
committerMauro Carvalho Chehab2016-10-24 21:40:09 +0200
commit9b26336356603d457a53255adc7a4fdad31c5ede (patch)
treebd4ab93b4992999038b241c48520ad66e87ac459
parent[media] imon: use complete() instead of complete_all() (diff)
downloadkernel-qcow2-linux-9b26336356603d457a53255adc7a4fdad31c5ede.tar.gz
kernel-qcow2-linux-9b26336356603d457a53255adc7a4fdad31c5ede.tar.xz
kernel-qcow2-linux-9b26336356603d457a53255adc7a4fdad31c5ede.zip
[media] lirc_imon: use complete() instead complete_all()
There is only one waiter for the completion, therefore there is no need to use complete_all(). Let's make that clear by using complete() instead of complete_all(). While we are at it, we do a small optimization with the reinitialization of the completion before we use it. The usage pattern of the completion is: waiter context waker context send_packet() reinit_completion() usb_sumbit_urb() wait_for_completion_interruptible() usb_tx_callback() complete() imon_disconnect() complete() Signed-off-by: Daniel Wagner <daniel.wagner@bmw-carit.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
-rw-r--r--drivers/staging/media/lirc/lirc_imon.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/staging/media/lirc/lirc_imon.c b/drivers/staging/media/lirc/lirc_imon.c
index 198a8057f2f1..00e00b0be275 100644
--- a/drivers/staging/media/lirc/lirc_imon.c
+++ b/drivers/staging/media/lirc/lirc_imon.c
@@ -334,7 +334,7 @@ static int send_packet(struct imon_context *context)
context->tx_urb->actual_length = 0;
- init_completion(&context->tx.finished);
+ reinit_completion(&context->tx.finished);
atomic_set(&context->tx.busy, 1);
retval = usb_submit_urb(context->tx_urb, GFP_KERNEL);
@@ -497,6 +497,8 @@ static int ir_open(void *data)
context->rx.initial_space = 1;
context->rx.prev_bit = 0;
+ init_completion(&context->tx.finished);
+
context->ir_isopen = 1;
dev_info(context->driver->dev, "IR port opened\n");
@@ -930,7 +932,7 @@ static void imon_disconnect(struct usb_interface *interface)
/* Abort ongoing write */
if (atomic_read(&context->tx.busy)) {
usb_kill_urb(context->tx_urb);
- complete_all(&context->tx.finished);
+ complete(&context->tx.finished);
}
context->dev_present = 0;