[scsi hcil 5/9] split up __spi_scan_target()

Jeff Garzik
2005-10-24T22:03:07Z

commit 732f2c555a9778d44905e6dcbcab4caab9a29475
Author: Jeff Garzik <jgarzik@pobox.com>
Date: Mon Oct 24 15:35:30 2005 -0400

[SCSI] split up __spi_scan_target()

Split up __spi_scan_target() into two logical pieces:
* struct scsi_target scanning
* SPI-specific scsi_target allocation

This paves the way for an SPI-independent scsi_scan_target().

drivers/scsi/scsi_scan.c | 33 +++++++++++++++++++--------------
1 files changed, 19 insertions(+), 14 deletions(-)

diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
index 0cbcbe7..205c89f 100644
--- a/drivers/scsi/scsi_scan.c
+++ b/drivers/scsi/scsi_scan.c
@@ -1306,23 +1306,11 @@ void scsi_rescan_device(struct device *d
}
EXPORT_SYMBOL(scsi_rescan_device);

-static void __spi_scan_target(struct device *parent, unsigned int channel,
- unsigned int id, unsigned int lun, int rescan)
+static void __scsi_scan_target(struct scsi_target *starget, unsigned int lun,
+ int rescan)
{
- struct Scsi_Host *shost = dev_to_shost(parent);
int bflags = 0;
int res;
- struct scsi_target *starget;
-
- if (shost->this_id == id)
- /*
- * Don't scan the host adapter
- */
- return;
-
- starget = scsi_alloc_target(parent, channel, id);
- if (!starget)
- return;

get_device(&starget->dev);
if (lun != SCAN_WILD_CARD) {
@@ -1356,6 +1344,23 @@ static void __spi_scan_target(struct dev
put_device(&starget->dev);
}

+static void __spi_scan_target(struct device *parent, unsigned int channel,
+ unsigned int id, unsigned int lun, int rescan)
+{
+ struct Scsi_Host *shost = dev_to_shost(parent);
+ struct scsi_target *starget;
+
+ if (shost->this_id == id)
+ /*
+ * Don't scan the host adapter
+ */
+ return;
+
+ starget = scsi_alloc_target(parent, channel, id);
+ if (starget)
+ __scsi_scan_target(starget, lun, rescan);
+}
+
/**
* spi_scan_target - scan a target id, possibly including all LUNs on the
* target.