Commit d4ace351 authored by Matthew R. Ochs's avatar Matthew R. Ochs Committed by Martin K. Petersen

scsi: cxlflash: Cleanup send_tmf()

The send_tmf() routine includes some copy/paste cruft that can be
removed as well as the setting of an AFU command-specific while
holding the tmf_slock. While not a bug, it is out of place and
should be shifted down alongside the other command initialization
statements for clarity.
Signed-off-by: default avatarMatthew R. Ochs <mrochs@linux.vnet.ibm.com>
Acked-by: default avatarUma Krishnan <ukrishn@linux.vnet.ibm.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 9ba848ac
...@@ -299,12 +299,10 @@ static int wait_resp(struct afu *afu, struct afu_cmd *cmd) ...@@ -299,12 +299,10 @@ static int wait_resp(struct afu *afu, struct afu_cmd *cmd)
*/ */
static int send_tmf(struct afu *afu, struct scsi_cmnd *scp, u64 tmfcmd) static int send_tmf(struct afu *afu, struct scsi_cmnd *scp, u64 tmfcmd)
{ {
struct afu_cmd *cmd = sc_to_afucz(scp);
u32 port_sel = scp->device->channel + 1; u32 port_sel = scp->device->channel + 1;
short lflag = 0;
struct Scsi_Host *host = scp->device->host; struct Scsi_Host *host = scp->device->host;
struct cxlflash_cfg *cfg = (struct cxlflash_cfg *)host->hostdata; struct cxlflash_cfg *cfg = (struct cxlflash_cfg *)host->hostdata;
struct afu_cmd *cmd = sc_to_afucz(scp);
struct device *dev = &cfg->dev->dev; struct device *dev = &cfg->dev->dev;
ulong lock_flags; ulong lock_flags;
int rc = 0; int rc = 0;
...@@ -317,27 +315,21 @@ static int send_tmf(struct afu *afu, struct scsi_cmnd *scp, u64 tmfcmd) ...@@ -317,27 +315,21 @@ static int send_tmf(struct afu *afu, struct scsi_cmnd *scp, u64 tmfcmd)
!cfg->tmf_active, !cfg->tmf_active,
cfg->tmf_slock); cfg->tmf_slock);
cfg->tmf_active = true; cfg->tmf_active = true;
cmd->cmd_tmf = true;
spin_unlock_irqrestore(&cfg->tmf_slock, lock_flags); spin_unlock_irqrestore(&cfg->tmf_slock, lock_flags);
cmd->rcb.scp = scp;
cmd->parent = afu;
cmd->cmd_tmf = true;
cmd->rcb.ctx_id = afu->ctx_hndl; cmd->rcb.ctx_id = afu->ctx_hndl;
cmd->rcb.msi = SISL_MSI_RRQ_UPDATED; cmd->rcb.msi = SISL_MSI_RRQ_UPDATED;
cmd->rcb.port_sel = port_sel; cmd->rcb.port_sel = port_sel;
cmd->rcb.lun_id = lun_to_lunid(scp->device->lun); cmd->rcb.lun_id = lun_to_lunid(scp->device->lun);
lflag = SISL_REQ_FLAGS_TMF_CMD;
cmd->rcb.req_flags = (SISL_REQ_FLAGS_PORT_LUN_ID | cmd->rcb.req_flags = (SISL_REQ_FLAGS_PORT_LUN_ID |
SISL_REQ_FLAGS_SUP_UNDERRUN | lflag); SISL_REQ_FLAGS_SUP_UNDERRUN |
SISL_REQ_FLAGS_TMF_CMD);
/* Stash the scp in the command, for reuse during interrupt */
cmd->rcb.scp = scp;
cmd->parent = afu;
/* Copy the CDB from the cmd passed in */
memcpy(cmd->rcb.cdb, &tmfcmd, sizeof(tmfcmd)); memcpy(cmd->rcb.cdb, &tmfcmd, sizeof(tmfcmd));
/* Send the command */
rc = send_cmd(afu, cmd); rc = send_cmd(afu, cmd);
if (unlikely(rc)) { if (unlikely(rc)) {
spin_lock_irqsave(&cfg->tmf_slock, lock_flags); spin_lock_irqsave(&cfg->tmf_slock, lock_flags);
......
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