diff options
author | Thierry Escande <thierry.escande@collabora.com> | 2016-06-16 21:25:22 +0300 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2016-07-06 11:02:08 +0300 |
commit | a52bd7d2753b0567c71d604c640e9c4a86221756 (patch) | |
tree | 9ba8d5e4406047ec9add0852053368f9a6bfb9c6 /drivers/nfc/port100.c | |
parent | b74584c1a6d68110d135a6ce0336aab0055f4341 (diff) | |
download | linux-a52bd7d2753b0567c71d604c640e9c4a86221756.tar.xz |
NFC: port100: Make port100_abort_cmd() synchronous
This patch makes the abort_cmd function synchronous. This allows the
caller to immediately send a new command after abort_cmd() returns.
Signed-off-by: Thierry Escande <thierry.escande@collabora.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'drivers/nfc/port100.c')
-rw-r--r-- | drivers/nfc/port100.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/drivers/nfc/port100.c b/drivers/nfc/port100.c index 909e3df2c16a..481cb435e19f 100644 --- a/drivers/nfc/port100.c +++ b/drivers/nfc/port100.c @@ -472,6 +472,7 @@ struct port100 { struct port100_cmd *cmd; bool cmd_cancel; + struct completion cmd_cancel_done; }; struct port100_cmd { @@ -728,6 +729,8 @@ static int port100_send_ack(struct port100 *dev) mutex_lock(&dev->out_urb_lock); + init_completion(&dev->cmd_cancel_done); + usb_kill_urb(dev->out_urb); dev->out_urb->transfer_buffer = ack_frame; @@ -742,6 +745,9 @@ static int port100_send_ack(struct port100 *dev) mutex_unlock(&dev->out_urb_lock); + if (!rc) + wait_for_completion(&dev->cmd_cancel_done); + return rc; } @@ -921,7 +927,10 @@ static void port100_send_complete(struct urb *urb) { struct port100 *dev = urb->context; - dev->cmd_cancel = false; + if (dev->cmd_cancel) { + dev->cmd_cancel = false; + complete(&dev->cmd_cancel_done); + } switch (urb->status) { case 0: |