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.c35
1 files changed, 34 insertions, 1 deletions
diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
index 9fa209097e3b..2d3c4ac475f2 100644
--- a/drivers/scsi/scsi_scan.c
+++ b/drivers/scsi/scsi_scan.c
@@ -756,7 +756,8 @@ static int scsi_add_lun(struct scsi_device *sdev, char *inq_result, int *bflags)
756 * register it and tell the rest of the kernel 756 * register it and tell the rest of the kernel
757 * about it. 757 * about it.
758 */ 758 */
759 scsi_sysfs_add_sdev(sdev); 759 if (scsi_sysfs_add_sdev(sdev) != 0)
760 return SCSI_SCAN_NO_RESPONSE;
760 761
761 return SCSI_SCAN_LUN_PRESENT; 762 return SCSI_SCAN_LUN_PRESENT;
762} 763}
@@ -1000,6 +1001,38 @@ static int scsilun_to_int(struct scsi_lun *scsilun)
1000} 1001}
1001 1002
1002/** 1003/**
1004 * int_to_scsilun: reverts an int into a scsi_lun
1005 * @int: integer to be reverted
1006 * @scsilun: struct scsi_lun to be set.
1007 *
1008 * Description:
1009 * Reverts the functionality of the scsilun_to_int, which packed
1010 * an 8-byte lun value into an int. This routine unpacks the int
1011 * back into the lun value.
1012 * Note: the scsilun_to_int() routine does not truly handle all
1013 * 8bytes of the lun value. This functions restores only as much
1014 * as was set by the routine.
1015 *
1016 * Notes:
1017 * Given an integer : 0x0b030a04, this function returns a
1018 * scsi_lun of : struct scsi_lun of: 0a 04 0b 03 00 00 00 00
1019 *
1020 **/
1021void int_to_scsilun(unsigned int lun, struct scsi_lun *scsilun)
1022{
1023 int i;
1024
1025 memset(scsilun->scsi_lun, 0, sizeof(scsilun->scsi_lun));
1026
1027 for (i = 0; i < sizeof(lun); i += 2) {
1028 scsilun->scsi_lun[i] = (lun >> 8) & 0xFF;
1029 scsilun->scsi_lun[i+1] = lun & 0xFF;
1030 lun = lun >> 16;
1031 }
1032}
1033EXPORT_SYMBOL(int_to_scsilun);
1034
1035/**
1003 * scsi_report_lun_scan - Scan using SCSI REPORT LUN results 1036 * scsi_report_lun_scan - Scan using SCSI REPORT LUN results
1004 * @sdevscan: scan the host, channel, and id of this Scsi_Device 1037 * @sdevscan: scan the host, channel, and id of this Scsi_Device
1005 * 1038 *