diff options
Diffstat (limited to 'drivers/scsi/scsi_scan.c')
-rw-r--r-- | drivers/scsi/scsi_scan.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c index 56675dbbf681..ba3f1e8d0d57 100644 --- a/drivers/scsi/scsi_scan.c +++ b/drivers/scsi/scsi_scan.c | |||
@@ -736,6 +736,16 @@ static int scsi_probe_lun(struct scsi_device *sdev, unsigned char *inq_result, | |||
736 | sdev->scsi_level++; | 736 | sdev->scsi_level++; |
737 | sdev->sdev_target->scsi_level = sdev->scsi_level; | 737 | sdev->sdev_target->scsi_level = sdev->scsi_level; |
738 | 738 | ||
739 | /* | ||
740 | * If SCSI-2 or lower, and if the transport requires it, | ||
741 | * store the LUN value in CDB[1]. | ||
742 | */ | ||
743 | sdev->lun_in_cdb = 0; | ||
744 | if (sdev->scsi_level <= SCSI_2 && | ||
745 | sdev->scsi_level != SCSI_UNKNOWN && | ||
746 | !sdev->host->no_scsi2_lun_in_cdb) | ||
747 | sdev->lun_in_cdb = 1; | ||
748 | |||
739 | return 0; | 749 | return 0; |
740 | } | 750 | } |
741 | 751 | ||
@@ -805,6 +815,19 @@ static int scsi_add_lun(struct scsi_device *sdev, unsigned char *inq_result, | |||
805 | } else { | 815 | } else { |
806 | sdev->type = (inq_result[0] & 0x1f); | 816 | sdev->type = (inq_result[0] & 0x1f); |
807 | sdev->removable = (inq_result[1] & 0x80) >> 7; | 817 | sdev->removable = (inq_result[1] & 0x80) >> 7; |
818 | |||
819 | /* | ||
820 | * some devices may respond with wrong type for | ||
821 | * well-known logical units. Force well-known type | ||
822 | * to enumerate them correctly. | ||
823 | */ | ||
824 | if (scsi_is_wlun(sdev->lun) && sdev->type != TYPE_WLUN) { | ||
825 | sdev_printk(KERN_WARNING, sdev, | ||
826 | "%s: correcting incorrect peripheral device type 0x%x for W-LUN 0x%16xhN\n", | ||
827 | __func__, sdev->type, (unsigned int)sdev->lun); | ||
828 | sdev->type = TYPE_WLUN; | ||
829 | } | ||
830 | |||
808 | } | 831 | } |
809 | 832 | ||
810 | if (sdev->type == TYPE_RBC || sdev->type == TYPE_ROM) { | 833 | if (sdev->type == TYPE_RBC || sdev->type == TYPE_ROM) { |
@@ -1733,6 +1756,9 @@ static void scsi_sysfs_add_devices(struct Scsi_Host *shost) | |||
1733 | /* target removed before the device could be added */ | 1756 | /* target removed before the device could be added */ |
1734 | if (sdev->sdev_state == SDEV_DEL) | 1757 | if (sdev->sdev_state == SDEV_DEL) |
1735 | continue; | 1758 | continue; |
1759 | /* If device is already visible, skip adding it to sysfs */ | ||
1760 | if (sdev->is_visible) | ||
1761 | continue; | ||
1736 | if (!scsi_host_scan_allowed(shost) || | 1762 | if (!scsi_host_scan_allowed(shost) || |
1737 | scsi_sysfs_add_sdev(sdev) != 0) | 1763 | scsi_sysfs_add_sdev(sdev) != 0) |
1738 | __scsi_remove_device(sdev); | 1764 | __scsi_remove_device(sdev); |