diff options
author | Hannes Reinecke <hare@suse.de> | 2014-10-24 08:27:00 -0400 |
---|---|---|
committer | Christoph Hellwig <hch@lst.de> | 2014-11-12 05:16:05 -0500 |
commit | ef61329db7b8b4326b1c4e603806b2754fd2a692 (patch) | |
tree | e896200f74ce9205ff1cae9405af268a3ccb76c4 /drivers/scsi/sd.c | |
parent | 3cc958cc19278de5fa090f3f7f1ed48b0170980a (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>
Diffstat (limited to 'drivers/scsi/sd.c')
-rw-r--r-- | drivers/scsi/sd.c | 50 |
1 files changed, 26 insertions, 24 deletions
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); | |||
116 | static void sd_read_capacity(struct scsi_disk *sdkp, unsigned char *buffer); | 116 | static void sd_read_capacity(struct scsi_disk *sdkp, unsigned char *buffer); |
117 | static void scsi_disk_release(struct device *cdev); | 117 | static void scsi_disk_release(struct device *cdev); |
118 | static void sd_print_sense_hdr(struct scsi_disk *, struct scsi_sense_hdr *); | 118 | static void sd_print_sense_hdr(struct scsi_disk *, struct scsi_sense_hdr *); |
119 | static void sd_print_result(struct scsi_disk *, int); | 119 | static void sd_print_result(const struct scsi_disk *, const char *, int); |
120 | 120 | ||
121 | static DEFINE_SPINLOCK(sd_index_lock); | 121 | static DEFINE_SPINLOCK(sd_index_lock); |
122 | static DEFINE_IDA(sd_index_ida); | 122 | static 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 | ||
3346 | static void sd_print_result(struct scsi_disk *sdkp, int result) | 3337 | static 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 | ||