[PATCH v6 38/40] s390: scsi: use 16-bits defined sense codes
From: Damien Le Moal <dlemoal@kernel.org>
Date: 2026-09-08 09:04:27
Also in:
linux-s390, linux-scsi, linux-usb
Subsystem:
s390 architecture, s390 zfcp driver, the rest · Maintainers:
Heiko Carstens, Vasily Gorbik, Alexander Gordeev, Nihar Panda, Linus Torvalds
Use the 16-bits sense codes and replace all hard-coded additional sense codes and additional sense code qualifiers with the enum values defined in include/scsi/scsi_sense.h. This helps with code clarity as the sense codes being processed are easier to test and self-documented. No functional change intended. Signed-off-by: Damien Le Moal <dlemoal@kernel.org> Reviewed-by: Johannes Thumshirn <redacted> Reviewed-by: Hannes Reinecke <hare@kernel.org> --- drivers/s390/scsi/zfcp_ext.h | 2 +- drivers/s390/scsi/zfcp_fsf.c | 9 ++++++--- drivers/s390/scsi/zfcp_scsi.c | 6 +++--- 3 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/drivers/s390/scsi/zfcp_ext.h b/drivers/s390/scsi/zfcp_ext.h
index 0eb9bc9d03e4..cafdeaf29195 100644
--- a/drivers/s390/scsi/zfcp_ext.h
+++ b/drivers/s390/scsi/zfcp_ext.h@@ -176,7 +176,7 @@ extern void zfcp_scsi_schedule_rport_register(struct zfcp_port *); extern void zfcp_scsi_schedule_rport_block(struct zfcp_port *); extern void zfcp_scsi_schedule_rports_block(struct zfcp_adapter *); extern void zfcp_scsi_set_prot(struct zfcp_adapter *); -extern void zfcp_scsi_dif_sense_error(struct scsi_cmnd *, int); +extern void zfcp_scsi_dif_sense_error(struct scsi_cmnd *, u16); extern void zfcp_scsi_shost_update_config_data( struct zfcp_adapter *const adapter, const struct fsf_qtcb_bottom_config *const bottom,
diff --git a/drivers/s390/scsi/zfcp_fsf.c b/drivers/s390/scsi/zfcp_fsf.c
index d407f16e77ef..1ea6ab720fc0 100644
--- a/drivers/s390/scsi/zfcp_fsf.c
+++ b/drivers/s390/scsi/zfcp_fsf.c@@ -2485,13 +2485,16 @@ static void zfcp_fsf_fcp_cmnd_handler(struct zfcp_fsf_req *req) set_host_byte(scpnt, DID_ERROR); goto skip_fsfstatus; case FSF_BLOCK_GUARD_CHECK_FAILURE: - zfcp_scsi_dif_sense_error(scpnt, 0x1); + zfcp_scsi_dif_sense_error(scpnt, + LOGICAL_BLOCK_GUARD_CHECK_FAILED); goto skip_fsfstatus; case FSF_APP_TAG_CHECK_FAILURE: - zfcp_scsi_dif_sense_error(scpnt, 0x2); + zfcp_scsi_dif_sense_error(scpnt, + LOGICAL_BLOCK_APPLICATION_TAG_CHECK_FAILED); goto skip_fsfstatus; case FSF_REF_TAG_CHECK_FAILURE: - zfcp_scsi_dif_sense_error(scpnt, 0x3); + zfcp_scsi_dif_sense_error(scpnt, + LOGICAL_BLOCK_REFERENCE_TAG_CHECK_FAILED); goto skip_fsfstatus; } BUILD_BUG_ON(sizeof(struct fcp_resp_with_ext) > FSF_FCP_RSP_SIZE);
diff --git a/drivers/s390/scsi/zfcp_scsi.c b/drivers/s390/scsi/zfcp_scsi.c
index 3590113c2b74..ea4b968352f4 100644
--- a/drivers/s390/scsi/zfcp_scsi.c
+++ b/drivers/s390/scsi/zfcp_scsi.c@@ -849,14 +849,14 @@ void zfcp_scsi_set_prot(struct zfcp_adapter *adapter) /** * zfcp_scsi_dif_sense_error - Report DIF/DIX error as driver sense error * @scmd: The SCSI command to report the error for - * @ascq: The ASCQ to put in the sense buffer + * @sense_code: The combined ASC and ASCQ to put in the sense buffer * * See the error handling in sd_done for the sense codes used here. * Set DID_SOFT_ERROR to retry the request, if possible. */ -void zfcp_scsi_dif_sense_error(struct scsi_cmnd *scmd, int ascq) +void zfcp_scsi_dif_sense_error(struct scsi_cmnd *scmd, u16 sense_code) { - scsi_build_sense(scmd, 1, ILLEGAL_REQUEST, 0x10, ascq); + scsi_set_sense(scmd, 1, ILLEGAL_REQUEST, sense_code); set_host_byte(scmd, DID_SOFT_ERROR); }
--
2.55.0