scsi: use sdev as argument for sense code printing
authorHannes Reinecke <hare@suse.de>
Fri, 24 Oct 2014 12:26:45 +0000 (14:26 +0200)
committerChristoph Hellwig <hch@lst.de>
Wed, 12 Nov 2014 10:15:58 +0000 (11:15 +0100)
We should be using the standard dev_printk() variants for
sense code printing.

[hch: remove __scsi_print_sense call in xen-scsiback, Acked by Juergen]
[hch: folded bracing fix from Dan Carpenter]
Signed-off-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Robert Elliott <elliott@hp.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
18 files changed:
drivers/scsi/53c700.c
drivers/scsi/ch.c
drivers/scsi/constants.c
drivers/scsi/osst.c
drivers/scsi/scsi.c
drivers/scsi/scsi_error.c
drivers/scsi/scsi_ioctl.c
drivers/scsi/scsi_lib.c
drivers/scsi/sd.c
drivers/scsi/sg.c
drivers/scsi/sr_ioctl.c
drivers/scsi/st.c
drivers/scsi/storvsc_drv.c
drivers/scsi/ufs/ufshcd.c
drivers/usb/storage/debug.c
drivers/xen/xen-scsiback.c
include/scsi/scsi_dbg.h
include/scsi/scsi_eh.h

index fabd4be2c98552a7760b8c87d72891086b60dbf4..68bf423008a4a317627143df33e09495705e0720 100644 (file)
@@ -602,7 +602,7 @@ NCR_700_scsi_done(struct NCR_700_Host_Parameters *hostdata,
 #ifdef NCR_700_DEBUG
                        printk(" ORIGINAL CMD %p RETURNED %d, new return is %d sense is\n",
                               SCp, SCp->cmnd[7], result);
-                       scsi_print_sense("53c700", SCp);
+                       scsi_print_sense(SCp);
 
 #endif
                        dma_unmap_single(hostdata->dev, slot->dma_handle,
index 52060e72b75d8a2b1a3090569ecd47ad84177a40..53621a34c5f91a2a24a5721cccee4b25394de45f 100644 (file)
@@ -206,7 +206,7 @@ ch_do_scsi(scsi_changer *ch, unsigned char *cmd,
        DPRINTK("result: 0x%x\n",result);
        if (driver_byte(result) & DRIVER_SENSE) {
                if (debug)
-                       scsi_print_sense_hdr(ch->name, &sshdr);
+                       scsi_print_sense_hdr(ch->device, ch->name, &sshdr);
                errno = ch_find_errno(&sshdr);
 
                switch(sshdr.sense_key) {
index 2f447075adbbc23eb152a91b1fcabc8e2e3ec668..9065b6f8f51b421d5e805d0b3c6fd620dbb2442c 100644 (file)
@@ -1292,18 +1292,19 @@ static const struct error_info additional[] =
 
 struct error_info2 {
        unsigned char code1, code2_min, code2_max;
+       const char * str;
        const char * fmt;
 };
 
 static const struct error_info2 additional2[] =
 {
-       {0x40, 0x00, 0x7f, "Ram failure (%x)"},
-       {0x40, 0x80, 0xff, "Diagnostic failure on component (%x)"},
-       {0x41, 0x00, 0xff, "Data path failure (%x)"},
-       {0x42, 0x00, 0xff, "Power-on or self-test failure (%x)"},
-       {0x4D, 0x00, 0xff, "Tagged overlapped commands (task tag %x)"},
-       {0x70, 0x00, 0xff, "Decompression exception short algorithm id of %x"},
-       {0, 0, 0, NULL}
+       {0x40, 0x00, 0x7f, "Ram failure", ""},
+       {0x40, 0x80, 0xff, "Diagnostic failure on component", ""},
+       {0x41, 0x00, 0xff, "Data path failure", ""},
+       {0x42, 0x00, 0xff, "Power-on or self-test failure", ""},
+       {0x4D, 0x00, 0xff, "Tagged overlapped commands", "task tag "},
+       {0x70, 0x00, 0xff, "Decompression exception", "short algorithm id of "},
+       {0, 0, 0, NULL, NULL}
 };
 
 /* description of the sense key values */
@@ -1349,7 +1350,8 @@ EXPORT_SYMBOL(scsi_sense_key_string);
  * This string may contain a "%x" and should be printed with ascq as arg.
  */
 const char *
-scsi_extd_sense_format(unsigned char asc, unsigned char ascq) {
+scsi_extd_sense_format(unsigned char asc, unsigned char ascq, const char **fmt)
+{
 #ifdef CONFIG_SCSI_CONSTANTS
        int i;
        unsigned short code = ((asc << 8) | ascq);
@@ -1360,8 +1362,10 @@ scsi_extd_sense_format(unsigned char asc, unsigned char ascq) {
        for (i = 0; additional2[i].fmt; i++) {
                if (additional2[i].code1 == asc &&
                    ascq >= additional2[i].code2_min &&
-                   ascq <= additional2[i].code2_max)
-                       return additional2[i].fmt;
+                   ascq <= additional2[i].code2_max) {
+                       *fmt = additional2[i].fmt;
+                       return additional2[i].str;
+               }
        }
 #endif
        return NULL;
@@ -1369,49 +1373,53 @@ scsi_extd_sense_format(unsigned char asc, unsigned char ascq) {
 EXPORT_SYMBOL(scsi_extd_sense_format);
 
 void
-scsi_show_extd_sense(unsigned char asc, unsigned char ascq)
+scsi_show_extd_sense(const struct scsi_device *sdev, const char *name,
+                    unsigned char asc, unsigned char ascq)
 {
-        const char *extd_sense_fmt = scsi_extd_sense_format(asc, ascq);
+       const char *extd_sense_fmt = NULL;
+       const char *extd_sense_str = scsi_extd_sense_format(asc, ascq,
+                                                           &extd_sense_fmt);
+
+       if (extd_sense_str) {
+               if (extd_sense_fmt)
+                       sdev_prefix_printk(KERN_INFO, sdev, name,
+                                          "Add. Sense: %s (%s%x)",
+                                          extd_sense_str, extd_sense_fmt,
+                                          ascq);
+               else
+                       sdev_prefix_printk(KERN_INFO, sdev, name,
+                                          "Add. Sense: %s", extd_sense_str);
 
-       if (extd_sense_fmt) {
-               if (strstr(extd_sense_fmt, "%x")) {
-                       printk("Add. Sense: ");
-                       printk(extd_sense_fmt, ascq);
-               } else
-                       printk("Add. Sense: %s", extd_sense_fmt);
        } else {
-               if (asc >= 0x80)
-                       printk("<<vendor>> ASC=0x%x ASCQ=0x%x", asc,
-                              ascq);
-               if (ascq >= 0x80)
-                       printk("ASC=0x%x <<vendor>> ASCQ=0x%x", asc,
-                              ascq);
-               else
-                       printk("ASC=0x%x ASCQ=0x%x", asc, ascq);
+               sdev_prefix_printk(KERN_INFO, sdev, name,
+                                  "%sASC=0x%x %sASCQ=0x%x\n",
+                                  asc >= 0x80 ? "<<vendor>> " : "", asc,
+                                  ascq >= 0x80 ? "<<vendor>> " : "", ascq);
        }
-
-       printk("\n");
 }
 EXPORT_SYMBOL(scsi_show_extd_sense);
 
 void
-scsi_show_sense_hdr(struct scsi_sense_hdr *sshdr)
+scsi_show_sense_hdr(const struct scsi_device *sdev, const char *name,
+                   const struct scsi_sense_hdr *sshdr)
 {
        const char *sense_txt;
 
        sense_txt = scsi_sense_key_string(sshdr->sense_key);
        if (sense_txt)
-               printk("Sense Key : %s ", sense_txt);
+               sdev_prefix_printk(KERN_INFO, sdev, name,
+                                  "Sense Key : %s [%s]%s\n", sense_txt,
+                                  scsi_sense_is_deferred(sshdr) ?
+                                  "deferred" : "current",
+                                  sshdr->response_code >= 0x72 ?
+                                  " [descriptor]" : "");
        else
-               printk("Sense Key : 0x%x ", sshdr->sense_key);
-
-       printk("%s", scsi_sense_is_deferred(sshdr) ? "[deferred] " :
-              "[current] ");
-
-       if (sshdr->response_code >= 0x72)
-               printk("[descriptor]");
-
-       printk("\n");
+               sdev_prefix_printk(KERN_INFO, sdev, name,
+                                  "Sense Key : 0x%x [%s]%s", sshdr->sense_key,
+                                  scsi_sense_is_deferred(sshdr) ?
+                                  "deferred" : "current",
+                                  sshdr->response_code >= 0x72 ?
+                                  " [descriptor]" : "");
 }
 EXPORT_SYMBOL(scsi_show_sense_hdr);
 
@@ -1419,12 +1427,11 @@ EXPORT_SYMBOL(scsi_show_sense_hdr);
  * Print normalized SCSI sense header with a prefix.
  */
 void
-scsi_print_sense_hdr(const char *name, struct scsi_sense_hdr *sshdr)
+scsi_print_sense_hdr(const struct scsi_device *sdev, const char *name,
+                    const struct scsi_sense_hdr *sshdr)
 {
-       printk(KERN_INFO "%s: ", name);
-       scsi_show_sense_hdr(sshdr);
-       printk(KERN_INFO "%s: ", name);
-       scsi_show_extd_sense(sshdr->asc, sshdr->ascq);
+       scsi_show_sense_hdr(sdev, name, sshdr);
+       scsi_show_extd_sense(sdev, name, sshdr->asc, sshdr->ascq);
 }
 EXPORT_SYMBOL(scsi_print_sense_hdr);
 
@@ -1513,33 +1520,26 @@ scsi_decode_sense_extras(const unsigned char *sense_buffer, int sense_len,
 }
 
 /* Normalize and print sense buffer with name prefix */
-void __scsi_print_sense(const char *name, const unsigned char *sense_buffer,
-                       int sense_len)
+void __scsi_print_sense(const struct scsi_device *sdev, const char *name,
+                       const unsigned char *sense_buffer, int sense_len)
 {
        struct scsi_sense_hdr sshdr;
 
-       printk(KERN_INFO "%s: ", name);
        scsi_decode_sense_buffer(sense_buffer, sense_len, &sshdr);
-       scsi_show_sense_hdr(&sshdr);
+       scsi_show_sense_hdr(sdev, name, &sshdr);
        scsi_decode_sense_extras(sense_buffer, sense_len, &sshdr);
-       printk(KERN_INFO "%s: ", name);
-       scsi_show_extd_sense(sshdr.asc, sshdr.ascq);
+       scsi_show_extd_sense(sdev, name, sshdr.asc, sshdr.ascq);
 }
 EXPORT_SYMBOL(__scsi_print_sense);
 
 /* Normalize and print sense buffer in SCSI command */
-void scsi_print_sense(char *name, struct scsi_cmnd *cmd)
+void scsi_print_sense(const struct scsi_cmnd *cmd)
 {
-       struct scsi_sense_hdr sshdr;
+       struct gendisk *disk = cmd->request->rq_disk;
+       const char *disk_name = disk ? disk->disk_name : NULL;
 
-       scmd_printk(KERN_INFO, cmd, " ");
-       scsi_decode_sense_buffer(cmd->sense_buffer, SCSI_SENSE_BUFFERSIZE,
-                                &sshdr);
-       scsi_show_sense_hdr(&sshdr);
-       scsi_decode_sense_extras(cmd->sense_buffer, SCSI_SENSE_BUFFERSIZE,
-                                &sshdr);
-       scmd_printk(KERN_INFO, cmd, " ");
-       scsi_show_extd_sense(sshdr.asc, sshdr.ascq);
+       __scsi_print_sense(cmd->device, disk_name, cmd->sense_buffer,
+                          SCSI_SENSE_BUFFERSIZE);
 }
 EXPORT_SYMBOL(scsi_print_sense);
 
index dff37a250d7906ab7c203099e6938bd197d1bb04..3d0d13c4da15959f0910854f53c0c61328c45f45 100644 (file)
@@ -259,9 +259,10 @@ static int osst_chk_result(struct osst_tape * STp, struct osst_request * SRpnt)
                   SRpnt->cmd[0], SRpnt->cmd[1], SRpnt->cmd[2],
                   SRpnt->cmd[3], SRpnt->cmd[4], SRpnt->cmd[5]);
                if (scode) printk(OSST_DEB_MSG "%s:D: Sense: %02x, ASC: %02x, ASCQ: %02x\n",
-                               name, scode, sense[12], sense[13]);
+                                 name, scode, sense[12], sense[13]);
                if (cmdstatp->have_sense)
-                       __scsi_print_sense("osst ", SRpnt->sense, SCSI_SENSE_BUFFERSIZE);
+                       __scsi_print_sense(STp->device, name,
+                                          SRpnt->sense, SCSI_SENSE_BUFFERSIZE);
        }
        else
 #endif
@@ -275,7 +276,8 @@ static int osst_chk_result(struct osst_tape * STp, struct osst_request * SRpnt)
                 SRpnt->cmd[0] != TEST_UNIT_READY)) { /* Abnormal conditions for tape */
                if (cmdstatp->have_sense) {
                        printk(KERN_WARNING "%s:W: Command with sense data:\n", name);
-                       __scsi_print_sense("osst ", SRpnt->sense, SCSI_SENSE_BUFFERSIZE);
+                       __scsi_print_sense(STp->device, name,
+                                          SRpnt->sense, SCSI_SENSE_BUFFERSIZE);
                }
                else {
                        static  int     notyetprinted = 1;
index 79c77b485a67298ed5fb912fe86c33813732157b..32eaac03cf4e4fcf4d08506069c3e9a0e9eebb99 100644 (file)
@@ -606,7 +606,7 @@ void scsi_log_completion(struct scsi_cmnd *cmd, int disposition)
                        scsi_print_result(cmd);
                        scsi_print_command(cmd);
                        if (status_byte(cmd->result) & CHECK_CONDITION)
-                               scsi_print_sense("", cmd);
+                               scsi_print_sense(cmd);
                        if (level > 3)
                                scmd_printk(KERN_INFO, cmd,
                                            "scsi host busy %d failed %d\n",
index 0ed666112b4f5add196279dc48909453899d5dc4..0084f0b21a91b5fd77313826baefca925fab5e50 100644 (file)
@@ -1180,7 +1180,7 @@ int scsi_eh_get_sense(struct list_head *work_q,
                SCSI_LOG_ERROR_RECOVERY(3, scmd_printk(KERN_INFO, scmd,
                        "sense requested for %p result %x\n",
                        scmd, scmd->result));
-               SCSI_LOG_ERROR_RECOVERY(3, scsi_print_sense("bh", scmd));
+               SCSI_LOG_ERROR_RECOVERY(3, scsi_print_sense(scmd));
 
                rtn = scsi_decide_disposition(scmd);
 
index 12fe676d13433e68a9afab7515877a1dfc37596e..5207274574f5f3a75ecebfd6ff3893cda21daa7a 100644 (file)
@@ -126,7 +126,7 @@ static int ioctl_internal_command(struct scsi_device *sdev, char *cmd,
                        sdev_printk(KERN_INFO, sdev,
                                    "ioctl_internal_command return code = %x\n",
                                    result);
-                       scsi_print_sense_hdr("   ", &sshdr);
+                       scsi_print_sense_hdr(sdev, NULL, &sshdr);
                        break;
                }
        }
index 389bc6fd19aed0d1f0506d88f26caacb42d8e908..3c96e3923520d38ed12971b2cff610ae9a1a69f1 100644 (file)
@@ -912,7 +912,7 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes)
                if ((sshdr.asc == 0x0) && (sshdr.ascq == 0x1d))
                        ;
                else if (!(req->cmd_flags & REQ_QUIET))
-                       scsi_print_sense("", cmd);
+                       scsi_print_sense(cmd);
                result = 0;
                /* BLOCK_PC may have set error */
                error = 0;
@@ -1041,7 +1041,7 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes)
                if (!(req->cmd_flags & REQ_QUIET)) {
                        scsi_print_result(cmd);
                        if (driver_byte(result) & DRIVER_SENSE)
-                               scsi_print_sense("", cmd);
+                               scsi_print_sense(cmd);
                        scsi_print_command(cmd);
                }
                if (!scsi_end_request(req, error, blk_rq_err_bytes(req), 0))
index 52b40b1e8c4521f29bafc841326cc84d53338697..3ae75402809a7dcf1d132077092928202a9403f6 100644 (file)
@@ -3336,10 +3336,11 @@ module_exit(exit_sd);
 static void sd_print_sense_hdr(struct scsi_disk *sdkp,
                               struct scsi_sense_hdr *sshdr)
 {
-       sd_printk(KERN_INFO, sdkp, " ");
-       scsi_show_sense_hdr(sshdr);
-       sd_printk(KERN_INFO, sdkp, " ");
-       scsi_show_extd_sense(sshdr->asc, sshdr->ascq);
+       scsi_show_sense_hdr(sdkp->device,
+                           sdkp->disk ? sdkp->disk->disk_name : NULL, sshdr);
+       scsi_show_extd_sense(sdkp->device,
+                            sdkp->disk ? sdkp->disk->disk_name : NULL,
+                            sshdr->asc, sshdr->ascq);
 }
 
 static void sd_print_result(struct scsi_disk *sdkp, int result)
index 55cbc6689d2780bb8c4d0e2ca4da94f6ccc3f76f..2fe2701d86dba6c95a1bb9679e3c9cc99b54cef2 100644 (file)
@@ -1365,7 +1365,7 @@ sg_rq_end_io(struct request *rq, int uptodate)
                if ((sdp->sgdebug > 0) &&
                    ((CHECK_CONDITION == srp->header.masked_status) ||
                     (COMMAND_TERMINATED == srp->header.masked_status)))
-                       __scsi_print_sense(__func__, sense,
+                       __scsi_print_sense(sdp->device, __func__, sense,
                                           SCSI_SENSE_BUFFERSIZE);
 
                /* Following if statement is a patch supplied by Eric Youngdale */
index 6389fcff12ecf6896a3da469748bcfb5edc4cbe3..17e0c2b28a99cc2eaee4ecb074c33289f1bcaed7 100644 (file)
@@ -246,7 +246,7 @@ int sr_do_ioctl(Scsi_CD *cd, struct packet_command *cgc)
                                          "CDROM not ready.  Make sure there "
                                          "is a disc in the drive.\n");
 #ifdef DEBUG
-                       scsi_print_sense_hdr("sr", &sshdr);
+                       scsi_print_sense_hdr(cd->device, cd->cdi.name, &sshdr);
 #endif
                        err = -ENOMEDIUM;
                        break;
@@ -258,14 +258,14 @@ int sr_do_ioctl(Scsi_CD *cd, struct packet_command *cgc)
                                err = -EDRIVE_CANT_DO_THIS;
 #ifdef DEBUG
                        __scsi_print_command(cgc->cmd);
-                       scsi_print_sense_hdr("sr", &sshdr);
+                       scsi_print_sense_hdr(cd->device, cd->cdi.name, &sshdr);
 #endif
                        break;
                default:
                        sr_printk(KERN_ERR, cd,
                                  "CDROM (ioctl) error, command: ");
                        __scsi_print_command(cgc->cmd);
-                       scsi_print_sense_hdr("sr", &sshdr);
+                       scsi_print_sense_hdr(cd->device, cd->cdi.name, &sshdr);
                        err = -EIO;
                }
        }
index 36ab023793ca1e0c57f24fbe3b301326c77cf34b..63c35ed3c88dc8acfe0e5d944f0d104dfa88797e 100644 (file)
@@ -381,7 +381,8 @@ static int st_chk_result(struct scsi_tape *STp, struct st_request * SRpnt)
                            SRpnt->cmd[0], SRpnt->cmd[1], SRpnt->cmd[2],
                            SRpnt->cmd[3], SRpnt->cmd[4], SRpnt->cmd[5]);
                if (cmdstatp->have_sense)
-                        __scsi_print_sense(name, SRpnt->sense, SCSI_SENSE_BUFFERSIZE);
+                       __scsi_print_sense(STp->device, name,
+                                          SRpnt->sense, SCSI_SENSE_BUFFERSIZE);
        } ) /* end DEB */
        if (!debugging) { /* Abnormal conditions for tape */
                if (!cmdstatp->have_sense)
@@ -397,7 +398,8 @@ static int st_chk_result(struct scsi_tape *STp, struct st_request * SRpnt)
                         SRpnt->cmd[0] != MODE_SENSE &&
                         SRpnt->cmd[0] != TEST_UNIT_READY) {
 
-                       __scsi_print_sense(name, SRpnt->sense, SCSI_SENSE_BUFFERSIZE);
+                       __scsi_print_sense(STp->device, name,
+                                          SRpnt->sense, SCSI_SENSE_BUFFERSIZE);
                }
        }
 
index 733e5f75951877f6884ce78c0295bf56540114b4..37f5fd8ed7654ead94a59bb3320fde43bc9734d2 100644 (file)
@@ -1097,7 +1097,8 @@ static void storvsc_command_completion(struct storvsc_cmd_request *cmd_request)
        if (scmnd->result) {
                if (scsi_normalize_sense(scmnd->sense_buffer,
                                SCSI_SENSE_BUFFERSIZE, &sense_hdr))
-                       scsi_print_sense_hdr("storvsc", &sense_hdr);
+                       scsi_print_sense_hdr(scmnd->device, "storvsc",
+                                            &sense_hdr);
        }
 
        if (vm_srb->srb_status != SRB_STATUS_SUCCESS)
index 497c38a4a86615178e367e40666937e2d969b41f..eb3997ed8e736ba70d4d843efbdffbeeee43b8aa 100644 (file)
@@ -4710,8 +4710,8 @@ static int ufshcd_set_dev_pwr_mode(struct ufs_hba *hba,
                          "START_STOP failed for power mode: %d\n", pwr_mode);
                scsi_show_result(ret);
                if (driver_byte(ret) & DRIVER_SENSE) {
-                       scsi_show_sense_hdr(&sshdr);
-                       scsi_show_extd_sense(sshdr.asc, sshdr.ascq);
+                       scsi_show_sense_hdr(sdp, NULL, &sshdr);
+                       scsi_show_extd_sense(sdp, NULL, sshdr.asc, sshdr.ascq);
                }
        }
 
index e08f64780e30fb3af660b7066cc14b1f6181417a..66a684a299384bef5089a0fad2770d2af48ba14d 100644 (file)
@@ -164,10 +164,10 @@ void usb_stor_show_sense(const struct us_data *us,
                         unsigned char asc,
                         unsigned char ascq)
 {
-       const char *what, *keystr;
+       const char *what, *keystr, *fmt;
 
        keystr = scsi_sense_key_string(key);
-       what = scsi_extd_sense_format(asc, ascq);
+       what = scsi_extd_sense_format(asc, ascq, &fmt);
 
        if (keystr == NULL)
                keystr = "(Unknown Key)";
@@ -175,8 +175,10 @@ void usb_stor_show_sense(const struct us_data *us,
                what = "(unknown ASC/ASCQ)";
 
        usb_stor_dbg(us, "%s: ", keystr);
-       US_DEBUGPX(what, ascq);
-       US_DEBUGPX("\n");
+       if (fmt)
+               US_DEBUGPX("%s (%s%x)\n", what, fmt, ascq);
+       else
+               US_DEBUGPX("%s\n", what);
 }
 
 int usb_stor_dbg(const struct us_data *us, const char *fmt, ...)
index 3e32146472a52c535e48cbfdae294c62985e8862..50610a6acf3d313aec4c106fb6ae3837bdd31ca5 100644 (file)
@@ -274,10 +274,6 @@ static void scsiback_print_status(char *sense_buffer, int errors,
               tpg->tport->tport_name, pending_req->v2p->lun,
               pending_req->cmnd[0], status_byte(errors), msg_byte(errors),
               host_byte(errors), driver_byte(errors));
-
-       if (CHECK_CONDITION & status_byte(errors))
-               __scsi_print_sense("xen-pvscsi", sense_buffer,
-                                  SCSI_SENSE_BUFFERSIZE);
 }
 
 static void scsiback_fast_flush_area(struct vscsibk_pend *req)
index 5a43a4cd96c6f6ea9f11d9818fb4e4c5780046a5..6cbd179a17cc9acbc133316d97b0f5da7feae03f 100644 (file)
@@ -2,21 +2,26 @@
 #define _SCSI_SCSI_DBG_H
 
 struct scsi_cmnd;
+struct scsi_device;
 struct scsi_sense_hdr;
 
 extern void scsi_print_command(struct scsi_cmnd *);
 extern void __scsi_print_command(unsigned char *);
-extern void scsi_show_extd_sense(unsigned char, unsigned char);
-extern void scsi_show_sense_hdr(struct scsi_sense_hdr *);
-extern void scsi_print_sense_hdr(const char *, struct scsi_sense_hdr *);
-extern void scsi_print_sense(char *, struct scsi_cmnd *);
-extern void __scsi_print_sense(const char *name,
+extern void scsi_show_extd_sense(const struct scsi_device *, const char *,
+                                unsigned char, unsigned char);
+extern void scsi_show_sense_hdr(const struct scsi_device *, const char *,
+                               const struct scsi_sense_hdr *);
+extern void scsi_print_sense_hdr(const struct scsi_device *, const char *,
+                                const struct scsi_sense_hdr *);
+extern void scsi_print_sense(const struct scsi_cmnd *);
+extern void __scsi_print_sense(const struct scsi_device *, const char *name,
                               const unsigned char *sense_buffer,
                               int sense_len);
 extern void scsi_show_result(int);
 extern void scsi_print_result(struct scsi_cmnd *);
 extern void scsi_print_status(unsigned char);
 extern const char *scsi_sense_key_string(unsigned char);
-extern const char *scsi_extd_sense_format(unsigned char, unsigned char);
+extern const char *scsi_extd_sense_format(unsigned char, unsigned char,
+                                         const char **);
 
 #endif /* _SCSI_SCSI_DBG_H */
index 49af14ad5288c6dcc916db2d8f697f9fc54401fb..5e598f01143cd703e50da9ec574250cea98756c4 100644 (file)
@@ -47,7 +47,7 @@ extern int scsi_normalize_sense(const u8 *sense_buffer, int sb_len,
 extern int scsi_command_normalize_sense(struct scsi_cmnd *cmd,
                struct scsi_sense_hdr *sshdr);
 
-static inline int scsi_sense_is_deferred(struct scsi_sense_hdr *sshdr)
+static inline int scsi_sense_is_deferred(const struct scsi_sense_hdr *sshdr)
 {
        return ((sshdr->response_code >= 0x70) && (sshdr->response_code & 1));
 }