scsi: core: Drop the now obsolete driver_byte definitions

The driver_byte field in the result is now unused, so we can drop the
definitions.

Link: https://lore.kernel.org/r/20210427083046.31620-15-hare@suse.de
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:
Hannes Reinecke 2021-04-27 10:30:20 +02:00 committed by Martin K. Petersen
parent b840abeffc
commit 54c2908619
15 changed files with 19 additions and 73 deletions

View File

@ -1174,8 +1174,7 @@ Members of interest:
target device). 'result' is a 32 bit unsigned integer that
can be viewed as 4 related bytes. The SCSI status value is
in the LSB. See include/scsi/scsi.h status_byte(),
msg_byte(), host_byte() and driver_byte() macros and
related constants.
msg_byte() and host_byte() macros and related constants.
sense_buffer
- an array (maximum size: SCSI_SENSE_BUFFERSIZE bytes) that
should be written when the SCSI status (LSB of 'result')

View File

@ -84,7 +84,7 @@ static int bsg_transport_complete_rq(struct request *rq, struct sg_io_v4 *hdr)
*/
hdr->device_status = job->result & 0xff;
hdr->transport_status = host_byte(job->result);
hdr->driver_status = driver_byte(job->result);
hdr->driver_status = 0;
hdr->info = 0;
if (hdr->device_status || hdr->transport_status || hdr->driver_status)
hdr->info |= SG_INFO_CHECK;

View File

@ -96,7 +96,7 @@ static int bsg_scsi_complete_rq(struct request *rq, struct sg_io_v4 *hdr)
*/
hdr->device_status = sreq->result & 0xff;
hdr->transport_status = host_byte(sreq->result);
hdr->driver_status = driver_byte(sreq->result);
hdr->driver_status = 0;
if (scsi_status_is_check_condition(sreq->result))
hdr->driver_status = DRIVER_SENSE;
hdr->info = 0;

View File

@ -256,7 +256,7 @@ static int blk_complete_sghdr_rq(struct request *rq, struct sg_io_hdr *hdr,
hdr->masked_status = status_byte(req->result);
hdr->msg_status = msg_byte(req->result);
hdr->host_status = host_byte(req->result);
hdr->driver_status = driver_byte(req->result);
hdr->driver_status = 0;
if (scsi_status_is_check_condition(hdr->status))
hdr->driver_status = DRIVER_SENSE;
hdr->info = 0;

View File

@ -406,10 +406,6 @@ static const char * const hostbyte_table[]={
"DID_TRANSPORT_DISRUPTED", "DID_TRANSPORT_FAILFAST", "DID_TARGET_FAILURE",
"DID_NEXUS_FAILURE", "DID_ALLOC_FAILURE", "DID_MEDIUM_ERROR" };
static const char * const driverbyte_table[]={
"DRIVER_OK", "DRIVER_BUSY", "DRIVER_SOFT", "DRIVER_MEDIA", "DRIVER_ERROR",
"DRIVER_INVALID", "DRIVER_TIMEOUT", "DRIVER_HARD", "DRIVER_SENSE"};
const char *scsi_hostbyte_string(int result)
{
const char *hb_string = NULL;
@ -421,17 +417,6 @@ const char *scsi_hostbyte_string(int result)
}
EXPORT_SYMBOL(scsi_hostbyte_string);
const char *scsi_driverbyte_string(int result)
{
const char *db_string = NULL;
int db = driver_byte(result);
if (db < ARRAY_SIZE(driverbyte_table))
db_string = driverbyte_table[db];
return db_string;
}
EXPORT_SYMBOL(scsi_driverbyte_string);
#define scsi_mlreturn_name(result) { result, #result }
static const struct value_name_pair scsi_mlreturn_arr[] = {
scsi_mlreturn_name(NEEDS_RETRY),

View File

@ -385,7 +385,6 @@ void scsi_print_result(const struct scsi_cmnd *cmd, const char *msg,
size_t off, logbuf_len;
const char *mlret_string = scsi_mlreturn_string(disposition);
const char *hb_string = scsi_hostbyte_string(cmd->result);
const char *db_string = scsi_driverbyte_string(cmd->result);
unsigned long cmd_age = (jiffies - cmd->jiffies_at_alloc) / HZ;
logbuf = scsi_log_reserve_buffer(&logbuf_len);
@ -426,13 +425,8 @@ void scsi_print_result(const struct scsi_cmnd *cmd, const char *msg,
if (WARN_ON(off >= logbuf_len))
goto out_printk;
if (db_string)
off += scnprintf(logbuf + off, logbuf_len - off,
"driverbyte=%s ", db_string);
else
off += scnprintf(logbuf + off, logbuf_len - off,
"driverbyte=0x%02x ",
driver_byte(cmd->result));
off += scnprintf(logbuf + off, logbuf_len - off,
"driverbyte=DRIVER_OK ");
off += scnprintf(logbuf + off, logbuf_len - off,
"cmd_age=%lus", cmd_age);

View File

@ -3810,15 +3810,14 @@ void sd_print_sense_hdr(struct scsi_disk *sdkp, struct scsi_sense_hdr *sshdr)
void sd_print_result(const struct scsi_disk *sdkp, const char *msg, int result)
{
const char *hb_string = scsi_hostbyte_string(result);
const char *db_string = scsi_driverbyte_string(result);
if (hb_string || db_string)
if (hb_string)
sd_printk(KERN_INFO, sdkp,
"%s: Result: hostbyte=%s driverbyte=%s\n", msg,
hb_string ? hb_string : "invalid",
db_string ? db_string : "invalid");
"DRIVER_OK");
else
sd_printk(KERN_INFO, sdkp,
"%s: Result: hostbyte=0x%02x driverbyte=0x%02x\n",
msg, host_byte(result), driver_byte(result));
"%s: Result: hostbyte=0x%02x driverbyte=%s\n",
msg, host_byte(result), "DRIVER_OK");
}

View File

@ -338,7 +338,7 @@ static int sr_done(struct scsi_cmnd *SCpnt)
* care is taken to avoid unnecessary additional work such as
* memcpy's that could be avoided.
*/
if (driver_byte(result) != 0 && /* An error occurred */
if (status_byte(result) == SAM_STAT_CHECK_CONDITION &&
(SCpnt->sense_buffer[0] & 0x7f) == 0x70) { /* Sense current */
switch (SCpnt->sense_buffer[2]) {
case MEDIUM_ERROR:

View File

@ -205,7 +205,7 @@ int sr_do_ioctl(Scsi_CD *cd, struct packet_command *cgc)
err = result;
goto out;
}
if (driver_byte(result) != 0) {
if (status_byte(result) == SAM_STAT_CHECK_CONDITION) {
switch (sshdr->sense_key) {
case UNIT_ATTENTION:
SDev->changed = 1;

View File

@ -390,8 +390,8 @@ static int st_chk_result(struct scsi_tape *STp, struct st_request * SRpnt)
if (!debugging) { /* Abnormal conditions for tape */
if (!cmdstatp->have_sense)
st_printk(KERN_WARNING, STp,
"Error %x (driver bt 0x%x, host bt 0x%x).\n",
result, driver_byte(result), host_byte(result));
"Error %x (driver bt 0, host bt 0x%x).\n",
result, host_byte(result));
else if (cmdstatp->have_sense &&
scode != NO_SENSE &&
scode != RECOVERED_ERROR &&

View File

@ -222,10 +222,10 @@ static void scsiback_print_status(char *sense_buffer, int errors,
{
struct scsiback_tpg *tpg = pending_req->v2p->tpg;
pr_err("[%s:%d] cmnd[0]=%02x -> st=%02x msg=%02x host=%02x drv=%02x\n",
pr_err("[%s:%d] cmnd[0]=%02x -> st=%02x msg=%02x host=%02x\n",
tpg->tport->tport_name, pending_req->v2p->lun,
pending_req->cmnd[0], status_byte(errors), msg_byte(errors),
host_byte(errors), driver_byte(errors));
host_byte(errors));
}
static void scsiback_fast_flush_area(struct vscsibk_pend *req)

View File

@ -152,20 +152,6 @@ static inline int scsi_status_is_check_condition(int status)
#define DID_TRANSPORT_MARGINAL 0x14 /* Transport marginal errors */
#define DRIVER_OK 0x00 /* Driver status */
/*
* These indicate the error that occurred, and what is available.
*/
#define DRIVER_BUSY 0x01
#define DRIVER_SOFT 0x02
#define DRIVER_MEDIA 0x03
#define DRIVER_ERROR 0x04
#define DRIVER_INVALID 0x05
#define DRIVER_TIMEOUT 0x06
#define DRIVER_HARD 0x07
#define DRIVER_SENSE 0x08
/*
* Internal return values.
*/
@ -197,12 +183,10 @@ enum scsi_disposition {
* status byte = set from target device
* msg_byte = return status from host adapter itself.
* host_byte = set by low-level driver to indicate status.
* driver_byte = set by mid-level.
*/
#define status_byte(result) (((result) >> 1) & 0x7f)
#define msg_byte(result) (((result) >> 8) & 0xff)
#define host_byte(result) (((result) >> 16) & 0xff)
#define driver_byte(result) (((result) >> 24) & 0xff)
#define sense_class(sense) (((sense) >> 4) & 0x7)
#define sense_error(sense) ((sense) & 0xf)

View File

@ -325,10 +325,6 @@ static inline void set_host_byte(struct scsi_cmnd *cmd, char status)
cmd->result = (cmd->result & 0xff00ffff) | (status << 16);
}
static inline void set_driver_byte(struct scsi_cmnd *cmd, char status)
{
cmd->result = (cmd->result & 0x00ffffff) | (status << 24);
}
static inline unsigned scsi_transfer_length(struct scsi_cmnd *scmd)
{

View File

@ -142,6 +142,8 @@ struct compat_sg_io_hdr {
* keep setting this byte to be compatible with previous releases.
*/
#define DRIVER_SENSE 0x08
/* Obsolete driver_byte() declaration */
#define driver_byte(result) (((result) >> 24) & 0xff)
typedef struct sg_scsi_id { /* used by SG_GET_SCSI_ID ioctl() */
int host_no; /* as in "scsi<n>" where 'n' is one of 0, 1, 2 etc */

View File

@ -124,19 +124,6 @@
scsi_hostbyte_name(DID_TRANSPORT_DISRUPTED), \
scsi_hostbyte_name(DID_TRANSPORT_FAILFAST))
#define scsi_driverbyte_name(result) { result, #result }
#define show_driverbyte_name(val) \
__print_symbolic(val, \
scsi_driverbyte_name(DRIVER_OK), \
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_TIMEOUT), \
scsi_driverbyte_name(DRIVER_HARD), \
scsi_driverbyte_name(DRIVER_SENSE))
#define scsi_msgbyte_name(result) { result, #result }
#define show_msgbyte_name(val) \
__print_symbolic(val, \
@ -327,7 +314,7 @@ DECLARE_EVENT_CLASS(scsi_cmd_done_timeout_template,
show_opcode_name(__entry->opcode),
__parse_cdb(__get_dynamic_array(cmnd), __entry->cmd_len),
__print_hex(__get_dynamic_array(cmnd), __entry->cmd_len),
show_driverbyte_name(((__entry->result) >> 24) & 0xff),
"DRIVER_OK",
show_hostbyte_name(((__entry->result) >> 16) & 0xff),
show_msgbyte_name(((__entry->result) >> 8) & 0xff),
show_statusbyte_name(__entry->result & 0xff))