aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew R. Ochs <mrochs@linux.vnet.ibm.com>2016-11-28 19:42:50 -0500
committerMartin K. Petersen <martin.petersen@oracle.com>2016-11-30 19:53:02 -0500
commitd4ace35166e55e73afe72a05d166342996063d35 (patch)
tree1736fa64d030bb054f2ad632df85a5edb7e05838
parent9ba848acbf4fbc6d99a0992df9ef5eb1b4842ba9 (diff)
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: Matthew R. Ochs <mrochs@linux.vnet.ibm.com> Acked-by: Uma Krishnan <ukrishn@linux.vnet.ibm.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
-rw-r--r--drivers/scsi/cxlflash/main.c22
1 files changed, 7 insertions, 15 deletions
diff --git a/drivers/scsi/cxlflash/main.c b/drivers/scsi/cxlflash/main.c
index db770301c30a..b7636993a097 100644
--- a/drivers/scsi/cxlflash/main.c
+++ b/drivers/scsi/cxlflash/main.c
@@ -299,12 +299,10 @@ static int wait_resp(struct afu *afu, struct afu_cmd *cmd)
299 */ 299 */
300static int send_tmf(struct afu *afu, struct scsi_cmnd *scp, u64 tmfcmd) 300static int send_tmf(struct afu *afu, struct scsi_cmnd *scp, u64 tmfcmd)
301{ 301{
302 struct afu_cmd *cmd = sc_to_afucz(scp);
303
304 u32 port_sel = scp->device->channel + 1; 302 u32 port_sel = scp->device->channel + 1;
305 short lflag = 0;
306 struct Scsi_Host *host = scp->device->host; 303 struct Scsi_Host *host = scp->device->host;
307 struct cxlflash_cfg *cfg = (struct cxlflash_cfg *)host->hostdata; 304 struct cxlflash_cfg *cfg = (struct cxlflash_cfg *)host->hostdata;
305 struct afu_cmd *cmd = sc_to_afucz(scp);
308 struct device *dev = &cfg->dev->dev; 306 struct device *dev = &cfg->dev->dev;
309 ulong lock_flags; 307 ulong lock_flags;
310 int rc = 0; 308 int rc = 0;
@@ -317,27 +315,21 @@ static int send_tmf(struct afu *afu, struct scsi_cmnd *scp, u64 tmfcmd)
317 !cfg->tmf_active, 315 !cfg->tmf_active,
318 cfg->tmf_slock); 316 cfg->tmf_slock);
319 cfg->tmf_active = true; 317 cfg->tmf_active = true;
320 cmd->cmd_tmf = true;
321 spin_unlock_irqrestore(&cfg->tmf_slock, lock_flags); 318 spin_unlock_irqrestore(&cfg->tmf_slock, lock_flags);
322 319
320 cmd->rcb.scp = scp;
321 cmd->parent = afu;
322 cmd->cmd_tmf = true;
323
323 cmd->rcb.ctx_id = afu->ctx_hndl; 324 cmd->rcb.ctx_id = afu->ctx_hndl;
324 cmd->rcb.msi = SISL_MSI_RRQ_UPDATED; 325 cmd->rcb.msi = SISL_MSI_RRQ_UPDATED;
325 cmd->rcb.port_sel = port_sel; 326 cmd->rcb.port_sel = port_sel;
326 cmd->rcb.lun_id = lun_to_lunid(scp->device->lun); 327 cmd->rcb.lun_id = lun_to_lunid(scp->device->lun);
327
328 lflag = SISL_REQ_FLAGS_TMF_CMD;
329
330 cmd->rcb.req_flags = (SISL_REQ_FLAGS_PORT_LUN_ID | 328 cmd->rcb.req_flags = (SISL_REQ_FLAGS_PORT_LUN_ID |
331 SISL_REQ_FLAGS_SUP_UNDERRUN | lflag); 329 SISL_REQ_FLAGS_SUP_UNDERRUN |
332 330 SISL_REQ_FLAGS_TMF_CMD);
333 /* Stash the scp in the command, for reuse during interrupt */
334 cmd->rcb.scp = scp;
335 cmd->parent = afu;
336
337 /* Copy the CDB from the cmd passed in */
338 memcpy(cmd->rcb.cdb, &tmfcmd, sizeof(tmfcmd)); 331 memcpy(cmd->rcb.cdb, &tmfcmd, sizeof(tmfcmd));
339 332
340 /* Send the command */
341 rc = send_cmd(afu, cmd); 333 rc = send_cmd(afu, cmd);
342 if (unlikely(rc)) { 334 if (unlikely(rc)) {
343 spin_lock_irqsave(&cfg->tmf_slock, lock_flags); 335 spin_lock_irqsave(&cfg->tmf_slock, lock_flags);