mirror of
https://github.com/torvalds/linux.git
synced 2026-03-08 04:04:43 +01:00
usb: gadget: f_tcm: Get stream by sbitmap number
We prepare same number of sbitmap as the number of streams. Use the returned sbitmap number as index to the selected stream for a usbg_cmd. Signed-off-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com> Link: https://lore.kernel.org/r/169f67261162c16342bc8543db93c259b05ead0b.1733876548.git.Thinh.Nguyen@synopsys.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
8840047985
commit
1f0d96f5d1
2 changed files with 6 additions and 21 deletions
|
|
@ -491,7 +491,7 @@ static int uasp_prepare_r_request(struct usbg_cmd *cmd)
|
|||
struct se_cmd *se_cmd = &cmd->se_cmd;
|
||||
struct f_uas *fu = cmd->fu;
|
||||
struct usb_gadget *gadget = fuas_to_gadget(fu);
|
||||
struct uas_stream *stream = cmd->stream;
|
||||
struct uas_stream *stream = &fu->stream[se_cmd->map_tag];
|
||||
|
||||
if (!gadget->sg_supported) {
|
||||
cmd->data_buf = kmalloc(se_cmd->data_length, GFP_ATOMIC);
|
||||
|
|
@ -523,7 +523,7 @@ static void uasp_prepare_status(struct usbg_cmd *cmd)
|
|||
{
|
||||
struct se_cmd *se_cmd = &cmd->se_cmd;
|
||||
struct sense_iu *iu = &cmd->sense_iu;
|
||||
struct uas_stream *stream = cmd->stream;
|
||||
struct uas_stream *stream = &cmd->fu->stream[se_cmd->map_tag];
|
||||
|
||||
cmd->state = UASP_QUEUE_COMMAND;
|
||||
iu->iu_id = IU_ID_STATUS;
|
||||
|
|
@ -544,8 +544,8 @@ static void uasp_prepare_status(struct usbg_cmd *cmd)
|
|||
static void uasp_status_data_cmpl(struct usb_ep *ep, struct usb_request *req)
|
||||
{
|
||||
struct usbg_cmd *cmd = req->context;
|
||||
struct uas_stream *stream = cmd->stream;
|
||||
struct f_uas *fu = cmd->fu;
|
||||
struct uas_stream *stream = &fu->stream[cmd->se_cmd.map_tag];
|
||||
int ret;
|
||||
|
||||
if (req->status < 0)
|
||||
|
|
@ -595,7 +595,7 @@ cleanup:
|
|||
static int uasp_send_status_response(struct usbg_cmd *cmd)
|
||||
{
|
||||
struct f_uas *fu = cmd->fu;
|
||||
struct uas_stream *stream = cmd->stream;
|
||||
struct uas_stream *stream = &fu->stream[cmd->se_cmd.map_tag];
|
||||
struct sense_iu *iu = &cmd->sense_iu;
|
||||
|
||||
iu->tag = cpu_to_be16(cmd->tag);
|
||||
|
|
@ -609,7 +609,7 @@ static int uasp_send_status_response(struct usbg_cmd *cmd)
|
|||
static int uasp_send_read_response(struct usbg_cmd *cmd)
|
||||
{
|
||||
struct f_uas *fu = cmd->fu;
|
||||
struct uas_stream *stream = cmd->stream;
|
||||
struct uas_stream *stream = &fu->stream[cmd->se_cmd.map_tag];
|
||||
struct sense_iu *iu = &cmd->sense_iu;
|
||||
int ret;
|
||||
|
||||
|
|
@ -653,7 +653,7 @@ static int uasp_send_write_request(struct usbg_cmd *cmd)
|
|||
{
|
||||
struct f_uas *fu = cmd->fu;
|
||||
struct se_cmd *se_cmd = &cmd->se_cmd;
|
||||
struct uas_stream *stream = cmd->stream;
|
||||
struct uas_stream *stream = &fu->stream[se_cmd->map_tag];
|
||||
struct sense_iu *iu = &cmd->sense_iu;
|
||||
int ret;
|
||||
|
||||
|
|
@ -1104,17 +1104,6 @@ static int usbg_submit_command(struct f_uas *fu,
|
|||
}
|
||||
memcpy(cmd->cmd_buf, cmd_iu->cdb, cmd_len);
|
||||
|
||||
if (fu->flags & USBG_USE_STREAMS) {
|
||||
if (cmd->tag > UASP_SS_EP_COMP_NUM_STREAMS)
|
||||
goto err;
|
||||
if (!cmd->tag)
|
||||
cmd->stream = &fu->stream[0];
|
||||
else
|
||||
cmd->stream = &fu->stream[cmd->tag - 1];
|
||||
} else {
|
||||
cmd->stream = &fu->stream[0];
|
||||
}
|
||||
|
||||
switch (cmd_iu->prio_attr & 0x7) {
|
||||
case UAS_HEAD_TAG:
|
||||
cmd->prio_attr = TCM_HEAD_TAG;
|
||||
|
|
@ -1140,9 +1129,6 @@ static int usbg_submit_command(struct f_uas *fu,
|
|||
queue_work(tpg->workqueue, &cmd->work);
|
||||
|
||||
return 0;
|
||||
err:
|
||||
usbg_release_cmd(&cmd->se_cmd);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
static void bot_cmd_work(struct work_struct *work)
|
||||
|
|
|
|||
|
|
@ -80,7 +80,6 @@ struct usbg_cmd {
|
|||
u16 prio_attr;
|
||||
struct sense_iu sense_iu;
|
||||
enum uas_state state;
|
||||
struct uas_stream *stream;
|
||||
|
||||
/* BOT only */
|
||||
__le32 bot_tag;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue