[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <099a4bd5ed02f4c48f4640347379b5127075e453.1658192351.git.Thinh.Nguyen@synopsys.com>
Date: Mon, 18 Jul 2022 18:27:51 -0700
From: Thinh Nguyen <Thinh.Nguyen@...opsys.com>
To: Felipe Balbi <balbi@...nel.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Thinh Nguyen <Thinh.Nguyen@...opsys.com>,
linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org,
Dmitry Bogdanov <d.bogdanov@...ro.com>
Cc: linux-scsi@...r.kernel.org, target-devel@...r.kernel.org
Subject: [PATCH v2 17/25] usb: gadget: f_tcm: Handle abort command
Implemented aborted_task to cancel outstanding request.
Signed-off-by: Thinh Nguyen <Thinh.Nguyen@...opsys.com>
---
Changes in v2:
- None
drivers/usb/gadget/function/f_tcm.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/drivers/usb/gadget/function/f_tcm.c b/drivers/usb/gadget/function/f_tcm.c
index d7318c84af98..8f7eb7045e64 100644
--- a/drivers/usb/gadget/function/f_tcm.c
+++ b/drivers/usb/gadget/function/f_tcm.c
@@ -1278,6 +1278,22 @@ static void usbg_queue_tm_rsp(struct se_cmd *se_cmd)
static void usbg_aborted_task(struct se_cmd *se_cmd)
{
+ struct usbg_cmd *cmd = container_of(se_cmd, struct usbg_cmd, se_cmd);
+ struct f_uas *fu = cmd->fu;
+ struct uas_stream *stream = cmd->stream;
+ int ret = 0;
+
+ if (stream->req_out->status == -EINPROGRESS)
+ ret = usb_ep_dequeue(fu->ep_out, stream->req_out);
+ else if (stream->req_in->status == -EINPROGRESS)
+ ret = usb_ep_dequeue(fu->ep_in, stream->req_in);
+ else if (stream->req_status->status == -EINPROGRESS)
+ ret = usb_ep_dequeue(fu->ep_status, stream->req_status);
+
+ if (ret)
+ pr_err("Unable to dequeue se_cmd out %p\n", se_cmd);
+
+ cmd->state = UASP_QUEUE_COMMAND;
}
static const char *usbg_check_wwn(const char *name)
--
2.28.0
Powered by blists - more mailing lists