From: Hannes Reinecke <hare@suse.de>
To: "Martin K. Petersen" <martin.petersen@oracle.com>
Cc: Christoph Hellwig <hch@lst.de>,
James Bottomley <james.bottomley@hansenpartnership.com>,
linux-scsi@vger.kernel.org, Hannes Reinecke <hare@suse.de>
Subject: [PATCH 17/24] scsi: do not use DRIVER_INVALID
Date: Thu, 31 Oct 2019 12:04:45 +0100 [thread overview]
Message-ID: <20191031110452.73463-18-hare@suse.de> (raw)
In-Reply-To: <20191031110452.73463-1-hare@suse.de>
Use DID_ERROR instead of DRIVER_INVALID, as it really doesn't
matter if the driver or the device didn't understand the command.
Signed-off-by: Hannes Reinecke <hare@suse.de>
---
drivers/scsi/constants.c | 3 +--
drivers/scsi/hptiop.c | 2 +-
drivers/scsi/mvumi.c | 10 +++++-----
drivers/scsi/vmw_pvscsi.c | 18 +++++++++---------
include/scsi/scsi.h | 2 --
include/trace/events/scsi.h | 3 +--
6 files changed, 17 insertions(+), 21 deletions(-)
diff --git a/drivers/scsi/constants.c b/drivers/scsi/constants.c
index 1780837ea11e..1cee98534bfd 100644
--- a/drivers/scsi/constants.c
+++ b/drivers/scsi/constants.c
@@ -407,8 +407,7 @@ static const char * const hostbyte_table[]={
"DID_NEXUS_FAILURE" };
static const char * const driverbyte_table[]={
-"DRIVER_OK", "DRIVER_BUSY", "DRIVER_SOFT", "DRIVER_MEDIA", "DRIVER_ERROR",
-"DRIVER_INVALID"};
+"DRIVER_OK", "DRIVER_BUSY", "DRIVER_SOFT", "DRIVER_MEDIA", "DRIVER_ERROR"};
const char *scsi_hostbyte_string(int result)
{
diff --git a/drivers/scsi/hptiop.c b/drivers/scsi/hptiop.c
index 6a2561f26e38..2cfb58c2e175 100644
--- a/drivers/scsi/hptiop.c
+++ b/drivers/scsi/hptiop.c
@@ -761,7 +761,7 @@ static void hptiop_finish_scsi_req(struct hptiop_hba *hba, u32 tag,
break;
default:
- scp->result = DRIVER_INVALID << 24 | DID_ABORT << 16;
+ scp->result = (DID_ERROR << 16);
break;
}
diff --git a/drivers/scsi/mvumi.c b/drivers/scsi/mvumi.c
index 91eb879692c3..cbeb1c0e62f2 100644
--- a/drivers/scsi/mvumi.c
+++ b/drivers/scsi/mvumi.c
@@ -1306,20 +1306,20 @@ static void mvumi_complete_cmd(struct mvumi_hba *mhba, struct mvumi_cmd *cmd,
switch (ob_frame->req_status) {
case SAM_STAT_GOOD:
- scmd->result |= DID_OK << 16;
+ set_host_byte(scmd, DID_OK);
break;
case SAM_STAT_BUSY:
- scmd->result |= DID_BUS_BUSY << 16;
+ set_host_byte(scmd, DID_BUS_BUSY);
break;
case SAM_STAT_CHECK_CONDITION:
- scmd->result |= (DID_OK << 16);
+ set_host_byte(scmd, DID_OK);
if (ob_frame->rsp_flag & CL_RSP_FLAG_SENSEDATA) {
memcpy(cmd->scmd->sense_buffer, ob_frame->payload,
sizeof(struct mvumi_sense_data));
}
break;
default:
- scmd->result |= (DRIVER_INVALID << 24) | (DID_ABORT << 16);
+ set_host_byte(scmd, DID_ABORT);
break;
}
@@ -2126,7 +2126,7 @@ static enum blk_eh_timer_return mvumi_timed_out(struct scsi_cmnd *scmd)
else
atomic_dec(&mhba->fw_outstanding);
- scmd->result = (DRIVER_INVALID << 24) | (DID_ABORT << 16);
+ scmd->result = (DID_ABORT << 16);
scmd->SCp.ptr = NULL;
if (scsi_bufflen(scmd)) {
dma_unmap_sg(&mhba->pdev->dev, scsi_sglist(scmd),
diff --git a/drivers/scsi/vmw_pvscsi.c b/drivers/scsi/vmw_pvscsi.c
index 74e5ed940952..e988a8c3fc7f 100644
--- a/drivers/scsi/vmw_pvscsi.c
+++ b/drivers/scsi/vmw_pvscsi.c
@@ -572,25 +572,25 @@ static void pvscsi_complete_request(struct pvscsi_adapter *adapter,
case BTSTAT_LINKED_COMMAND_COMPLETED:
case BTSTAT_LINKED_COMMAND_COMPLETED_WITH_FLAG:
/* If everything went fine, let's move on.. */
- cmd->result = (DID_OK << 16);
+ set_host_byte(cmd, DID_OK);
break;
case BTSTAT_DATARUN:
case BTSTAT_DATA_UNDERRUN:
/* Report residual data in underruns */
scsi_set_resid(cmd, scsi_bufflen(cmd) - e->dataLen);
- cmd->result = (DID_ERROR << 16);
+ set_host_byte(cmd, DID_ERROR);
break;
case BTSTAT_SELTIMEO:
/* Our emulation returns this for non-connected devs */
- cmd->result = (DID_BAD_TARGET << 16);
+ set_host_byte(cmd, DID_BAD_TARGET);
break;
case BTSTAT_LUNMISMATCH:
case BTSTAT_TAGREJECT:
case BTSTAT_BADMSG:
- cmd->result = (DRIVER_INVALID << 24);
+ cmd->result = 0;
/* fall through */
case BTSTAT_HAHARDWARE:
@@ -601,25 +601,25 @@ static void pvscsi_complete_request(struct pvscsi_adapter *adapter,
case BTSTAT_HASOFTWARE:
case BTSTAT_BUSFREE:
case BTSTAT_SENSFAILED:
- cmd->result |= (DID_ERROR << 16);
+ set_host_byte(cmd, DID_ERROR);
break;
case BTSTAT_SENTRST:
case BTSTAT_RECVRST:
case BTSTAT_BUSRESET:
- cmd->result = (DID_RESET << 16);
+ set_host_byte(cmd, DID_RESET);
break;
case BTSTAT_ABORTQUEUE:
- cmd->result = (DID_BUS_BUSY << 16);
+ set_host_byte(cmd, DID_BUS_BUSY);
break;
case BTSTAT_SCSIPARITY:
- cmd->result = (DID_PARITY << 16);
+ set_host_byte(cmd, DID_PARITY);
break;
default:
- cmd->result = (DID_ERROR << 16);
+ set_host_byte(cmd, DID_ERROR);
scmd_printk(KERN_DEBUG, cmd,
"Unknown completion status: 0x%x\n",
btstat);
diff --git a/include/scsi/scsi.h b/include/scsi/scsi.h
index 274cc9e77634..4afb5e8a0a58 100644
--- a/include/scsi/scsi.h
+++ b/include/scsi/scsi.h
@@ -170,8 +170,6 @@ static inline int scsi_is_wlun(u64 lun)
#define DRIVER_MEDIA 0x03
#define DRIVER_ERROR 0x04
-#define DRIVER_INVALID 0x05
-
/*
* Internal return values.
*/
diff --git a/include/trace/events/scsi.h b/include/trace/events/scsi.h
index a1b4da442c5c..83bc7d97a469 100644
--- a/include/trace/events/scsi.h
+++ b/include/trace/events/scsi.h
@@ -131,8 +131,7 @@
scsi_driverbyte_name(DRIVER_BUSY), \
scsi_driverbyte_name(DRIVER_SOFT), \
scsi_driverbyte_name(DRIVER_MEDIA), \
- scsi_driverbyte_name(DRIVER_ERROR), \
- scsi_driverbyte_name(DRIVER_INVALID))
+ scsi_driverbyte_name(DRIVER_ERROR))
#define scsi_msgbyte_name(result) { result, #result }
#define show_msgbyte_name(val) \
--
2.16.4
next prev parent reply other threads:[~2019-10-31 11:05 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-31 11:04 [PATCHv2 00/24] Revamp SCSI result values Hannes Reinecke
2019-10-31 11:04 ` [PATCH 01/24] aic7xxx,aic79xxx: remove driver-defined SAM status definitions Hannes Reinecke
2019-11-01 16:14 ` Bart Van Assche
2019-10-31 11:04 ` [PATCH 02/24] bfa: drop driver-defined SCSI status codes Hannes Reinecke
2019-11-01 16:15 ` Bart Van Assche
2019-10-31 11:04 ` [PATCH 03/24] wd33c93: use SCSI status Hannes Reinecke
2019-11-01 16:16 ` Bart Van Assche
2019-10-31 11:04 ` [PATCH 04/24] acornscsi: use standard defines Hannes Reinecke
2019-11-01 16:18 ` Bart Van Assche
2019-11-01 16:40 ` Hannes Reinecke
2019-10-31 11:04 ` [PATCH 05/24] scsi: use standard SAM status codes Hannes Reinecke
2019-11-01 16:26 ` Bart Van Assche
2019-11-01 16:54 ` Hannes Reinecke
2019-11-01 18:10 ` Bart Van Assche
2019-10-31 11:04 ` [PATCH 06/24] scsi: change status_byte() to return the standard SCSI status Hannes Reinecke
2019-10-31 11:04 ` [PATCH 07/24] target_core: Fixup target_complete_cmd() usage Hannes Reinecke
2019-11-01 16:29 ` Bart Van Assche
2019-10-31 11:04 ` [PATCH 08/24] sg: use SAM status definitions and avoid using masked_status Hannes Reinecke
2019-10-31 11:04 ` [PATCH 09/24] scsi: Kill obsolete linux-specific status codes Hannes Reinecke
2019-11-02 13:14 ` kbuild test robot
2019-10-31 11:04 ` [PATCH 10/24] scsi: introduce set_status_byte() Hannes Reinecke
2019-11-01 16:36 ` Bart Van Assche
2019-10-31 11:04 ` [PATCH 11/24] advansys: kill driver_defined status byte accessors Hannes Reinecke
2019-10-31 11:04 ` [PATCH 12/24] scsi: introduce scsi_build_sense() Hannes Reinecke
2019-11-01 16:35 ` Bart Van Assche
2019-10-31 11:04 ` [PATCH 13/24] scsi: Kill DRIVER_SENSE Hannes Reinecke
2019-10-31 11:04 ` [PATCH 14/24] scsi: Kill DRIVER_HARD Hannes Reinecke
2019-10-31 11:04 ` [PATCH 15/24] scsi_error: use DID_TIME_OUT instead of DRIVER_TIMEOUT Hannes Reinecke
2019-10-31 11:04 ` [PATCH 16/24] scsi: Kill DRIVER_TIMEOUT Hannes Reinecke
2019-10-31 11:04 ` Hannes Reinecke [this message]
2019-11-02 3:28 ` [PATCH 17/24] scsi: do not use DRIVER_INVALID Finn Thain
2019-10-31 11:04 ` [PATCH 18/24] st: return error code in st_scsi_execute() Hannes Reinecke
2019-10-31 11:04 ` [PATCH 19/24] scsi_ioctl: return error code when blk_rq_map_kern() fails Hannes Reinecke
2019-10-31 11:04 ` [PATCH 20/24] scsi_dh_alua: do not interpret DRIVER_ERROR Hannes Reinecke
2019-10-31 11:04 ` [PATCH 21/24] xen-scsiback: stop using DRIVER_ERROR Hannes Reinecke
2019-10-31 11:04 ` [PATCH 22/24] scsi: " Hannes Reinecke
2019-10-31 11:04 ` [PATCH 23/24] scsi: Kill DRIVER_MEDIA, DRIVER_SOFT, and DRIVER_BUSY Hannes Reinecke
2019-10-31 11:04 ` [PATCH 24/24] scsi: Drop the now obsolete driver_byte definitions Hannes Reinecke
-- strict thread matches above, loose matches on Subject: below --
2019-10-21 9:52 [PATCH RFC 00/24] scsi: Revamp result values Hannes Reinecke
2019-10-21 9:53 ` [PATCH 17/24] scsi: do not use DRIVER_INVALID Hannes Reinecke
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=20191031110452.73463-18-hare@suse.de \
--to=hare@suse.de \
--cc=hch@lst.de \
--cc=james.bottomley@hansenpartnership.com \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@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).