Skip to content

Commit

Permalink
scsi: core: Rename and move get_scsi_ml_byte()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Niklas Cassel authored and Martin K. Petersen committed May 22, 2023
1 parent 3d848ca commit 7343269
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
7 changes: 1 addition & 6 deletions drivers/scsi/scsi_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -578,11 +578,6 @@ static bool scsi_end_request(struct request *req, blk_status_t error,
return false;
}

static inline u8 get_scsi_ml_byte(int result)
{
return (result >> 8) & 0xff;
}

/**
* scsi_result_to_blk_status - translate a SCSI result code into blk_status_t
* @result: scsi error code
Expand All @@ -595,7 +590,7 @@ static blk_status_t scsi_result_to_blk_status(int result)
* Check the scsi-ml byte first in case we converted a host or status
* byte.
*/
switch (get_scsi_ml_byte(result)) {
switch (scsi_ml_byte(result)) {
case SCSIML_STAT_OK:
break;
case SCSIML_STAT_RESV_CONFLICT:
Expand Down
5 changes: 5 additions & 0 deletions drivers/scsi/scsi_priv.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ enum scsi_ml_status {
SCSIML_STAT_TGT_FAILURE = 0x04, /* Permanent target failure */
};

static inline u8 scsi_ml_byte(int result)
{
return (result >> 8) & 0xff;
}

/*
* Scsi Error Handler Flags
*/
Expand Down

0 comments on commit 7343269

Please sign in to comment.