diff options
Diffstat (limited to 'drivers/scsi/scsi_scan.c')
| -rw-r--r-- | drivers/scsi/scsi_scan.c | 54 |
1 files changed, 28 insertions, 26 deletions
diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c index 7eb3a2d40dc5..374853df9cca 100644 --- a/drivers/scsi/scsi_scan.c +++ b/drivers/scsi/scsi_scan.c | |||
| @@ -9,7 +9,7 @@ | |||
| 9 | * global variable (boot or module load time) settings. | 9 | * global variable (boot or module load time) settings. |
| 10 | * | 10 | * |
| 11 | * A specific LUN is scanned via an INQUIRY command; if the LUN has a | 11 | * A specific LUN is scanned via an INQUIRY command; if the LUN has a |
| 12 | * device attached, a Scsi_Device is allocated and setup for it. | 12 | * device attached, a scsi_device is allocated and setup for it. |
| 13 | * | 13 | * |
| 14 | * For every id of every channel on the given host: | 14 | * For every id of every channel on the given host: |
| 15 | * | 15 | * |
| @@ -17,7 +17,7 @@ | |||
| 17 | * device or storage attached to LUN 0): | 17 | * device or storage attached to LUN 0): |
| 18 | * | 18 | * |
| 19 | * If LUN 0 has a device attached, allocate and setup a | 19 | * If LUN 0 has a device attached, allocate and setup a |
| 20 | * Scsi_Device for it. | 20 | * scsi_device for it. |
| 21 | * | 21 | * |
| 22 | * If target is SCSI-3 or up, issue a REPORT LUN, and scan | 22 | * If target is SCSI-3 or up, issue a REPORT LUN, and scan |
| 23 | * all of the LUNs returned by the REPORT LUN; else, | 23 | * all of the LUNs returned by the REPORT LUN; else, |
| @@ -441,7 +441,7 @@ void scsi_target_reap(struct scsi_target *starget) | |||
| 441 | * | 441 | * |
| 442 | * If the INQUIRY is successful, zero is returned and the | 442 | * If the INQUIRY is successful, zero is returned and the |
| 443 | * INQUIRY data is in @inq_result; the scsi_level and INQUIRY length | 443 | * INQUIRY data is in @inq_result; the scsi_level and INQUIRY length |
| 444 | * are copied to the Scsi_Device any flags value is stored in *@bflags. | 444 | * are copied to the scsi_device any flags value is stored in *@bflags. |
| 445 | **/ | 445 | **/ |
| 446 | static int scsi_probe_lun(struct scsi_device *sdev, char *inq_result, | 446 | static int scsi_probe_lun(struct scsi_device *sdev, char *inq_result, |
| 447 | int result_len, int *bflags) | 447 | int result_len, int *bflags) |
| @@ -509,8 +509,8 @@ static int scsi_probe_lun(struct scsi_device *sdev, char *inq_result, | |||
| 509 | /* | 509 | /* |
| 510 | * Get any flags for this device. | 510 | * Get any flags for this device. |
| 511 | * | 511 | * |
| 512 | * XXX add a bflags to Scsi_Device, and replace the | 512 | * XXX add a bflags to scsi_device, and replace the |
| 513 | * corresponding bit fields in Scsi_Device, so bflags | 513 | * corresponding bit fields in scsi_device, so bflags |
| 514 | * need not be passed as an argument. | 514 | * need not be passed as an argument. |
| 515 | */ | 515 | */ |
| 516 | *bflags = scsi_get_device_flags(sdev, &inq_result[8], | 516 | *bflags = scsi_get_device_flags(sdev, &inq_result[8], |
| @@ -592,21 +592,21 @@ static int scsi_probe_lun(struct scsi_device *sdev, char *inq_result, | |||
| 592 | } | 592 | } |
| 593 | 593 | ||
| 594 | /** | 594 | /** |
| 595 | * scsi_add_lun - allocate and fully initialze a Scsi_Device | 595 | * scsi_add_lun - allocate and fully initialze a scsi_device |
| 596 | * @sdevscan: holds information to be stored in the new Scsi_Device | 596 | * @sdevscan: holds information to be stored in the new scsi_device |
| 597 | * @sdevnew: store the address of the newly allocated Scsi_Device | 597 | * @sdevnew: store the address of the newly allocated scsi_device |
| 598 | * @inq_result: holds the result of a previous INQUIRY to the LUN | 598 | * @inq_result: holds the result of a previous INQUIRY to the LUN |
| 599 | * @bflags: black/white list flag | 599 | * @bflags: black/white list flag |
| 600 | * | 600 | * |
| 601 | * Description: | 601 | * Description: |
| 602 | * Allocate and initialize a Scsi_Device matching sdevscan. Optionally | 602 | * Allocate and initialize a scsi_device matching sdevscan. Optionally |
| 603 | * set fields based on values in *@bflags. If @sdevnew is not | 603 | * set fields based on values in *@bflags. If @sdevnew is not |
| 604 | * NULL, store the address of the new Scsi_Device in *@sdevnew (needed | 604 | * NULL, store the address of the new scsi_device in *@sdevnew (needed |
| 605 | * when scanning a particular LUN). | 605 | * when scanning a particular LUN). |
| 606 | * | 606 | * |
| 607 | * Return: | 607 | * Return: |
| 608 | * SCSI_SCAN_NO_RESPONSE: could not allocate or setup a Scsi_Device | 608 | * SCSI_SCAN_NO_RESPONSE: could not allocate or setup a scsi_device |
| 609 | * SCSI_SCAN_LUN_PRESENT: a new Scsi_Device was allocated and initialized | 609 | * SCSI_SCAN_LUN_PRESENT: a new scsi_device was allocated and initialized |
| 610 | **/ | 610 | **/ |
| 611 | static int scsi_add_lun(struct scsi_device *sdev, char *inq_result, int *bflags) | 611 | static int scsi_add_lun(struct scsi_device *sdev, char *inq_result, int *bflags) |
| 612 | { | 612 | { |
| @@ -674,7 +674,7 @@ static int scsi_add_lun(struct scsi_device *sdev, char *inq_result, int *bflags) | |||
| 674 | * | 674 | * |
| 675 | * The above is vague, as it implies that we could treat 001 and | 675 | * The above is vague, as it implies that we could treat 001 and |
| 676 | * 011 the same. Stay compatible with previous code, and create a | 676 | * 011 the same. Stay compatible with previous code, and create a |
| 677 | * Scsi_Device for a PQ of 1 | 677 | * scsi_device for a PQ of 1 |
| 678 | * | 678 | * |
| 679 | * Don't set the device offline here; rather let the upper | 679 | * Don't set the device offline here; rather let the upper |
| 680 | * level drivers eval the PQ to decide whether they should | 680 | * level drivers eval the PQ to decide whether they should |
| @@ -784,8 +784,8 @@ static inline void scsi_destroy_sdev(struct scsi_device *sdev) | |||
| 784 | * scsi_probe_and_add_lun - probe a LUN, if a LUN is found add it | 784 | * scsi_probe_and_add_lun - probe a LUN, if a LUN is found add it |
| 785 | * @starget: pointer to target device structure | 785 | * @starget: pointer to target device structure |
| 786 | * @lun: LUN of target device | 786 | * @lun: LUN of target device |
| 787 | * @sdevscan: probe the LUN corresponding to this Scsi_Device | 787 | * @sdevscan: probe the LUN corresponding to this scsi_device |
| 788 | * @sdevnew: store the value of any new Scsi_Device allocated | 788 | * @sdevnew: store the value of any new scsi_device allocated |
| 789 | * @bflagsp: store bflags here if not NULL | 789 | * @bflagsp: store bflags here if not NULL |
| 790 | * | 790 | * |
| 791 | * Description: | 791 | * Description: |
| @@ -793,10 +793,10 @@ static inline void scsi_destroy_sdev(struct scsi_device *sdev) | |||
| 793 | * allocate and set it up by calling scsi_add_lun. | 793 | * allocate and set it up by calling scsi_add_lun. |
| 794 | * | 794 | * |
| 795 | * Return: | 795 | * Return: |
| 796 | * SCSI_SCAN_NO_RESPONSE: could not allocate or setup a Scsi_Device | 796 | * SCSI_SCAN_NO_RESPONSE: could not allocate or setup a scsi_device |
| 797 | * SCSI_SCAN_TARGET_PRESENT: target responded, but no device is | 797 | * SCSI_SCAN_TARGET_PRESENT: target responded, but no device is |
| 798 | * attached at the LUN | 798 | * attached at the LUN |
| 799 | * SCSI_SCAN_LUN_PRESENT: a new Scsi_Device was allocated and initialized | 799 | * SCSI_SCAN_LUN_PRESENT: a new scsi_device was allocated and initialized |
| 800 | **/ | 800 | **/ |
| 801 | static int scsi_probe_and_add_lun(struct scsi_target *starget, | 801 | static int scsi_probe_and_add_lun(struct scsi_target *starget, |
| 802 | uint lun, int *bflagsp, | 802 | uint lun, int *bflagsp, |
| @@ -1046,7 +1046,7 @@ EXPORT_SYMBOL(int_to_scsilun); | |||
| 1046 | 1046 | ||
| 1047 | /** | 1047 | /** |
| 1048 | * scsi_report_lun_scan - Scan using SCSI REPORT LUN results | 1048 | * scsi_report_lun_scan - Scan using SCSI REPORT LUN results |
| 1049 | * @sdevscan: scan the host, channel, and id of this Scsi_Device | 1049 | * @sdevscan: scan the host, channel, and id of this scsi_device |
| 1050 | * | 1050 | * |
| 1051 | * Description: | 1051 | * Description: |
| 1052 | * If @sdevscan is for a SCSI-3 or up device, send a REPORT LUN | 1052 | * If @sdevscan is for a SCSI-3 or up device, send a REPORT LUN |
| @@ -1074,6 +1074,7 @@ static int scsi_report_lun_scan(struct scsi_target *starget, int bflags, | |||
| 1074 | struct scsi_sense_hdr sshdr; | 1074 | struct scsi_sense_hdr sshdr; |
| 1075 | struct scsi_device *sdev; | 1075 | struct scsi_device *sdev; |
| 1076 | struct Scsi_Host *shost = dev_to_shost(&starget->dev); | 1076 | struct Scsi_Host *shost = dev_to_shost(&starget->dev); |
| 1077 | int ret = 0; | ||
| 1077 | 1078 | ||
| 1078 | /* | 1079 | /* |
| 1079 | * Only support SCSI-3 and up devices if BLIST_NOREPORTLUN is not set. | 1080 | * Only support SCSI-3 and up devices if BLIST_NOREPORTLUN is not set. |
| @@ -1169,8 +1170,8 @@ static int scsi_report_lun_scan(struct scsi_target *starget, int bflags, | |||
| 1169 | /* | 1170 | /* |
| 1170 | * The device probably does not support a REPORT LUN command | 1171 | * The device probably does not support a REPORT LUN command |
| 1171 | */ | 1172 | */ |
| 1172 | kfree(lun_data); | 1173 | ret = 1; |
| 1173 | return 1; | 1174 | goto out_err; |
| 1174 | } | 1175 | } |
| 1175 | 1176 | ||
| 1176 | /* | 1177 | /* |
| @@ -1238,6 +1239,7 @@ static int scsi_report_lun_scan(struct scsi_target *starget, int bflags, | |||
| 1238 | } | 1239 | } |
| 1239 | } | 1240 | } |
| 1240 | 1241 | ||
| 1242 | out_err: | ||
| 1241 | kfree(lun_data); | 1243 | kfree(lun_data); |
| 1242 | out: | 1244 | out: |
| 1243 | scsi_device_put(sdev); | 1245 | scsi_device_put(sdev); |
| @@ -1246,7 +1248,7 @@ static int scsi_report_lun_scan(struct scsi_target *starget, int bflags, | |||
| 1246 | * the sdev we used didn't appear in the report luns scan | 1248 | * the sdev we used didn't appear in the report luns scan |
| 1247 | */ | 1249 | */ |
| 1248 | scsi_destroy_sdev(sdev); | 1250 | scsi_destroy_sdev(sdev); |
| 1249 | return 0; | 1251 | return ret; |
| 1250 | } | 1252 | } |
| 1251 | 1253 | ||
| 1252 | struct scsi_device *__scsi_add_device(struct Scsi_Host *shost, uint channel, | 1254 | struct scsi_device *__scsi_add_device(struct Scsi_Host *shost, uint channel, |
| @@ -1472,16 +1474,16 @@ void scsi_forget_host(struct Scsi_Host *shost) | |||
| 1472 | /* | 1474 | /* |
| 1473 | * Function: scsi_get_host_dev() | 1475 | * Function: scsi_get_host_dev() |
| 1474 | * | 1476 | * |
| 1475 | * Purpose: Create a Scsi_Device that points to the host adapter itself. | 1477 | * Purpose: Create a scsi_device that points to the host adapter itself. |
| 1476 | * | 1478 | * |
| 1477 | * Arguments: SHpnt - Host that needs a Scsi_Device | 1479 | * Arguments: SHpnt - Host that needs a scsi_device |
| 1478 | * | 1480 | * |
| 1479 | * Lock status: None assumed. | 1481 | * Lock status: None assumed. |
| 1480 | * | 1482 | * |
| 1481 | * Returns: The Scsi_Device or NULL | 1483 | * Returns: The scsi_device or NULL |
| 1482 | * | 1484 | * |
| 1483 | * Notes: | 1485 | * Notes: |
| 1484 | * Attach a single Scsi_Device to the Scsi_Host - this should | 1486 | * Attach a single scsi_device to the Scsi_Host - this should |
| 1485 | * be made to look like a "pseudo-device" that points to the | 1487 | * be made to look like a "pseudo-device" that points to the |
| 1486 | * HA itself. | 1488 | * HA itself. |
| 1487 | * | 1489 | * |
| @@ -1518,7 +1520,7 @@ EXPORT_SYMBOL(scsi_get_host_dev); | |||
| 1518 | * | 1520 | * |
| 1519 | * Purpose: Free a scsi_device that points to the host adapter itself. | 1521 | * Purpose: Free a scsi_device that points to the host adapter itself. |
| 1520 | * | 1522 | * |
| 1521 | * Arguments: SHpnt - Host that needs a Scsi_Device | 1523 | * Arguments: SHpnt - Host that needs a scsi_device |
| 1522 | * | 1524 | * |
| 1523 | * Lock status: None assumed. | 1525 | * Lock status: None assumed. |
| 1524 | * | 1526 | * |
