| Message ID | 20260903034201.112211-11-dlemoal@kernel.org |
|---|---|
| State | New |
| Headers | show |
| Series | Use defined 16-bits ASC/ASCQ combinations | expand |
> Refactor the SCSI stroage enclosure driver to use the 16-bits sense_code > field of struct scsi_failure 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> Sashiko has reviewed this patch and found no issues. It looks great!
On 9/3/26 5:41 AM, Damien Le Moal wrote: > Refactor the SCSI stroage enclosure driver to use the 16-bits sense_code > field of struct scsi_failure 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> > --- > drivers/scsi/ses.c | 15 +++++++-------- > 1 file changed, 7 insertions(+), 8 deletions(-) > Reviewed-by: Hannes Reinecke <hare@kernel.org> Cheers, Hannes
diff --git a/drivers/scsi/ses.c b/drivers/scsi/ses.c index 454886c24570..eefeb8b9a75c 100644 --- a/drivers/scsi/ses.c +++ b/drivers/scsi/ses.c @@ -72,6 +72,9 @@ static void init_device_slot_control(unsigned char *dest_desc, dest_desc[3] &= 0x3c; } +#define POWER_ON_RESET_ANY \ + scsi_sense_code(ASC_POWER_ON_RESET_OR_BUS_DEVICE_RESET_OCCURRED, \ + SCMD_FAILURE_ASCQ_ANY) static int ses_recv_diag(struct scsi_device *sdev, int page_code, void *buf, int bufflen) @@ -89,15 +92,13 @@ static int ses_recv_diag(struct scsi_device *sdev, int page_code, struct scsi_failure failure_defs[] = { { .sense_key = UNIT_ATTENTION, - .asc = 0x29, - .ascq = SCMD_FAILURE_ASCQ_ANY, + .sense_code = POWER_ON_RESET_ANY, .allowed = SES_RETRIES, .result = SAM_STAT_CHECK_CONDITION, }, { .sense_key = NOT_READY, - .asc = SCMD_FAILURE_ASC_ANY, - .ascq = SCMD_FAILURE_ASCQ_ANY, + .sense_code = SCMD_FAILURE_SENSE_CODE_ANY, .allowed = SES_RETRIES, .result = SAM_STAT_CHECK_CONDITION, }, @@ -146,15 +147,13 @@ static int ses_send_diag(struct scsi_device *sdev, int page_code, struct scsi_failure failure_defs[] = { { .sense_key = UNIT_ATTENTION, - .asc = 0x29, - .ascq = SCMD_FAILURE_ASCQ_ANY, + .sense_code = POWER_ON_RESET_ANY, .allowed = SES_RETRIES, .result = SAM_STAT_CHECK_CONDITION, }, { .sense_key = NOT_READY, - .asc = SCMD_FAILURE_ASC_ANY, - .ascq = SCMD_FAILURE_ASCQ_ANY, + .sense_code = SCMD_FAILURE_SENSE_CODE_ANY, .allowed = SES_RETRIES, .result = SAM_STAT_CHECK_CONDITION, },
Refactor the SCSI stroage enclosure driver to use the 16-bits sense_code field of struct scsi_failure 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> --- drivers/scsi/ses.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-)