Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

scsi: core: Rename and move get_scsi_ml_byte()

SCSI has two different getters:

- get_XXX_byte() (in scsi_cmnd.h) which takes a struct scsi_cmnd *, and

- XXX_byte() (in scsi.h) which takes a scmd->result.

The proper name for get_scsi_ml_byte() should thus be without the get_
prefix, as it takes a scmd->result. Rename the function to rectify this.
(This change was suggested by Mike Christie.)

Additionally, move get_scsi_ml_byte() to scsi_priv.h since both scsi_lib.c
and scsi_error.c will need to use this helper in a follow-up patch.

Cc: Mike Christie <michael.christie@oracle.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
Link: https://lore.kernel.org/r/20230511011356.227789-6-nks@flawful.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

authored by

Niklas Cassel and committed by
Martin K. Petersen
73432693 3d848ca1

+6 -6
+1 -6
drivers/scsi/scsi_lib.c
··· 578 578 return false; 579 579 } 580 580 581 - static inline u8 get_scsi_ml_byte(int result) 582 - { 583 - return (result >> 8) & 0xff; 584 - } 585 - 586 581 /** 587 582 * scsi_result_to_blk_status - translate a SCSI result code into blk_status_t 588 583 * @result: scsi error code ··· 590 595 * Check the scsi-ml byte first in case we converted a host or status 591 596 * byte. 592 597 */ 593 - switch (get_scsi_ml_byte(result)) { 598 + switch (scsi_ml_byte(result)) { 594 599 case SCSIML_STAT_OK: 595 600 break; 596 601 case SCSIML_STAT_RESV_CONFLICT:
+5
drivers/scsi/scsi_priv.h
··· 29 29 SCSIML_STAT_TGT_FAILURE = 0x04, /* Permanent target failure */ 30 30 }; 31 31 32 + static inline u8 scsi_ml_byte(int result) 33 + { 34 + return (result >> 8) & 0xff; 35 + } 36 + 32 37 /* 33 38 * Scsi Error Handler Flags 34 39 */