--- linux/drivers/scsi_orig/scsi.c Tue Jan 8 10:50:48 2002
+++ linux/drivers/scsi/scsi.c Thu Jan 10 15:16:31 2002
@@ -34,6 +34,10 @@
* Jiffies wrap fixes (host->resetting), 3 Dec 1998 Andrea Arcangeli
*
* out_of_space + add-single-device work, D. Gilbert (dpg) 990612
+ *
+ * Remove TEST_UNIT_READY, backported from patch-2.4.0-test2
+ * Wed Jan 9 18:34:51 CET 2002 Luca Montecchiani <[email protected]>
+ *
*/
#include <linux/config.h>
@@ -697,46 +701,21 @@
SDpnt->was_reset = 0;
SDpnt->expecting_cc_ua = 0;
- scsi_cmd[0] = TEST_UNIT_READY;
- scsi_cmd[1] = lun << 5;
- scsi_cmd[2] = scsi_cmd[3] = scsi_cmd[4] = scsi_cmd[5] = 0;
-
SCpnt->host = SDpnt->host;
SCpnt->device = SDpnt;
SCpnt->target = SDpnt->id;
SCpnt->lun = SDpnt->lun;
SCpnt->channel = SDpnt->channel;
- {
- struct semaphore sem = MUTEX_LOCKED;
- SCpnt->request.sem = &sem;
- SCpnt->request.rq_status = RQ_SCSI_BUSY;
- spin_lock_irq(&io_request_lock);
- scsi_do_cmd (SCpnt, (void *) scsi_cmd,
- (void *) scsi_result,
- 256, scan_scsis_done, SCSI_TIMEOUT + 4 * HZ, 5);
- spin_unlock_irq(&io_request_lock);
- down (&sem);
- SCpnt->request.sem = NULL;
- }
- SCSI_LOG_SCAN_BUS(3, printk ("scsi: scan_scsis_single id %d lun %d. Return code 0x%08x\n",
- dev, lun, SCpnt->result));
- SCSI_LOG_SCAN_BUS(3,print_driverbyte(SCpnt->result));
- SCSI_LOG_SCAN_BUS(3,print_hostbyte(SCpnt->result));
- SCSI_LOG_SCAN_BUS(3,printk("\n"));
-
- if (SCpnt->result) {
- if (((driver_byte (SCpnt->result) & DRIVER_SENSE) ||
- (status_byte (SCpnt->result) & CHECK_CONDITION)) &&
- ((SCpnt->sense_buffer[0] & 0x70) >> 4) == 7) {
- if (((SCpnt->sense_buffer[2] & 0xf) != NOT_READY) &&
- ((SCpnt->sense_buffer[2] & 0xf) != UNIT_ATTENTION) &&
- ((SCpnt->sense_buffer[2] & 0xf) != ILLEGAL_REQUEST || lun > 0))
- return 1;
- }
- else
- return 0;
- }
+ /*
+ * We used to do a TEST_UNIT_READY before the INQUIRY but that was
+ * not really necessary. Spec recommends using INQUIRY to scan for
+ * devices (and TEST_UNIT_READY to poll for media change). - Paul G.
+ *
+ * Wed Jan 9 18:34:51 CET 2002 Luca Montecchiani <[email protected]>
+ * backported to 2.2.20 from patch-2.4.0-test2
+ * to fix "the first use error" on 20/40gbyte Seagate dat
+ */
SCSI_LOG_SCAN_BUS(3,printk ("scsi: performing INQUIRY\n"));
/*
@@ -756,7 +735,7 @@
spin_lock_irq(&io_request_lock);
scsi_do_cmd (SCpnt, (void *) scsi_cmd,
(void *) scsi_result,
- 256, scan_scsis_done, SCSI_TIMEOUT, 3);
+ 256, scan_scsis_done, SCSI_TIMEOUT+4*HZ, 3);
spin_unlock_irq(&io_request_lock);
down (&sem);
SCpnt->request.sem = NULL;