Commit a52bd7d2 authored by Thierry Escande's avatar Thierry Escande Committed by Samuel Ortiz

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: default avatarThierry Escande <thierry.escande@collabora.com>
Signed-off-by: default avatarSamuel Ortiz <sameo@linux.intel.com>
parent b74584c1
...@@ -472,6 +472,7 @@ struct port100 { ...@@ -472,6 +472,7 @@ struct port100 {
struct port100_cmd *cmd; struct port100_cmd *cmd;
bool cmd_cancel; bool cmd_cancel;
struct completion cmd_cancel_done;
}; };
struct port100_cmd { struct port100_cmd {
...@@ -728,6 +729,8 @@ static int port100_send_ack(struct port100 *dev) ...@@ -728,6 +729,8 @@ static int port100_send_ack(struct port100 *dev)
mutex_lock(&dev->out_urb_lock); mutex_lock(&dev->out_urb_lock);
init_completion(&dev->cmd_cancel_done);
usb_kill_urb(dev->out_urb); usb_kill_urb(dev->out_urb);
dev->out_urb->transfer_buffer = ack_frame; dev->out_urb->transfer_buffer = ack_frame;
...@@ -742,6 +745,9 @@ static int port100_send_ack(struct port100 *dev) ...@@ -742,6 +745,9 @@ static int port100_send_ack(struct port100 *dev)
mutex_unlock(&dev->out_urb_lock); mutex_unlock(&dev->out_urb_lock);
if (!rc)
wait_for_completion(&dev->cmd_cancel_done);
return rc; return rc;
} }
...@@ -921,7 +927,10 @@ static void port100_send_complete(struct urb *urb) ...@@ -921,7 +927,10 @@ static void port100_send_complete(struct urb *urb)
{ {
struct port100 *dev = urb->context; 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) { switch (urb->status) {
case 0: case 0:
......
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