diff options
Diffstat (limited to 'drivers/scsi/scsi_scan.c')
-rw-r--r-- | drivers/scsi/scsi_scan.c | 36 |
1 files changed, 23 insertions, 13 deletions
diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c index 40ea71cd2ca6..1dc165ad17fb 100644 --- a/drivers/scsi/scsi_scan.c +++ b/drivers/scsi/scsi_scan.c | |||
@@ -221,6 +221,9 @@ static void scsi_unlock_floptical(struct scsi_device *sdev, | |||
221 | 221 | ||
222 | /** | 222 | /** |
223 | * scsi_alloc_sdev - allocate and setup a scsi_Device | 223 | * scsi_alloc_sdev - allocate and setup a scsi_Device |
224 | * @starget: which target to allocate a &scsi_device for | ||
225 | * @lun: which lun | ||
226 | * @hostdata: usually NULL and set by ->slave_alloc instead | ||
224 | * | 227 | * |
225 | * Description: | 228 | * Description: |
226 | * Allocate, initialize for io, and return a pointer to a scsi_Device. | 229 | * Allocate, initialize for io, and return a pointer to a scsi_Device. |
@@ -472,7 +475,6 @@ static void scsi_target_reap_usercontext(struct work_struct *work) | |||
472 | 475 | ||
473 | /** | 476 | /** |
474 | * scsi_target_reap - check to see if target is in use and destroy if not | 477 | * scsi_target_reap - check to see if target is in use and destroy if not |
475 | * | ||
476 | * @starget: target to be checked | 478 | * @starget: target to be checked |
477 | * | 479 | * |
478 | * This is used after removing a LUN or doing a last put of the target | 480 | * This is used after removing a LUN or doing a last put of the target |
@@ -863,7 +865,7 @@ static int scsi_add_lun(struct scsi_device *sdev, unsigned char *inq_result, | |||
863 | sdev->no_start_on_add = 1; | 865 | sdev->no_start_on_add = 1; |
864 | 866 | ||
865 | if (*bflags & BLIST_SINGLELUN) | 867 | if (*bflags & BLIST_SINGLELUN) |
866 | sdev->single_lun = 1; | 868 | scsi_target(sdev)->single_lun = 1; |
867 | 869 | ||
868 | sdev->use_10_for_rw = 1; | 870 | sdev->use_10_for_rw = 1; |
869 | 871 | ||
@@ -928,8 +930,7 @@ static inline void scsi_destroy_sdev(struct scsi_device *sdev) | |||
928 | 930 | ||
929 | #ifdef CONFIG_SCSI_LOGGING | 931 | #ifdef CONFIG_SCSI_LOGGING |
930 | /** | 932 | /** |
931 | * scsi_inq_str - print INQUIRY data from min to max index, | 933 | * scsi_inq_str - print INQUIRY data from min to max index, strip trailing whitespace |
932 | * strip trailing whitespace | ||
933 | * @buf: Output buffer with at least end-first+1 bytes of space | 934 | * @buf: Output buffer with at least end-first+1 bytes of space |
934 | * @inq: Inquiry buffer (input) | 935 | * @inq: Inquiry buffer (input) |
935 | * @first: Offset of string into inq | 936 | * @first: Offset of string into inq |
@@ -957,9 +958,10 @@ static unsigned char *scsi_inq_str(unsigned char *buf, unsigned char *inq, | |||
957 | * scsi_probe_and_add_lun - probe a LUN, if a LUN is found add it | 958 | * scsi_probe_and_add_lun - probe a LUN, if a LUN is found add it |
958 | * @starget: pointer to target device structure | 959 | * @starget: pointer to target device structure |
959 | * @lun: LUN of target device | 960 | * @lun: LUN of target device |
960 | * @sdevscan: probe the LUN corresponding to this scsi_device | ||
961 | * @sdevnew: store the value of any new scsi_device allocated | ||
962 | * @bflagsp: store bflags here if not NULL | 961 | * @bflagsp: store bflags here if not NULL |
962 | * @sdevp: probe the LUN corresponding to this scsi_device | ||
963 | * @rescan: if nonzero skip some code only needed on first scan | ||
964 | * @hostdata: passed to scsi_alloc_sdev() | ||
963 | * | 965 | * |
964 | * Description: | 966 | * Description: |
965 | * Call scsi_probe_lun, if a LUN with an attached device is found, | 967 | * Call scsi_probe_lun, if a LUN with an attached device is found, |
@@ -1110,6 +1112,8 @@ static int scsi_probe_and_add_lun(struct scsi_target *starget, | |||
1110 | * scsi_sequential_lun_scan - sequentially scan a SCSI target | 1112 | * scsi_sequential_lun_scan - sequentially scan a SCSI target |
1111 | * @starget: pointer to target structure to scan | 1113 | * @starget: pointer to target structure to scan |
1112 | * @bflags: black/white list flag for LUN 0 | 1114 | * @bflags: black/white list flag for LUN 0 |
1115 | * @scsi_level: Which version of the standard does this device adhere to | ||
1116 | * @rescan: passed to scsi_probe_add_lun() | ||
1113 | * | 1117 | * |
1114 | * Description: | 1118 | * Description: |
1115 | * Generally, scan from LUN 1 (LUN 0 is assumed to already have been | 1119 | * Generally, scan from LUN 1 (LUN 0 is assumed to already have been |
@@ -1220,7 +1224,7 @@ EXPORT_SYMBOL(scsilun_to_int); | |||
1220 | 1224 | ||
1221 | /** | 1225 | /** |
1222 | * int_to_scsilun: reverts an int into a scsi_lun | 1226 | * int_to_scsilun: reverts an int into a scsi_lun |
1223 | * @int: integer to be reverted | 1227 | * @lun: integer to be reverted |
1224 | * @scsilun: struct scsi_lun to be set. | 1228 | * @scsilun: struct scsi_lun to be set. |
1225 | * | 1229 | * |
1226 | * Description: | 1230 | * Description: |
@@ -1252,18 +1256,22 @@ EXPORT_SYMBOL(int_to_scsilun); | |||
1252 | 1256 | ||
1253 | /** | 1257 | /** |
1254 | * scsi_report_lun_scan - Scan using SCSI REPORT LUN results | 1258 | * scsi_report_lun_scan - Scan using SCSI REPORT LUN results |
1255 | * @sdevscan: scan the host, channel, and id of this scsi_device | 1259 | * @starget: which target |
1260 | * @bflags: Zero or a mix of BLIST_NOLUN, BLIST_REPORTLUN2, or BLIST_NOREPORTLUN | ||
1261 | * @rescan: nonzero if we can skip code only needed on first scan | ||
1256 | * | 1262 | * |
1257 | * Description: | 1263 | * Description: |
1258 | * If @sdevscan is for a SCSI-3 or up device, send a REPORT LUN | 1264 | * Fast scanning for modern (SCSI-3) devices by sending a REPORT LUN command. |
1259 | * command, and scan the resulting list of LUNs by calling | 1265 | * Scan the resulting list of LUNs by calling scsi_probe_and_add_lun. |
1260 | * scsi_probe_and_add_lun. | ||
1261 | * | 1266 | * |
1262 | * Modifies sdevscan->lun. | 1267 | * If BLINK_REPORTLUN2 is set, scan a target that supports more than 8 |
1268 | * LUNs even if it's older than SCSI-3. | ||
1269 | * If BLIST_NOREPORTLUN is set, return 1 always. | ||
1270 | * If BLIST_NOLUN is set, return 0 always. | ||
1263 | * | 1271 | * |
1264 | * Return: | 1272 | * Return: |
1265 | * 0: scan completed (or no memory, so further scanning is futile) | 1273 | * 0: scan completed (or no memory, so further scanning is futile) |
1266 | * 1: no report lun scan, or not configured | 1274 | * 1: could not scan with REPORT LUN |
1267 | **/ | 1275 | **/ |
1268 | static int scsi_report_lun_scan(struct scsi_target *starget, int bflags, | 1276 | static int scsi_report_lun_scan(struct scsi_target *starget, int bflags, |
1269 | int rescan) | 1277 | int rescan) |
@@ -1481,6 +1489,7 @@ struct scsi_device *__scsi_add_device(struct Scsi_Host *shost, uint channel, | |||
1481 | if (scsi_host_scan_allowed(shost)) | 1489 | if (scsi_host_scan_allowed(shost)) |
1482 | scsi_probe_and_add_lun(starget, lun, NULL, &sdev, 1, hostdata); | 1490 | scsi_probe_and_add_lun(starget, lun, NULL, &sdev, 1, hostdata); |
1483 | mutex_unlock(&shost->scan_mutex); | 1491 | mutex_unlock(&shost->scan_mutex); |
1492 | transport_configure_device(&starget->dev); | ||
1484 | scsi_target_reap(starget); | 1493 | scsi_target_reap(starget); |
1485 | put_device(&starget->dev); | 1494 | put_device(&starget->dev); |
1486 | 1495 | ||
@@ -1561,6 +1570,7 @@ static void __scsi_scan_target(struct device *parent, unsigned int channel, | |||
1561 | out_reap: | 1570 | out_reap: |
1562 | /* now determine if the target has any children at all | 1571 | /* now determine if the target has any children at all |
1563 | * and if not, nuke it */ | 1572 | * and if not, nuke it */ |
1573 | transport_configure_device(&starget->dev); | ||
1564 | scsi_target_reap(starget); | 1574 | scsi_target_reap(starget); |
1565 | 1575 | ||
1566 | put_device(&starget->dev); | 1576 | put_device(&starget->dev); |