diff options
| author | Thierry Escande <thierry.escande@collabora.com> | 2016-06-16 14:25:22 -0400 |
|---|---|---|
| committer | Samuel Ortiz <sameo@linux.intel.com> | 2016-07-06 04:02:08 -0400 |
| commit | a52bd7d2753b0567c71d604c640e9c4a86221756 (patch) | |
| tree | 9ba8d5e4406047ec9add0852053368f9a6bfb9c6 /drivers/nfc | |
| parent | b74584c1a6d68110d135a6ce0336aab0055f4341 (diff) | |
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')
| -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 { | |||
| 472 | struct port100_cmd *cmd; | 472 | struct port100_cmd *cmd; |
| 473 | 473 | ||
| 474 | bool cmd_cancel; | 474 | bool cmd_cancel; |
| 475 | struct completion cmd_cancel_done; | ||
| 475 | }; | 476 | }; |
| 476 | 477 | ||
| 477 | struct port100_cmd { | 478 | struct port100_cmd { |
| @@ -728,6 +729,8 @@ static int port100_send_ack(struct port100 *dev) | |||
| 728 | 729 | ||
| 729 | mutex_lock(&dev->out_urb_lock); | 730 | mutex_lock(&dev->out_urb_lock); |
| 730 | 731 | ||
| 732 | init_completion(&dev->cmd_cancel_done); | ||
| 733 | |||
| 731 | usb_kill_urb(dev->out_urb); | 734 | usb_kill_urb(dev->out_urb); |
| 732 | 735 | ||
| 733 | dev->out_urb->transfer_buffer = ack_frame; | 736 | dev->out_urb->transfer_buffer = ack_frame; |
| @@ -742,6 +745,9 @@ static int port100_send_ack(struct port100 *dev) | |||
| 742 | 745 | ||
| 743 | mutex_unlock(&dev->out_urb_lock); | 746 | mutex_unlock(&dev->out_urb_lock); |
| 744 | 747 | ||
| 748 | if (!rc) | ||
| 749 | wait_for_completion(&dev->cmd_cancel_done); | ||
| 750 | |||
| 745 | return rc; | 751 | return rc; |
| 746 | } | 752 | } |
| 747 | 753 | ||
| @@ -921,7 +927,10 @@ static void port100_send_complete(struct urb *urb) | |||
| 921 | { | 927 | { |
| 922 | struct port100 *dev = urb->context; | 928 | struct port100 *dev = urb->context; |
| 923 | 929 | ||
| 924 | dev->cmd_cancel = false; | 930 | if (dev->cmd_cancel) { |
| 931 | dev->cmd_cancel = false; | ||
| 932 | complete(&dev->cmd_cancel_done); | ||
| 933 | } | ||
| 925 | 934 | ||
| 926 | switch (urb->status) { | 935 | switch (urb->status) { |
| 927 | case 0: | 936 | case 0: |
