aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/scsi_scan.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/scsi_scan.c')
-rw-r--r--drivers/scsi/scsi_scan.c38
1 files changed, 35 insertions, 3 deletions
diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
index 820c4ad7b581..5603dc6eca47 100644
--- a/drivers/scsi/scsi_scan.c
+++ b/drivers/scsi/scsi_scan.c
@@ -808,6 +808,29 @@ static inline void scsi_destroy_sdev(struct scsi_device *sdev)
808 put_device(&sdev->sdev_gendev); 808 put_device(&sdev->sdev_gendev);
809} 809}
810 810
811/**
812 * scsi_inq_str - print INQUIRY data from min to max index,
813 * strip trailing whitespace
814 * @buf: Output buffer with at least end-first+1 bytes of space
815 * @inq: Inquiry buffer (input)
816 * @first: Offset of string into inq
817 * @end: Index after last character in inq
818 */
819static unsigned char* scsi_inq_str(unsigned char* buf, unsigned char *inq,
820 unsigned first, unsigned end)
821{
822 unsigned term = 0, idx;
823 for (idx = 0; idx+first < end && idx+first < inq[4]+5; ++idx) {
824 if (inq[idx+first] > 0x20) {
825 buf[idx] = inq[idx+first];
826 term = idx+1;
827 } else {
828 buf[idx] = ' ';
829 }
830 }
831 buf[term] = 0;
832 return buf;
833}
811 834
812/** 835/**
813 * scsi_probe_and_add_lun - probe a LUN, if a LUN is found add it 836 * scsi_probe_and_add_lun - probe a LUN, if a LUN is found add it
@@ -888,9 +911,18 @@ static int scsi_probe_and_add_lun(struct scsi_target *starget,
888 * logical disk configured at sdev->lun, but there 911 * logical disk configured at sdev->lun, but there
889 * is a target id responding. 912 * is a target id responding.
890 */ 913 */
891 SCSI_LOG_SCAN_BUS(3, printk(KERN_INFO 914 SCSI_LOG_SCAN_BUS(2, sdev_printk(KERN_INFO, sdev, "scsi scan:"
892 "scsi scan: peripheral qualifier of 3," 915 " peripheral qualifier of 3, device not"
893 " no device added\n")); 916 " added\n"))
917 if (lun == 0) {
918 unsigned char vend[9], mod[17];
919 SCSI_LOG_SCAN_BUS(1, sdev_printk(KERN_INFO, sdev,
920 "scsi scan: consider passing scsi_mod."
921 "dev_flags=%s:%s:0x240 or 0x800240\n",
922 scsi_inq_str(vend, result, 8, 16),
923 scsi_inq_str(mod, result, 16, 32)));
924 }
925
894 res = SCSI_SCAN_TARGET_PRESENT; 926 res = SCSI_SCAN_TARGET_PRESENT;
895 goto out_free_result; 927 goto out_free_result;
896 } 928 }