aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHannes Reinecke <hare@suse.de>2014-10-24 08:27:00 -0400
committerChristoph Hellwig <hch@lst.de>2014-11-12 05:16:05 -0500
commitef61329db7b8b4326b1c4e603806b2754fd2a692 (patch)
treee896200f74ce9205ff1cae9405af268a3ccb76c4
parent3cc958cc19278de5fa090f3f7f1ed48b0170980a (diff)
scsi: remove scsi_show_result()
Open-code scsi_print_result in sd.c, and cleanup logging to not print duplicate informations. Also remove the call to scsi_show_result() in ufshcd.c to be consistent with other callers of scsi_execute(). With that we can remove scsi_show_result in constants.c Signed-off-by: Hannes Reinecke <hare@suse.de> Reviewed-by: Robert Elliott <elliott@hp.com> Signed-off-by: Christoph Hellwig <hch@lst.de>
-rw-r--r--drivers/scsi/constants.c16
-rw-r--r--drivers/scsi/sd.c50
-rw-r--r--drivers/scsi/ufs/ufshcd.c4
-rw-r--r--include/scsi/scsi_dbg.h1
4 files changed, 28 insertions, 43 deletions
diff --git a/drivers/scsi/constants.c b/drivers/scsi/constants.c
index 541a8620929c..2893464129b5 100644
--- a/drivers/scsi/constants.c
+++ b/drivers/scsi/constants.c
@@ -1440,22 +1440,6 @@ const char *scsi_driverbyte_string(int result)
1440} 1440}
1441EXPORT_SYMBOL(scsi_driverbyte_string); 1441EXPORT_SYMBOL(scsi_driverbyte_string);
1442 1442
1443void scsi_show_result(int result)
1444{
1445 const char *hb_string = scsi_hostbyte_string(result);
1446 const char *db_string = scsi_driverbyte_string(result);
1447
1448 if (hb_string || db_string)
1449 printk("Result: hostbyte=%s driverbyte=%s\n",
1450 hb_string ? hb_string : "invalid",
1451 db_string ? db_string : "invalid");
1452 else
1453 printk("Result: hostbyte=0x%02x driverbyte=0x%02x\n",
1454 host_byte(result), driver_byte(result));
1455}
1456EXPORT_SYMBOL(scsi_show_result);
1457
1458
1459void scsi_print_result(struct scsi_cmnd *cmd) 1443void scsi_print_result(struct scsi_cmnd *cmd)
1460{ 1444{
1461 const char *hb_string = scsi_hostbyte_string(cmd->result); 1445 const char *hb_string = scsi_hostbyte_string(cmd->result);
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index 3ae75402809a..242f9b177285 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -116,7 +116,7 @@ static int sd_eh_action(struct scsi_cmnd *, int);
116static void sd_read_capacity(struct scsi_disk *sdkp, unsigned char *buffer); 116static void sd_read_capacity(struct scsi_disk *sdkp, unsigned char *buffer);
117static void scsi_disk_release(struct device *cdev); 117static void scsi_disk_release(struct device *cdev);
118static void sd_print_sense_hdr(struct scsi_disk *, struct scsi_sense_hdr *); 118static void sd_print_sense_hdr(struct scsi_disk *, struct scsi_sense_hdr *);
119static void sd_print_result(struct scsi_disk *, int); 119static void sd_print_result(const struct scsi_disk *, const char *, int);
120 120
121static DEFINE_SPINLOCK(sd_index_lock); 121static DEFINE_SPINLOCK(sd_index_lock);
122static DEFINE_IDA(sd_index_ida); 122static DEFINE_IDA(sd_index_ida);
@@ -1492,7 +1492,7 @@ static int sd_sync_cache(struct scsi_disk *sdkp)
1492 } 1492 }
1493 1493
1494 if (res) { 1494 if (res) {
1495 sd_print_result(sdkp, res); 1495 sd_print_result(sdkp, "Synchronize Cache(10) failed", res);
1496 1496
1497 if (driver_byte(res) & DRIVER_SENSE) 1497 if (driver_byte(res) & DRIVER_SENSE)
1498 sd_print_sense_hdr(sdkp, &sshdr); 1498 sd_print_sense_hdr(sdkp, &sshdr);
@@ -1713,17 +1713,6 @@ static int sd_done(struct scsi_cmnd *SCpnt)
1713 if (sense_valid) 1713 if (sense_valid)
1714 sense_deferred = scsi_sense_is_deferred(&sshdr); 1714 sense_deferred = scsi_sense_is_deferred(&sshdr);
1715 } 1715 }
1716#ifdef CONFIG_SCSI_LOGGING
1717 SCSI_LOG_HLCOMPLETE(1, scsi_print_result(SCpnt));
1718 if (sense_valid) {
1719 SCSI_LOG_HLCOMPLETE(1, scmd_printk(KERN_INFO, SCpnt,
1720 "sd_done: sb[respc,sk,asc,"
1721 "ascq]=%x,%x,%x,%x\n",
1722 sshdr.response_code,
1723 sshdr.sense_key, sshdr.asc,
1724 sshdr.ascq));
1725 }
1726#endif
1727 sdkp->medium_access_timed_out = 0; 1716 sdkp->medium_access_timed_out = 0;
1728 1717
1729 if (driver_byte(result) != DRIVER_SENSE && 1718 if (driver_byte(result) != DRIVER_SENSE &&
@@ -1778,6 +1767,10 @@ static int sd_done(struct scsi_cmnd *SCpnt)
1778 break; 1767 break;
1779 } 1768 }
1780 out: 1769 out:
1770 SCSI_LOG_HLCOMPLETE(1, scmd_printk(KERN_INFO, SCpnt,
1771 "sd_done: completed %d of %d bytes\n",
1772 good_bytes, scsi_bufflen(SCpnt)));
1773
1781 if (rq_data_dir(SCpnt->request) == READ && scsi_prot_sg_count(SCpnt)) 1774 if (rq_data_dir(SCpnt->request) == READ && scsi_prot_sg_count(SCpnt))
1782 sd_dif_complete(SCpnt, good_bytes); 1775 sd_dif_complete(SCpnt, good_bytes);
1783 1776
@@ -1833,12 +1826,12 @@ sd_spinup_disk(struct scsi_disk *sdkp)
1833 /* no sense, TUR either succeeded or failed 1826 /* no sense, TUR either succeeded or failed
1834 * with a status error */ 1827 * with a status error */
1835 if(!spintime && !scsi_status_is_good(the_result)) { 1828 if(!spintime && !scsi_status_is_good(the_result)) {
1836 sd_printk(KERN_NOTICE, sdkp, "Unit Not Ready\n"); 1829 sd_print_result(sdkp, "Test Unit Ready failed",
1837 sd_print_result(sdkp, the_result); 1830 the_result);
1838 } 1831 }
1839 break; 1832 break;
1840 } 1833 }
1841 1834
1842 /* 1835 /*
1843 * The device does not want the automatic start to be issued. 1836 * The device does not want the automatic start to be issued.
1844 */ 1837 */
@@ -1954,7 +1947,6 @@ static void read_capacity_error(struct scsi_disk *sdkp, struct scsi_device *sdp,
1954 struct scsi_sense_hdr *sshdr, int sense_valid, 1947 struct scsi_sense_hdr *sshdr, int sense_valid,
1955 int the_result) 1948 int the_result)
1956{ 1949{
1957 sd_print_result(sdkp, the_result);
1958 if (driver_byte(the_result) & DRIVER_SENSE) 1950 if (driver_byte(the_result) & DRIVER_SENSE)
1959 sd_print_sense_hdr(sdkp, sshdr); 1951 sd_print_sense_hdr(sdkp, sshdr);
1960 else 1952 else
@@ -2035,7 +2027,7 @@ static int read_capacity_16(struct scsi_disk *sdkp, struct scsi_device *sdp,
2035 } while (the_result && retries); 2027 } while (the_result && retries);
2036 2028
2037 if (the_result) { 2029 if (the_result) {
2038 sd_printk(KERN_NOTICE, sdkp, "READ CAPACITY(16) failed\n"); 2030 sd_print_result(sdkp, "Read Capacity(16) failed", the_result);
2039 read_capacity_error(sdkp, sdp, &sshdr, sense_valid, the_result); 2031 read_capacity_error(sdkp, sdp, &sshdr, sense_valid, the_result);
2040 return -EINVAL; 2032 return -EINVAL;
2041 } 2033 }
@@ -2117,7 +2109,7 @@ static int read_capacity_10(struct scsi_disk *sdkp, struct scsi_device *sdp,
2117 } while (the_result && retries); 2109 } while (the_result && retries);
2118 2110
2119 if (the_result) { 2111 if (the_result) {
2120 sd_printk(KERN_NOTICE, sdkp, "READ CAPACITY failed\n"); 2112 sd_print_result(sdkp, "Read Capacity(10) failed", the_result);
2121 read_capacity_error(sdkp, sdp, &sshdr, sense_valid, the_result); 2113 read_capacity_error(sdkp, sdp, &sshdr, sense_valid, the_result);
2122 return -EINVAL; 2114 return -EINVAL;
2123 } 2115 }
@@ -3141,8 +3133,7 @@ static int sd_start_stop_device(struct scsi_disk *sdkp, int start)
3141 res = scsi_execute_req_flags(sdp, cmd, DMA_NONE, NULL, 0, &sshdr, 3133 res = scsi_execute_req_flags(sdp, cmd, DMA_NONE, NULL, 0, &sshdr,
3142 SD_TIMEOUT, SD_MAX_RETRIES, NULL, REQ_PM); 3134 SD_TIMEOUT, SD_MAX_RETRIES, NULL, REQ_PM);
3143 if (res) { 3135 if (res) {
3144 sd_printk(KERN_WARNING, sdkp, "START_STOP FAILED\n"); 3136 sd_print_result(sdkp, "Start/Stop Unit failed", res);
3145 sd_print_result(sdkp, res);
3146 if (driver_byte(res) & DRIVER_SENSE) 3137 if (driver_byte(res) & DRIVER_SENSE)
3147 sd_print_sense_hdr(sdkp, &sshdr); 3138 sd_print_sense_hdr(sdkp, &sshdr);
3148 if (scsi_sense_valid(&sshdr) && 3139 if (scsi_sense_valid(&sshdr) &&
@@ -3343,9 +3334,20 @@ static void sd_print_sense_hdr(struct scsi_disk *sdkp,
3343 sshdr->asc, sshdr->ascq); 3334 sshdr->asc, sshdr->ascq);
3344} 3335}
3345 3336
3346static void sd_print_result(struct scsi_disk *sdkp, int result) 3337static void sd_print_result(const struct scsi_disk *sdkp, const char *msg,
3338 int result)
3347{ 3339{
3348 sd_printk(KERN_INFO, sdkp, " "); 3340 const char *hb_string = scsi_hostbyte_string(result);
3349 scsi_show_result(result); 3341 const char *db_string = scsi_driverbyte_string(result);
3342
3343 if (hb_string || db_string)
3344 sd_printk(KERN_INFO, sdkp,
3345 "%s: Result: hostbyte=%s driverbyte=%s\n", msg,
3346 hb_string ? hb_string : "invalid",
3347 db_string ? db_string : "invalid");
3348 else
3349 sd_printk(KERN_INFO, sdkp,
3350 "%s: Result: hostbyte=0x%02x driverbyte=0x%02x\n",
3351 msg, host_byte(result), driver_byte(result));
3350} 3352}
3351 3353
diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index eb3997ed8e73..9da319130da5 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -4707,8 +4707,8 @@ static int ufshcd_set_dev_pwr_mode(struct ufs_hba *hba,
4707 START_STOP_TIMEOUT, 0, NULL, REQ_PM); 4707 START_STOP_TIMEOUT, 0, NULL, REQ_PM);
4708 if (ret) { 4708 if (ret) {
4709 sdev_printk(KERN_WARNING, sdp, 4709 sdev_printk(KERN_WARNING, sdp,
4710 "START_STOP failed for power mode: %d\n", pwr_mode); 4710 "START_STOP failed for power mode: %d, result %x\n",
4711 scsi_show_result(ret); 4711 pwr_mode, ret);
4712 if (driver_byte(ret) & DRIVER_SENSE) { 4712 if (driver_byte(ret) & DRIVER_SENSE) {
4713 scsi_show_sense_hdr(sdp, NULL, &sshdr); 4713 scsi_show_sense_hdr(sdp, NULL, &sshdr);
4714 scsi_show_extd_sense(sdp, NULL, sshdr.asc, sshdr.ascq); 4714 scsi_show_extd_sense(sdp, NULL, sshdr.asc, sshdr.ascq);
diff --git a/include/scsi/scsi_dbg.h b/include/scsi/scsi_dbg.h
index 50f4d8542ece..f41a86bc1a8f 100644
--- a/include/scsi/scsi_dbg.h
+++ b/include/scsi/scsi_dbg.h
@@ -17,7 +17,6 @@ extern void scsi_print_sense(const struct scsi_cmnd *);
17extern void __scsi_print_sense(const struct scsi_device *, const char *name, 17extern void __scsi_print_sense(const struct scsi_device *, const char *name,
18 const unsigned char *sense_buffer, 18 const unsigned char *sense_buffer,
19 int sense_len); 19 int sense_len);
20extern void scsi_show_result(int);
21extern void scsi_print_result(struct scsi_cmnd *); 20extern void scsi_print_result(struct scsi_cmnd *);
22extern const char *scsi_hostbyte_string(int); 21extern const char *scsi_hostbyte_string(int);
23extern const char *scsi_driverbyte_string(int); 22extern const char *scsi_driverbyte_string(int);