Skip to content

Commit c6668ca

Browse files
Johannes Thumshirnmartinkpetersen
authored andcommitted
scsi: lpfc: remove ScsiResult macro
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>
1 parent 55c9d37 commit c6668ca

File tree

2 files changed

+22
-23
lines changed

2 files changed

+22
-23
lines changed

drivers/scsi/lpfc/lpfc_crtn.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,6 @@ int lpfc_parse_vpd(struct lpfc_hba *, uint8_t *, int);
469469
void lpfc_start_fdiscs(struct lpfc_hba *phba);
470470
struct lpfc_vport *lpfc_find_vport_by_vpid(struct lpfc_hba *, uint16_t);
471471
struct lpfc_sglq *__lpfc_get_active_sglq(struct lpfc_hba *, uint16_t);
472-
#define ScsiResult(host_code, scsi_code) (((host_code) << 16) | scsi_code)
473472
#define HBA_EVENT_RSCN 5
474473
#define HBA_EVENT_LINK_UP 2
475474
#define HBA_EVENT_LINK_DOWN 3

drivers/scsi/lpfc/lpfc_scsi.c

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3017,8 +3017,8 @@ lpfc_calc_bg_err(struct lpfc_hba *phba, struct lpfc_scsi_buf *lpfc_cmd)
30173017
if (err_type == BGS_GUARD_ERR_MASK) {
30183018
scsi_build_sense_buffer(1, cmd->sense_buffer, ILLEGAL_REQUEST,
30193019
0x10, 0x1);
3020-
cmd->result = DRIVER_SENSE << 24
3021-
| ScsiResult(DID_ABORT, SAM_STAT_CHECK_CONDITION);
3020+
cmd->result = DRIVER_SENSE << 24 | DID_ABORT << 16 |
3021+
SAM_STAT_CHECK_CONDITION;
30223022
phba->bg_guard_err_cnt++;
30233023
lpfc_printf_log(phba, KERN_WARNING, LOG_FCP | LOG_BG,
30243024
"9069 BLKGRD: LBA %lx grd_tag error %x != %x\n",
@@ -3028,8 +3028,8 @@ lpfc_calc_bg_err(struct lpfc_hba *phba, struct lpfc_scsi_buf *lpfc_cmd)
30283028
} else if (err_type == BGS_REFTAG_ERR_MASK) {
30293029
scsi_build_sense_buffer(1, cmd->sense_buffer, ILLEGAL_REQUEST,
30303030
0x10, 0x3);
3031-
cmd->result = DRIVER_SENSE << 24
3032-
| ScsiResult(DID_ABORT, SAM_STAT_CHECK_CONDITION);
3031+
cmd->result = DRIVER_SENSE << 24 | DID_ABORT << 16 |
3032+
SAM_STAT_CHECK_CONDITION;
30333033

30343034
phba->bg_reftag_err_cnt++;
30353035
lpfc_printf_log(phba, KERN_WARNING, LOG_FCP | LOG_BG,
@@ -3040,8 +3040,8 @@ lpfc_calc_bg_err(struct lpfc_hba *phba, struct lpfc_scsi_buf *lpfc_cmd)
30403040
} else if (err_type == BGS_APPTAG_ERR_MASK) {
30413041
scsi_build_sense_buffer(1, cmd->sense_buffer, ILLEGAL_REQUEST,
30423042
0x10, 0x2);
3043-
cmd->result = DRIVER_SENSE << 24
3044-
| ScsiResult(DID_ABORT, SAM_STAT_CHECK_CONDITION);
3043+
cmd->result = DRIVER_SENSE << 24 | DID_ABORT << 16 |
3044+
SAM_STAT_CHECK_CONDITION;
30453045

30463046
phba->bg_apptag_err_cnt++;
30473047
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,
30963096
spin_unlock(&_dump_buf_lock);
30973097

30983098
if (lpfc_bgs_get_invalid_prof(bgstat)) {
3099-
cmd->result = ScsiResult(DID_ERROR, 0);
3099+
cmd->result = DID_ERROR << 16;
31003100
lpfc_printf_log(phba, KERN_WARNING, LOG_FCP | LOG_BG,
31013101
"9072 BLKGRD: Invalid BG Profile in cmd"
31023102
" 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,
31083108
}
31093109

31103110
if (lpfc_bgs_get_uninit_dif_block(bgstat)) {
3111-
cmd->result = ScsiResult(DID_ERROR, 0);
3111+
cmd->result = DID_ERROR << 16;
31123112
lpfc_printf_log(phba, KERN_WARNING, LOG_FCP | LOG_BG,
31133113
"9073 BLKGRD: Invalid BG PDIF Block in cmd"
31143114
" 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,
31243124

31253125
scsi_build_sense_buffer(1, cmd->sense_buffer, ILLEGAL_REQUEST,
31263126
0x10, 0x1);
3127-
cmd->result = DRIVER_SENSE << 24
3128-
| ScsiResult(DID_ABORT, SAM_STAT_CHECK_CONDITION);
3127+
cmd->result = DRIVER_SENSE << 24 | DID_ABORT << 16 |
3128+
SAM_STAT_CHECK_CONDITION;
31293129
phba->bg_guard_err_cnt++;
31303130
lpfc_printf_log(phba, KERN_WARNING, LOG_FCP | LOG_BG,
31313131
"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,
31403140

31413141
scsi_build_sense_buffer(1, cmd->sense_buffer, ILLEGAL_REQUEST,
31423142
0x10, 0x3);
3143-
cmd->result = DRIVER_SENSE << 24
3144-
| ScsiResult(DID_ABORT, SAM_STAT_CHECK_CONDITION);
3143+
cmd->result = DRIVER_SENSE << 24 | DID_ABORT << 16 |
3144+
SAM_STAT_CHECK_CONDITION;
31453145

31463146
phba->bg_reftag_err_cnt++;
31473147
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,
31573157

31583158
scsi_build_sense_buffer(1, cmd->sense_buffer, ILLEGAL_REQUEST,
31593159
0x10, 0x2);
3160-
cmd->result = DRIVER_SENSE << 24
3161-
| ScsiResult(DID_ABORT, SAM_STAT_CHECK_CONDITION);
3160+
cmd->result = DRIVER_SENSE << 24 | DID_ABORT << 16 |
3161+
SAM_STAT_CHECK_CONDITION;
31623162

31633163
phba->bg_apptag_err_cnt++;
31643164
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,
38743874
}
38753875

38763876
out:
3877-
cmnd->result = ScsiResult(host_status, scsi_status);
3877+
cmnd->result = host_status << 16 | scsi_status;
38783878
lpfc_send_scsi_error_event(vport->phba, vport, lpfc_cmd, rsp_iocb);
38793879
}
38803880

@@ -4027,7 +4027,7 @@ lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pIocbIn,
40274027
break;
40284028
case IOSTAT_NPORT_BSY:
40294029
case IOSTAT_FABRIC_BSY:
4030-
cmd->result = ScsiResult(DID_TRANSPORT_DISRUPTED, 0);
4030+
cmd->result = DID_TRANSPORT_DISRUPTED << 16;
40314031
fast_path_evt = lpfc_alloc_fast_evt(phba);
40324032
if (!fast_path_evt)
40334033
break;
@@ -4061,14 +4061,14 @@ lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pIocbIn,
40614061
lpfc_cmd->result == IOERR_ELXSEC_CRYPTO_ERROR ||
40624062
lpfc_cmd->result ==
40634063
IOERR_ELXSEC_CRYPTO_COMPARE_ERROR) {
4064-
cmd->result = ScsiResult(DID_NO_CONNECT, 0);
4064+
cmd->result = DID_NO_CONNECT << 16;
40654065
break;
40664066
}
40674067
if (lpfc_cmd->result == IOERR_INVALID_RPI ||
40684068
lpfc_cmd->result == IOERR_NO_RESOURCES ||
40694069
lpfc_cmd->result == IOERR_ABORT_REQUESTED ||
40704070
lpfc_cmd->result == IOERR_SLER_CMD_RCV_FAILURE) {
4071-
cmd->result = ScsiResult(DID_REQUEUE, 0);
4071+
cmd->result = DID_REQUEUE << 16;
40724072
break;
40734073
}
40744074
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,
41024102
}
41034103
/* else: fall through */
41044104
default:
4105-
cmd->result = ScsiResult(DID_ERROR, 0);
4105+
cmd->result = DID_ERROR << 16;
41064106
break;
41074107
}
41084108

41094109
if (!pnode || !NLP_CHK_NODE_ACT(pnode)
41104110
|| (pnode->nlp_state != NLP_STE_MAPPED_NODE))
4111-
cmd->result = ScsiResult(DID_TRANSPORT_DISRUPTED,
4112-
SAM_STAT_BUSY);
4111+
cmd->result = DID_TRANSPORT_DISRUPTED << 16 |
4112+
SAM_STAT_BUSY;
41134113
} else
4114-
cmd->result = ScsiResult(DID_OK, 0);
4114+
cmd->result = DID_OK << 16;
41154115

41164116
if (cmd->result || lpfc_cmd->fcp_rsp->rspSnsLen) {
41174117
uint32_t *lp = (uint32_t *)cmd->sense_buffer;

0 commit comments

Comments
 (0)