Skip to content

Commit 1234093

Browse files
mikechristiemartinkpetersen
authored andcommitted
scsi: target: usb: gadget: Convert to new submission API
target_submit_cmd() is now only for simple drivers that do their own sync during shutdown and do not use target_stop_session(). It will never return a failure, so we can remove that code from the driver. Note: Before these patches target_submit_cmd() would never return an error for usb since it does not use target_stop_session(). If it did then we would have hit a refcount error here: transport_send_check_condition_and_sense(se_cmd, TCM_UNSUPPORTED_SCSI_OPCODE, 1); transport_generic_free_cmd(&cmd->se_cmd, 0); transport_send_check_condition_and_sense() calls queue_status and the driver can sometimes do transport_generic_free_cmd() from there via uasp_status_data_cmpl(). In that case, the above transport_generic_free_cmd() would then hit a refcount error. So that other use of the above error path in the driver is also probably wrong, but someone with the hardware needs to fix that. Link: https://lore.kernel.org/r/20210227170006.5077-11-michael.christie@oracle.com Cc: Felipe Balbi <balbi@kernel.org> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Mike Christie <michael.christie@oracle.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
1 parent c7e086b commit 1234093

1 file changed

Lines changed: 6 additions & 10 deletions

File tree

‎drivers/usb/gadget/function/f_tcm.c‎

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1058,11 +1058,9 @@ static void usbg_cmd_work(struct work_struct *work)
10581058
goto out;
10591059
}
10601060

1061-
if (target_submit_cmd(se_cmd, tv_nexus->tvn_se_sess, cmd->cmd_buf,
1062-
cmd->sense_iu.sense, cmd->unpacked_lun, 0,
1063-
cmd->prio_attr, dir, flags) < 0)
1064-
goto out;
1065-
1061+
target_submit_cmd(se_cmd, tv_nexus->tvn_se_sess, cmd->cmd_buf,
1062+
cmd->sense_iu.sense, cmd->unpacked_lun, 0,
1063+
cmd->prio_attr, dir, flags);
10661064
return;
10671065

10681066
out:
@@ -1189,11 +1187,9 @@ static void bot_cmd_work(struct work_struct *work)
11891187
goto out;
11901188
}
11911189

1192-
if (target_submit_cmd(se_cmd, tv_nexus->tvn_se_sess,
1193-
cmd->cmd_buf, cmd->sense_iu.sense, cmd->unpacked_lun,
1194-
cmd->data_len, cmd->prio_attr, dir, 0) < 0)
1195-
goto out;
1196-
1190+
target_submit_cmd(se_cmd, tv_nexus->tvn_se_sess,
1191+
cmd->cmd_buf, cmd->sense_iu.sense, cmd->unpacked_lun,
1192+
cmd->data_len, cmd->prio_attr, dir, 0);
11971193
return;
11981194

11991195
out:

0 commit comments

Comments
 (0)