diff options
author | James Bottomley <jejb@titanic.(none)> | 2005-08-28 12:33:52 -0400 |
---|---|---|
committer | James Bottomley <jejb@titanic.(none)> | 2005-08-28 12:33:52 -0400 |
commit | ea73a9f23906c374b697cd5b0d64f6dceced63de (patch) | |
tree | c000be3180caccc6d484aad0f82f58d733358622 /drivers/scsi/scsi_scan.c | |
parent | 33aa687db90dd8541bd5e9a762eebf880eaee767 (diff) |
[SCSI] convert sd to scsi_execute_req (and update the scsi_execute_req API)
This one removes struct scsi_request entirely from sd. In the process,
I noticed we have no callers of scsi_wait_req who don't immediately
normalise the sense, so I updated the API to make it take a struct
scsi_sense_hdr instead of simply a big sense buffer.
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi/scsi_scan.c')
-rw-r--r-- | drivers/scsi/scsi_scan.c | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c index 0048beaffc9f..19c9a232a754 100644 --- a/drivers/scsi/scsi_scan.c +++ b/drivers/scsi/scsi_scan.c | |||
@@ -446,7 +446,6 @@ void scsi_target_reap(struct scsi_target *starget) | |||
446 | static int scsi_probe_lun(struct scsi_device *sdev, char *inq_result, | 446 | static int scsi_probe_lun(struct scsi_device *sdev, char *inq_result, |
447 | int result_len, int *bflags) | 447 | int result_len, int *bflags) |
448 | { | 448 | { |
449 | char sense[SCSI_SENSE_BUFFERSIZE]; | ||
450 | unsigned char scsi_cmd[MAX_COMMAND_SIZE]; | 449 | unsigned char scsi_cmd[MAX_COMMAND_SIZE]; |
451 | int first_inquiry_len, try_inquiry_len, next_inquiry_len; | 450 | int first_inquiry_len, try_inquiry_len, next_inquiry_len; |
452 | int response_len = 0; | 451 | int response_len = 0; |
@@ -474,11 +473,10 @@ static int scsi_probe_lun(struct scsi_device *sdev, char *inq_result, | |||
474 | scsi_cmd[0] = INQUIRY; | 473 | scsi_cmd[0] = INQUIRY; |
475 | scsi_cmd[4] = (unsigned char) try_inquiry_len; | 474 | scsi_cmd[4] = (unsigned char) try_inquiry_len; |
476 | 475 | ||
477 | memset(sense, 0, sizeof(sense)); | ||
478 | memset(inq_result, 0, try_inquiry_len); | 476 | memset(inq_result, 0, try_inquiry_len); |
479 | 477 | ||
480 | result = scsi_execute_req(sdev, scsi_cmd, DMA_FROM_DEVICE, | 478 | result = scsi_execute_req(sdev, scsi_cmd, DMA_FROM_DEVICE, |
481 | inq_result, try_inquiry_len, sense, | 479 | inq_result, try_inquiry_len, &sshdr, |
482 | HZ / 2 + HZ * scsi_inq_timeout, 3); | 480 | HZ / 2 + HZ * scsi_inq_timeout, 3); |
483 | 481 | ||
484 | SCSI_LOG_SCAN_BUS(3, printk(KERN_INFO "scsi scan: INQUIRY %s " | 482 | SCSI_LOG_SCAN_BUS(3, printk(KERN_INFO "scsi scan: INQUIRY %s " |
@@ -493,8 +491,7 @@ static int scsi_probe_lun(struct scsi_device *sdev, char *inq_result, | |||
493 | * but many buggy devices do so anyway. | 491 | * but many buggy devices do so anyway. |
494 | */ | 492 | */ |
495 | if ((driver_byte(result) & DRIVER_SENSE) && | 493 | if ((driver_byte(result) & DRIVER_SENSE) && |
496 | scsi_normalize_sense(sense, sizeof(sense), | 494 | scsi_sense_valid(&sshdr)) { |
497 | &sshdr)) { | ||
498 | if ((sshdr.sense_key == UNIT_ATTENTION) && | 495 | if ((sshdr.sense_key == UNIT_ATTENTION) && |
499 | ((sshdr.asc == 0x28) || | 496 | ((sshdr.asc == 0x28) || |
500 | (sshdr.asc == 0x29)) && | 497 | (sshdr.asc == 0x29)) && |
@@ -1057,7 +1054,6 @@ static int scsi_report_lun_scan(struct scsi_device *sdev, int bflags, | |||
1057 | int rescan) | 1054 | int rescan) |
1058 | { | 1055 | { |
1059 | char devname[64]; | 1056 | char devname[64]; |
1060 | char sense[SCSI_SENSE_BUFFERSIZE]; | ||
1061 | unsigned char scsi_cmd[MAX_COMMAND_SIZE]; | 1057 | unsigned char scsi_cmd[MAX_COMMAND_SIZE]; |
1062 | unsigned int length; | 1058 | unsigned int length; |
1063 | unsigned int lun; | 1059 | unsigned int lun; |
@@ -1134,9 +1130,8 @@ static int scsi_report_lun_scan(struct scsi_device *sdev, int bflags, | |||
1134 | " REPORT LUNS to %s (try %d)\n", devname, | 1130 | " REPORT LUNS to %s (try %d)\n", devname, |
1135 | retries)); | 1131 | retries)); |
1136 | 1132 | ||
1137 | memset(sense, 0, sizeof(sense)); | ||
1138 | result = scsi_execute_req(sdev, scsi_cmd, DMA_FROM_DEVICE, | 1133 | result = scsi_execute_req(sdev, scsi_cmd, DMA_FROM_DEVICE, |
1139 | lun_data, length, sense, | 1134 | lun_data, length, &sshdr, |
1140 | SCSI_TIMEOUT + 4 * HZ, 3); | 1135 | SCSI_TIMEOUT + 4 * HZ, 3); |
1141 | 1136 | ||
1142 | SCSI_LOG_SCAN_BUS(3, printk (KERN_INFO "scsi scan: REPORT LUNS" | 1137 | SCSI_LOG_SCAN_BUS(3, printk (KERN_INFO "scsi scan: REPORT LUNS" |
@@ -1144,7 +1139,7 @@ static int scsi_report_lun_scan(struct scsi_device *sdev, int bflags, | |||
1144 | ? "failed" : "successful", retries, result)); | 1139 | ? "failed" : "successful", retries, result)); |
1145 | if (result == 0) | 1140 | if (result == 0) |
1146 | break; | 1141 | break; |
1147 | else if (scsi_normalize_sense(sense, sizeof(sense), &sshdr)) { | 1142 | else if (scsi_sense_valid(&sshdr)) { |
1148 | if (sshdr.sense_key != UNIT_ATTENTION) | 1143 | if (sshdr.sense_key != UNIT_ATTENTION) |
1149 | break; | 1144 | break; |
1150 | } | 1145 | } |