Commit a182f7a3 authored by Christoph Hellwig's avatar Christoph Hellwig

[PATCH] get rid of scan_scsis

this function was a multiplexer for two very different things, but
with my last patch one of those faded away and only one callers
is left.  Simplify it to what's still needed and rename to
scsi_scan_host.
parent 865e9146
...@@ -315,7 +315,7 @@ int scsi_add_host(struct Scsi_Host *shost) ...@@ -315,7 +315,7 @@ int scsi_add_host(struct Scsi_Host *shost)
sht->info ? sht->info(shost) : sht->name); sht->info ? sht->info(shost) : sht->name);
device_register(&shost->host_driverfs_dev); device_register(&shost->host_driverfs_dev);
scan_scsis(shost, 0, 0, 0, 0); scsi_scan_host(shost);
for (sdev = shost->host_queue; sdev; sdev = sdev->next) { for (sdev = shost->host_queue; sdev; sdev = sdev->next) {
if (sdev->host->hostt != sht) if (sdev->host->hostt != sht)
......
...@@ -519,7 +519,7 @@ static inline void scsi_set_pci_device(struct Scsi_Host *shost, ...@@ -519,7 +519,7 @@ static inline void scsi_set_pci_device(struct Scsi_Host *shost,
/* /*
* Prototypes for functions/data in scsi_scan.c * Prototypes for functions/data in scsi_scan.c
*/ */
extern void scan_scsis(struct Scsi_Host *, uint, uint, uint, uint); extern void scsi_scan_host(struct Scsi_Host *);
struct Scsi_Device_Template struct Scsi_Device_Template
{ {
......
...@@ -1990,71 +1990,17 @@ static void scsi_scan_target(Scsi_Device *sdevscan, struct Scsi_Host *shost, ...@@ -1990,71 +1990,17 @@ static void scsi_scan_target(Scsi_Device *sdevscan, struct Scsi_Host *shost,
} }
/** /**
* scsi_scan_selected_lun - probe and add one LUN * scsi_scan_host - scan the given adapter
*
* Description:
* Probe a single LUN on @shost, @channel, @id and @lun. If the LUN is
* found, set the queue depth, allocate command blocks, and call
* init/attach/finish of the upper level (sd, sg, etc.) drivers.
**/
static void scsi_scan_selected_lun(struct Scsi_Host *shost, uint channel,
uint id, uint lun)
{
Scsi_Device *sdevscan, *sdev = NULL;
int res;
if ((channel > shost->max_channel) || (id >= shost->max_id) ||
(lun >= shost->max_lun))
return;
sdevscan = scsi_alloc_sdev(shost, channel, id, lun);
if (sdevscan == NULL)
return;
sdevscan->scsi_level = scsi_find_scsi_level(channel, id, shost);
res = scsi_probe_and_add_lun(sdevscan, &sdev, NULL);
scsi_free_sdev(sdevscan);
if (res != SCSI_SCAN_LUN_PRESENT)
return;
scsi_attach_device(sdev);
}
/**
* scan_scsis - scan the given adapter, or scan a single LUN
* @shost: adapter to scan * @shost: adapter to scan
* @hardcoded: 1 if a single channel/id/lun should be scanned, else 0
* @hchannel: channel to scan for hardcoded case
* @hid: target id to scan for hardcoded case
* @hlun: lun to scan for hardcoded case
* *
* Description: * Description:
* If @hardcoded is 1, call scsi_scan_selected_lun to scan a single * Iterate and call scsi_scan_target to scan all possible target id's
* LUN; else, iterate and call scsi_scan_target to scan all possible * on all possible channels.
* target id's on all possible channels.
**/ **/
void scan_scsis(struct Scsi_Host *shost, uint hardcoded, uint hchannel, void scsi_scan_host(struct Scsi_Host *shost)
uint hid, uint hlun)
{ {
if (hardcoded == 1) { struct scsi_device *sdevscan;
/* uint channel, id, order_id;
* XXX Overload hchannel/hid/hlun to figure out what to
* scan, and use the standard scanning code rather than
* this function - that way, an entire bus (or fabric), or
* target id can be scanned. There are problems with queue
* depth and the init/attach/finish that must be resolved
* before (re-)scanning can handle finding more than one new
* LUN.
*
* For example, set hchannel 0 and hid to 5, and hlun to -1
* in order to scan all LUNs on channel 0, target id 5.
*/
scsi_scan_selected_lun(shost, hchannel, hid, hlun);
} else {
Scsi_Device *sdevscan;
uint channel;
unsigned int id, order_id;
/* /*
* The blk layer queue allocation is a bit expensive to * The blk layer queue allocation is a bit expensive to
...@@ -2096,5 +2042,4 @@ void scan_scsis(struct Scsi_Host *shost, uint hardcoded, uint hchannel, ...@@ -2096,5 +2042,4 @@ void scan_scsis(struct Scsi_Host *shost, uint hardcoded, uint hchannel,
} }
} }
scsi_free_sdev(sdevscan); scsi_free_sdev(sdevscan);
}
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment