Skip to content

Commit

Permalink
usb: gadget: f_tcm: Handle abort command
Browse files Browse the repository at this point in the history
Implement usbg_aborted_task() to cancel aborted outstanding requests.

Signed-off-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Link: https://lore.kernel.org/r/6d2a05f120a0384e36b5150b50eec53a0991f400.1733876548.git.Thinh.Nguyen@synopsys.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Thinh Nguyen authored and Greg Kroah-Hartman committed Dec 24, 2024
1 parent 360715d commit 76003eb
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions drivers/usb/gadget/function/f_tcm.c
Original file line number Diff line number Diff line change
Expand Up @@ -1257,6 +1257,24 @@ 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 usb_gadget *gadget = fuas_to_gadget(fu);
struct uas_stream *stream = &fu->stream[se_cmd->map_tag];
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)
dev_err(&gadget->dev, "Failed to abort cmd tag %d, (%d)\n",
cmd->tag, ret);

cmd->state = UASP_QUEUE_COMMAND;
}

static const char *usbg_check_wwn(const char *name)
Expand Down

0 comments on commit 76003eb

Please sign in to comment.