scsi: lpfc: remove ScsiResult macro
authorJohannes Thumshirn <jthumshirn@suse.de>
Thu, 5 Jul 2018 11:01:39 +0000 (13:01 +0200)
committerMartin K. Petersen <martin.petersen@oracle.com>
Wed, 11 Jul 2018 02:42:47 +0000 (22:42 -0400)
Remove the ScsiResult macro and open code it on all call sites.

This will make subsequent refactoring in this area easier.

Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
Cc: James Smart <james.smart@broadcom.com>
Cc: Dick Kennedy <dick.kennedy@broadcom.com>
Reviewed-by: Bart Van Assche <bart.vanassche@wdc.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/lpfc/lpfc_crtn.h
drivers/scsi/lpfc/lpfc_scsi.c

index d02b4b8601109f9315eb558735c22fb4e5256b05..bea24bc4410a7e6a7549ff1826b581562969acb6 100644 (file)
@@ -469,7 +469,6 @@ int lpfc_parse_vpd(struct lpfc_hba *, uint8_t *, int);
 void lpfc_start_fdiscs(struct lpfc_hba *phba);
 struct lpfc_vport *lpfc_find_vport_by_vpid(struct lpfc_hba *, uint16_t);
 struct lpfc_sglq *__lpfc_get_active_sglq(struct lpfc_hba *, uint16_t);
-#define ScsiResult(host_code, scsi_code) (((host_code) << 16) | scsi_code)
 #define HBA_EVENT_RSCN                   5
 #define HBA_EVENT_LINK_UP                2
 #define HBA_EVENT_LINK_DOWN              3
index 5e4cad6a531aa0a5756c90b600429278f650553e..25ef2b6ccc34cfdf73ef36958c2bacb954e3f242 100644 (file)
@@ -3017,8 +3017,8 @@ out:
        if (err_type == BGS_GUARD_ERR_MASK) {
                scsi_build_sense_buffer(1, cmd->sense_buffer, ILLEGAL_REQUEST,
                                        0x10, 0x1);
-               cmd->result = DRIVER_SENSE << 24
-                       | ScsiResult(DID_ABORT, SAM_STAT_CHECK_CONDITION);
+               cmd->result = DRIVER_SENSE << 24 | DID_ABORT << 16 |
+                             SAM_STAT_CHECK_CONDITION;
                phba->bg_guard_err_cnt++;
                lpfc_printf_log(phba, KERN_WARNING, LOG_FCP | LOG_BG,
                                "9069 BLKGRD: LBA %lx grd_tag error %x != %x\n",
@@ -3028,8 +3028,8 @@ out:
        } else if (err_type == BGS_REFTAG_ERR_MASK) {
                scsi_build_sense_buffer(1, cmd->sense_buffer, ILLEGAL_REQUEST,
                                        0x10, 0x3);
-               cmd->result = DRIVER_SENSE << 24
-                       | ScsiResult(DID_ABORT, SAM_STAT_CHECK_CONDITION);
+               cmd->result = DRIVER_SENSE << 24 | DID_ABORT << 16 |
+                             SAM_STAT_CHECK_CONDITION;
 
                phba->bg_reftag_err_cnt++;
                lpfc_printf_log(phba, KERN_WARNING, LOG_FCP | LOG_BG,
@@ -3040,8 +3040,8 @@ out:
        } else if (err_type == BGS_APPTAG_ERR_MASK) {
                scsi_build_sense_buffer(1, cmd->sense_buffer, ILLEGAL_REQUEST,
                                        0x10, 0x2);
-               cmd->result = DRIVER_SENSE << 24
-                       | ScsiResult(DID_ABORT, SAM_STAT_CHECK_CONDITION);
+               cmd->result = DRIVER_SENSE << 24 | DID_ABORT << 16 |
+                             SAM_STAT_CHECK_CONDITION;
 
                phba->bg_apptag_err_cnt++;
                lpfc_printf_log(phba, KERN_WARNING, LOG_FCP | LOG_BG,
@@ -3096,7 +3096,7 @@ lpfc_parse_bg_err(struct lpfc_hba *phba, struct lpfc_scsi_buf *lpfc_cmd,
        spin_unlock(&_dump_buf_lock);
 
        if (lpfc_bgs_get_invalid_prof(bgstat)) {
-               cmd->result = ScsiResult(DID_ERROR, 0);
+               cmd->result = DID_ERROR << 16;
                lpfc_printf_log(phba, KERN_WARNING, LOG_FCP | LOG_BG,
                                "9072 BLKGRD: Invalid BG Profile in cmd"
                                " 0x%x lba 0x%llx blk cnt 0x%x "
@@ -3108,7 +3108,7 @@ lpfc_parse_bg_err(struct lpfc_hba *phba, struct lpfc_scsi_buf *lpfc_cmd,
        }
 
        if (lpfc_bgs_get_uninit_dif_block(bgstat)) {
-               cmd->result = ScsiResult(DID_ERROR, 0);
+               cmd->result = DID_ERROR << 16;
                lpfc_printf_log(phba, KERN_WARNING, LOG_FCP | LOG_BG,
                                "9073 BLKGRD: Invalid BG PDIF Block in cmd"
                                " 0x%x lba 0x%llx blk cnt 0x%x "
@@ -3124,8 +3124,8 @@ lpfc_parse_bg_err(struct lpfc_hba *phba, struct lpfc_scsi_buf *lpfc_cmd,
 
                scsi_build_sense_buffer(1, cmd->sense_buffer, ILLEGAL_REQUEST,
                                0x10, 0x1);
-               cmd->result = DRIVER_SENSE << 24
-                       | ScsiResult(DID_ABORT, SAM_STAT_CHECK_CONDITION);
+               cmd->result = DRIVER_SENSE << 24 | DID_ABORT << 16 |
+                             SAM_STAT_CHECK_CONDITION;
                phba->bg_guard_err_cnt++;
                lpfc_printf_log(phba, KERN_WARNING, LOG_FCP | LOG_BG,
                                "9055 BLKGRD: Guard Tag error in cmd"
@@ -3140,8 +3140,8 @@ lpfc_parse_bg_err(struct lpfc_hba *phba, struct lpfc_scsi_buf *lpfc_cmd,
 
                scsi_build_sense_buffer(1, cmd->sense_buffer, ILLEGAL_REQUEST,
                                0x10, 0x3);
-               cmd->result = DRIVER_SENSE << 24
-                       | ScsiResult(DID_ABORT, SAM_STAT_CHECK_CONDITION);
+               cmd->result = DRIVER_SENSE << 24 | DID_ABORT << 16 |
+                             SAM_STAT_CHECK_CONDITION;
 
                phba->bg_reftag_err_cnt++;
                lpfc_printf_log(phba, KERN_WARNING, LOG_FCP | LOG_BG,
@@ -3157,8 +3157,8 @@ lpfc_parse_bg_err(struct lpfc_hba *phba, struct lpfc_scsi_buf *lpfc_cmd,
 
                scsi_build_sense_buffer(1, cmd->sense_buffer, ILLEGAL_REQUEST,
                                0x10, 0x2);
-               cmd->result = DRIVER_SENSE << 24
-                       | ScsiResult(DID_ABORT, SAM_STAT_CHECK_CONDITION);
+               cmd->result = DRIVER_SENSE << 24 | DID_ABORT << 16 |
+                             SAM_STAT_CHECK_CONDITION;
 
                phba->bg_apptag_err_cnt++;
                lpfc_printf_log(phba, KERN_WARNING, LOG_FCP | LOG_BG,
@@ -3874,7 +3874,7 @@ lpfc_handle_fcp_err(struct lpfc_vport *vport, struct lpfc_scsi_buf *lpfc_cmd,
        }
 
  out:
-       cmnd->result = ScsiResult(host_status, scsi_status);
+       cmnd->result = host_status << 16 | scsi_status;
        lpfc_send_scsi_error_event(vport->phba, vport, lpfc_cmd, rsp_iocb);
 }
 
@@ -4027,7 +4027,7 @@ lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pIocbIn,
                        break;
                case IOSTAT_NPORT_BSY:
                case IOSTAT_FABRIC_BSY:
-                       cmd->result = ScsiResult(DID_TRANSPORT_DISRUPTED, 0);
+                       cmd->result = DID_TRANSPORT_DISRUPTED << 16;
                        fast_path_evt = lpfc_alloc_fast_evt(phba);
                        if (!fast_path_evt)
                                break;
@@ -4061,14 +4061,14 @@ lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pIocbIn,
                            lpfc_cmd->result == IOERR_ELXSEC_CRYPTO_ERROR ||
                            lpfc_cmd->result ==
                                        IOERR_ELXSEC_CRYPTO_COMPARE_ERROR) {
-                               cmd->result = ScsiResult(DID_NO_CONNECT, 0);
+                               cmd->result = DID_NO_CONNECT << 16;
                                break;
                        }
                        if (lpfc_cmd->result == IOERR_INVALID_RPI ||
                            lpfc_cmd->result == IOERR_NO_RESOURCES ||
                            lpfc_cmd->result == IOERR_ABORT_REQUESTED ||
                            lpfc_cmd->result == IOERR_SLER_CMD_RCV_FAILURE) {
-                               cmd->result = ScsiResult(DID_REQUEUE, 0);
+                               cmd->result = DID_REQUEUE << 16;
                                break;
                        }
                        if ((lpfc_cmd->result == IOERR_RX_DMA_FAILED ||
@@ -4102,16 +4102,16 @@ lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pIocbIn,
                        }
                /* else: fall through */
                default:
-                       cmd->result = ScsiResult(DID_ERROR, 0);
+                       cmd->result = DID_ERROR << 16;
                        break;
                }
 
                if (!pnode || !NLP_CHK_NODE_ACT(pnode)
                    || (pnode->nlp_state != NLP_STE_MAPPED_NODE))
-                       cmd->result = ScsiResult(DID_TRANSPORT_DISRUPTED,
-                                                SAM_STAT_BUSY);
+                       cmd->result = DID_TRANSPORT_DISRUPTED << 16 |
+                                     SAM_STAT_BUSY;
        } else
-               cmd->result = ScsiResult(DID_OK, 0);
+               cmd->result = DID_OK << 16;
 
        if (cmd->result || lpfc_cmd->fcp_rsp->rspSnsLen) {
                uint32_t *lp = (uint32_t *)cmd->sense_buffer;