scsi: core: Drop the now obsolete driver_byte definitions
authorHannes Reinecke <hare@suse.com>
Tue, 27 Apr 2021 08:30:20 +0000 (10:30 +0200)
committerMartin K. Petersen <martin.petersen@oracle.com>
Tue, 1 Jun 2021 02:48:22 +0000 (22:48 -0400)
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>
15 files changed:
Documentation/scsi/scsi_mid_low_api.rst
block/bsg-lib.c
block/bsg.c
block/scsi_ioctl.c
drivers/scsi/constants.c
drivers/scsi/scsi_logging.c
drivers/scsi/sd.c
drivers/scsi/sr.c
drivers/scsi/sr_ioctl.c
drivers/scsi/st.c
drivers/xen/xen-scsiback.c
include/scsi/scsi.h
include/scsi/scsi_cmnd.h
include/scsi/sg.h
include/trace/events/scsi.h

index 096ffe9cae0e04807d0273cb16a01fc10572ff4e..b99b4e418ba9e4efc12bf2373f7db1672e951d5f 100644 (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')
index 330fede77271de536d5d4f275ff951cb3c391f55..cf18112617225541650d608af283c5b9c7952f8c 100644 (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;
index 9e6ff0d71d2534448cf4eabad5f9632bab0ebade..33e3f82ed03aa5cde1a7fb79f851385d21aefb17 100644 (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;
index eb65bcde166faa6533192575ccfe3eeb95eb725c..3a9c071b37999380e42a983f2584d675b5aa6740 100644 (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;
index 84d73f57292bc87c49a8d3e7cf1c63cce1a54b52..41bcfed08260809990a6896be61813a21bd3a280 100644 (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),
index 8ea44c6595efa7ce7f9bc7560b7351832668a573..2317717935e9f96d2df9985771b1f7aa9650af07 100644 (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);
index 66cb161667af5157fd397dfb46dbf14370e9287a..20739072f21ad616bf3d6476201043f12333377e 100644 (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");
 }
index 9b2ccf0c9a8ca422d8fee97d207096565f766046..e9cb874f6891b012fd7d3a1eb8f35892e772614c 100644 (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:
index 0d6a716d281eefa2afb24ff59ba0b7096ef5d0cc..93c77dd9a4764de9f90af12b8a4c487f617847ef 100644 (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;
index 5d840bc6963916854e048b1dd0dbb67a0f5c2c7b..66f48bd6da76c9622e550d300559fa49082e73ac 100644 (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 &&
index b7f0ff80efe260af5c9b3631ce6aa2862e2d5077..a6bb2600a2d73dd18cf544ed3376a54e40b7cea0 100644 (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)
index 57f0ca00ddda83696482abb71325cf1e8bc6dd3b..bd8eb6033bf404f2b86ed8c20779c159feaf345c 100644 (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)
index 4e2a8f2a30451a1c0e83131145a6deea41de03be..e7986b9babafe46b4ddffb6170ec0815de12ec8a 100644 (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)
 {
index d5c17775c3b427058396a71161875cec9fc0c09d..e9dd5477ca7a43f35fc52f06d0067beac91299fd 100644 (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 */
index f624969a4f14a34e15b195ef72f013953b8a2970..428cca71c2bad67e710012173892fbfe48446708 100644 (file)
                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))