scsi_scan.c (46557bef3f3834ac33031c7be27d39d90d507442) scsi_scan.c (860dc73608a091e0b325218acc2701709d5f221a)
1/*
2 * scsi_scan.c
3 *
4 * Copyright (C) 2000 Eric Youngdale,
5 * Copyright (C) 2002 Patrick Mansfield
6 *
7 * The general scanning/probing algorithm is as follows, exceptions are
8 * made to it depending on device specific flags, compilation options, and

--- 938 unchanged lines hidden (view full) ---

947 * about it.
948 */
949 if (!async && scsi_sysfs_add_sdev(sdev) != 0)
950 return SCSI_SCAN_NO_RESPONSE;
951
952 return SCSI_SCAN_LUN_PRESENT;
953}
954
1/*
2 * scsi_scan.c
3 *
4 * Copyright (C) 2000 Eric Youngdale,
5 * Copyright (C) 2002 Patrick Mansfield
6 *
7 * The general scanning/probing algorithm is as follows, exceptions are
8 * made to it depending on device specific flags, compilation options, and

--- 938 unchanged lines hidden (view full) ---

947 * about it.
948 */
949 if (!async && scsi_sysfs_add_sdev(sdev) != 0)
950 return SCSI_SCAN_NO_RESPONSE;
951
952 return SCSI_SCAN_LUN_PRESENT;
953}
954
955static inline void scsi_destroy_sdev(struct scsi_device *sdev)
956{
957 scsi_device_set_state(sdev, SDEV_DEL);
958 if (sdev->host->hostt->slave_destroy)
959 sdev->host->hostt->slave_destroy(sdev);
960 transport_destroy_device(&sdev->sdev_gendev);
961 put_device(&sdev->sdev_dev);
962 put_device(&sdev->sdev_gendev);
963}
964
965#ifdef CONFIG_SCSI_LOGGING
966/**
967 * scsi_inq_str - print INQUIRY data from min to max index, strip trailing whitespace
968 * @buf: Output buffer with at least end-first+1 bytes of space
969 * @inq: Inquiry buffer (input)
970 * @first: Offset of string into inq
971 * @end: Index after last character in inq
972 */

--- 161 unchanged lines hidden (view full) ---

1134 if (scsi_device_get(sdev) == 0) {
1135 *sdevp = sdev;
1136 } else {
1137 __scsi_remove_device(sdev);
1138 res = SCSI_SCAN_NO_RESPONSE;
1139 }
1140 }
1141 } else
955#ifdef CONFIG_SCSI_LOGGING
956/**
957 * scsi_inq_str - print INQUIRY data from min to max index, strip trailing whitespace
958 * @buf: Output buffer with at least end-first+1 bytes of space
959 * @inq: Inquiry buffer (input)
960 * @first: Offset of string into inq
961 * @end: Index after last character in inq
962 */

--- 161 unchanged lines hidden (view full) ---

1124 if (scsi_device_get(sdev) == 0) {
1125 *sdevp = sdev;
1126 } else {
1127 __scsi_remove_device(sdev);
1128 res = SCSI_SCAN_NO_RESPONSE;
1129 }
1130 }
1131 } else
1142 scsi_destroy_sdev(sdev);
1132 __scsi_remove_device(sdev);
1143 out:
1144 return res;
1145}
1146
1147/**
1148 * scsi_sequential_lun_scan - sequentially scan a SCSI target
1149 * @starget: pointer to target structure to scan
1150 * @bflags: black/white list flag for LUN 0

--- 344 unchanged lines hidden (view full) ---

1495 out_err:
1496 kfree(lun_data);
1497 out:
1498 scsi_device_put(sdev);
1499 if (scsi_device_created(sdev))
1500 /*
1501 * the sdev we used didn't appear in the report luns scan
1502 */
1133 out:
1134 return res;
1135}
1136
1137/**
1138 * scsi_sequential_lun_scan - sequentially scan a SCSI target
1139 * @starget: pointer to target structure to scan
1140 * @bflags: black/white list flag for LUN 0

--- 344 unchanged lines hidden (view full) ---

1485 out_err:
1486 kfree(lun_data);
1487 out:
1488 scsi_device_put(sdev);
1489 if (scsi_device_created(sdev))
1490 /*
1491 * the sdev we used didn't appear in the report luns scan
1492 */
1503 scsi_destroy_sdev(sdev);
1493 __scsi_remove_device(sdev);
1504 return ret;
1505}
1506
1507struct scsi_device *__scsi_add_device(struct Scsi_Host *shost, uint channel,
1508 uint id, uint lun, void *hostdata)
1509{
1510 struct scsi_device *sdev = ERR_PTR(-ENODEV);
1511 struct device *parent = &shost->shost_gendev;

--- 193 unchanged lines hidden (view full) ---

1705}
1706
1707static void scsi_sysfs_add_devices(struct Scsi_Host *shost)
1708{
1709 struct scsi_device *sdev;
1710 shost_for_each_device(sdev, shost) {
1711 if (!scsi_host_scan_allowed(shost) ||
1712 scsi_sysfs_add_sdev(sdev) != 0)
1494 return ret;
1495}
1496
1497struct scsi_device *__scsi_add_device(struct Scsi_Host *shost, uint channel,
1498 uint id, uint lun, void *hostdata)
1499{
1500 struct scsi_device *sdev = ERR_PTR(-ENODEV);
1501 struct device *parent = &shost->shost_gendev;

--- 193 unchanged lines hidden (view full) ---

1695}
1696
1697static void scsi_sysfs_add_devices(struct Scsi_Host *shost)
1698{
1699 struct scsi_device *sdev;
1700 shost_for_each_device(sdev, shost) {
1701 if (!scsi_host_scan_allowed(shost) ||
1702 scsi_sysfs_add_sdev(sdev) != 0)
1713 scsi_destroy_sdev(sdev);
1703 __scsi_remove_device(sdev);
1714 }
1715}
1716
1717/**
1718 * scsi_prep_async_scan - prepare for an async scan
1719 * @shost: the host which will be scanned
1720 * Returns: a cookie to be passed to scsi_finish_async_scan()
1721 *

--- 216 unchanged lines hidden (view full) ---

1938 * Returns: Nothing
1939 *
1940 * Notes:
1941 */
1942void scsi_free_host_dev(struct scsi_device *sdev)
1943{
1944 BUG_ON(sdev->id != sdev->host->this_id);
1945
1704 }
1705}
1706
1707/**
1708 * scsi_prep_async_scan - prepare for an async scan
1709 * @shost: the host which will be scanned
1710 * Returns: a cookie to be passed to scsi_finish_async_scan()
1711 *

--- 216 unchanged lines hidden (view full) ---

1928 * Returns: Nothing
1929 *
1930 * Notes:
1931 */
1932void scsi_free_host_dev(struct scsi_device *sdev)
1933{
1934 BUG_ON(sdev->id != sdev->host->this_id);
1935
1946 scsi_destroy_sdev(sdev);
1936 __scsi_remove_device(sdev);
1947}
1948EXPORT_SYMBOL(scsi_free_host_dev);
1949
1937}
1938EXPORT_SYMBOL(scsi_free_host_dev);
1939