linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Niklas Cassel <niklas.cassel@wdc.com>
To: "James E.J. Bottomley" <jejb@linux.ibm.com>,
	"Martin K. Petersen" <martin.petersen@oracle.com>
Cc: Christoph Hellwig <hch@lst.de>, Hannes Reinecke <hare@suse.de>,
	Damien Le Moal <damien.lemoal@opensource.wdc.com>,
	linux-scsi@vger.kernel.org, linux-ide@vger.kernel.org,
	linux-block@vger.kernel.org,
	Niklas Cassel <niklas.cassel@wdc.com>,
	Mike Christie <michael.christie@oracle.com>,
	Bart Van Assche <bvanassche@acm.org>
Subject: [PATCH v4 05/19] scsi: rename and move get_scsi_ml_byte()
Date: Thu,  9 Mar 2023 22:54:57 +0100	[thread overview]
Message-ID: <20230309215516.3800571-6-niklas.cassel@wdc.com> (raw)
In-Reply-To: <20230309215516.3800571-1-niklas.cassel@wdc.com>

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>
Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/scsi/scsi_lib.c  | 7 +------
 drivers/scsi/scsi_priv.h | 5 +++++
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index b7c569a42aa4..fac9c31161d2 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -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
@@ -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:
diff --git a/drivers/scsi/scsi_priv.h b/drivers/scsi/scsi_priv.h
index 96284a0e13fe..74324fba4281 100644
--- a/drivers/scsi/scsi_priv.h
+++ b/drivers/scsi/scsi_priv.h
@@ -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
  */
-- 
2.39.2


  parent reply	other threads:[~2023-03-09 21:56 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-09 21:54 [PATCH v4 00/19] Add Command Duration Limits support Niklas Cassel
2023-03-09 21:54 ` [PATCH v4 01/19] ioprio: cleanup interface definition Niklas Cassel
2023-03-16 17:58   ` Bart Van Assche
2023-03-16 18:09     ` Bart Van Assche
2023-03-09 21:54 ` [PATCH v4 02/19] block: introduce ioprio hints Niklas Cassel
2023-03-16  2:00   ` Damien Le Moal
2023-03-16 18:41     ` Bart Van Assche
2023-03-17  9:23       ` Niklas Cassel
2023-03-17 16:56         ` Bart Van Assche
2023-03-09 21:54 ` [PATCH v4 03/19] block: introduce BLK_STS_DURATION_LIMIT Niklas Cassel
2023-03-09 21:54 ` [PATCH v4 04/19] scsi: core: allow libata to complete successful commands via EH Niklas Cassel
2023-03-09 21:54 ` Niklas Cassel [this message]
2023-03-09 21:54 ` [PATCH v4 06/19] scsi: support retrieving sub-pages of mode pages Niklas Cassel
2023-03-09 21:54 ` [PATCH v4 07/19] scsi: support service action in scsi_report_opcode() Niklas Cassel
2023-03-09 21:55 ` [PATCH v4 08/19] scsi: detect support for command duration limits Niklas Cassel
2023-03-09 21:55 ` [PATCH v4 09/19] scsi: allow enabling and disabling " Niklas Cassel
2023-03-09 21:55 ` [PATCH v4 10/19] scsi: sd: set read/write commands CDL index Niklas Cassel
2023-03-09 21:55 ` [PATCH v4 11/19] scsi: sd: handle read/write CDL timeout failures Niklas Cassel
2023-03-09 21:55 ` [PATCH v4 12/19] ata: libata-scsi: remove unnecessary !cmd checks Niklas Cassel
2023-03-09 21:55 ` [PATCH v4 13/19] ata: libata: change ata_eh_request_sense() to not set CHECK_CONDITION Niklas Cassel
2023-03-09 21:55 ` [PATCH v4 14/19] ata: libata: detect support for command duration limits Niklas Cassel
2023-03-09 21:55 ` [PATCH v4 15/19] ata: libata-scsi: handle CDL bits in ata_scsiop_maint_in() Niklas Cassel
2023-03-09 21:55 ` [PATCH v4 16/19] ata: libata-scsi: add support for CDL pages mode sense Niklas Cassel
2023-03-09 21:55 ` [PATCH v4 17/19] ata: libata: add ATA feature control sub-page translation Niklas Cassel
2023-03-09 21:55 ` [PATCH v4 18/19] ata: libata: set read/write commands CDL index Niklas Cassel
2023-03-09 21:55 ` [PATCH v4 19/19] ata: libata: handle completion of CDL commands using policy 0xD Niklas Cassel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230309215516.3800571-6-niklas.cassel@wdc.com \
    --to=niklas.cassel@wdc.com \
    --cc=bvanassche@acm.org \
    --cc=damien.lemoal@opensource.wdc.com \
    --cc=hare@suse.de \
    --cc=hch@lst.de \
    --cc=jejb@linux.ibm.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=michael.christie@oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).