Merge master.kernel.org:/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6
[pandora-kernel.git] / drivers / scsi / scsi_scan.c
index d6fe756..0949145 100644 (file)
@@ -385,6 +385,7 @@ static struct scsi_target *scsi_alloc_target(struct device *parent,
        INIT_LIST_HEAD(&starget->siblings);
        INIT_LIST_HEAD(&starget->devices);
        starget->state = STARGET_RUNNING;
+       starget->scsi_level = SCSI_2;
  retry:
        spin_lock_irqsave(shost->host_lock, flags);
 
@@ -654,6 +655,19 @@ static int scsi_probe_lun(struct scsi_device *sdev, unsigned char *inq_result,
         * short INQUIRY), an abort here prevents any further use of the
         * device, including spin up.
         *
+        * On the whole, the best approach seems to be to assume the first
+        * 36 bytes are valid no matter what the device says.  That's
+        * better than copying < 36 bytes to the inquiry-result buffer
+        * and displaying garbage for the Vendor, Product, or Revision
+        * strings.
+        */
+       if (sdev->inquiry_len < 36) {
+               printk(KERN_INFO "scsi scan: INQUIRY result too short (%d),"
+                               " using 36\n", sdev->inquiry_len);
+               sdev->inquiry_len = 36;
+       }
+
+       /*
         * Related to the above issue:
         *
         * XXX Devices (disk or all?) should be sent a TEST UNIT READY,