* Scsi_Device pointer, or NULL on failure.
**/
static struct scsi_device *scsi_alloc_sdev(struct Scsi_Host *shost,
- struct request_queue **q, uint channel, uint id, uint lun)
+ uint channel, uint id, uint lun)
{
struct scsi_device *sdev, *device;
*/
sdev->borken = 1;
- if (!q || *q == NULL) {
- sdev->request_queue = scsi_alloc_queue(shost);
- if (!sdev->request_queue)
- goto out_free_dev;
- } else {
- sdev->request_queue = *q;
- *q = NULL;
- }
+ sdev->request_queue = scsi_alloc_queue(shost);
+ if (!sdev->request_queue)
+ goto out_free_dev;
sdev->request_queue->queuedata = sdev;
scsi_adjust_queue_depth(sdev, 0, sdev->host->cmd_per_lun);
return sdev;
out_free_queue:
- if (q && sdev->request_queue) {
- *q = sdev->request_queue;
- sdev->request_queue = NULL;
- } else if (sdev->request_queue)
+ if (sdev->request_queue)
scsi_free_queue(sdev->request_queue);
out_free_dev:
* SCSI_SCAN_LUN_PRESENT: a new Scsi_Device was allocated and initialized
**/
static int scsi_probe_and_add_lun(struct Scsi_Host *host,
- struct request_queue **q, uint channel, uint id, uint lun,
- int *bflagsp, struct scsi_device **sdevp)
+ uint channel, uint id, uint lun, int *bflagsp,
+ struct scsi_device **sdevp)
{
struct scsi_device *sdev;
struct scsi_request *sreq;
unsigned char *result;
int bflags, res = SCSI_SCAN_NO_RESPONSE;
- sdev = scsi_alloc_sdev(host, q, channel, id, lun);
+ sdev = scsi_alloc_sdev(host, channel, id, lun);
if (!sdev)
goto out;
sreq = scsi_allocate_request(sdev);
if (res == SCSI_SCAN_LUN_PRESENT) {
if (sdevp)
*sdevp = sdev;
- } else {
- if (q) {
- *q = sdev->request_queue;
- sdev->request_queue = NULL;
- }
+ } else
scsi_free_sdev(sdev);
- }
out:
return res;
}
*
* Modifies sdevscan->lun.
**/
-static void scsi_sequential_lun_scan(struct Scsi_Host *shost,
- struct request_queue **q, uint channel, uint id,
- int bflags, int lun0_res, int scsi_level)
+static void scsi_sequential_lun_scan(struct Scsi_Host *shost, uint channel,
+ uint id, int bflags, int lun0_res, int scsi_level)
{
unsigned int sparse_lun, lun, max_dev_lun;
* sparse_lun.
*/
for (lun = 1; lun < max_dev_lun; ++lun)
- if ((scsi_probe_and_add_lun(shost, q, channel, id, lun,
+ if ((scsi_probe_and_add_lun(shost, channel, id, lun,
NULL, NULL) != SCSI_SCAN_LUN_PRESENT) && !sparse_lun)
return;
}
* 0: scan completed (or no memory, so further scanning is futile)
* 1: no report lun scan, or not configured
**/
-static int scsi_report_lun_scan(Scsi_Device *sdev, struct request_queue **q,
- int bflags)
+static int scsi_report_lun_scan(Scsi_Device *sdev, int bflags)
{
#ifdef CONFIG_SCSI_REPORT_LUNS
} else {
int res;
- res = scsi_probe_and_add_lun(sdev->host, q,
- sdev->channel, sdev->id, lun, NULL, NULL);
+ res = scsi_probe_and_add_lun(sdev->host, sdev->channel,
+ sdev->id, lun, NULL, NULL);
if (res == SCSI_SCAN_NO_RESPONSE) {
/*
* Got some results, but now none, abort.
struct scsi_device *sdev;
int error = -ENODEV, res;
- res = scsi_probe_and_add_lun(shost, NULL, channel, id, lun,
- NULL, &sdev);
+ res = scsi_probe_and_add_lun(shost, channel, id, lun, NULL, &sdev);
if (res == SCSI_SCAN_LUN_PRESENT)
error = scsi_attach_device(sdev);
* First try a REPORT LUN scan, if that does not scan the target, do a
* sequential scan of LUNs on the target id.
**/
-static void scsi_scan_target(struct Scsi_Host *shost, struct request_queue **q,
- unsigned int channel, unsigned int id)
+static void scsi_scan_target(struct Scsi_Host *shost, unsigned int channel,
+ unsigned int id)
{
int bflags = 0;
int res;
* Scan LUN 0, if there is some response, scan further. Ideally, we
* would not configure LUN 0 until all LUNs are scanned.
*/
- res = scsi_probe_and_add_lun(shost, q, channel, id, 0, &bflags, &sdev);
+ res = scsi_probe_and_add_lun(shost, channel, id, 0, &bflags, &sdev);
if (res == SCSI_SCAN_LUN_PRESENT) {
- if (scsi_report_lun_scan(sdev, q, bflags) != 0)
+ if (scsi_report_lun_scan(sdev, bflags) != 0)
/*
* The REPORT LUN did not scan the target,
* do a sequential scan.
*/
- scsi_sequential_lun_scan(shost, q, channel, id, bflags,
+ scsi_sequential_lun_scan(shost, channel, id, bflags,
res, sdev->scsi_level);
} else if (res == SCSI_SCAN_TARGET_PRESENT) {
/*
* sequential lun scan with a bflags of SPARSELUN and
* a default scsi level of SCSI_2
*/
- scsi_sequential_lun_scan(shost, q, channel, id, BLIST_SPARSELUN,
+ scsi_sequential_lun_scan(shost, channel, id, BLIST_SPARSELUN,
SCSI_SCAN_TARGET_PRESENT, SCSI_2);
}
}
**/
void scsi_scan_host(struct Scsi_Host *shost)
{
- struct request_queue *q = NULL;
uint channel, id, order_id;
/*
order_id = shost->max_id - id - 1;
else
order_id = id;
- scsi_scan_target(shost, &q, channel, order_id);
+ scsi_scan_target(shost, channel, order_id);
}
}
-
- if (q)
- scsi_free_queue(q);
}
void scsi_forget_host(struct Scsi_Host *shost)
{
struct scsi_device *sdev;
- sdev = scsi_alloc_sdev(shost, NULL, 0, shost->this_id, 0);
+ sdev = scsi_alloc_sdev(shost, 0, shost->this_id, 0);
if (sdev) {
sdev->borken = 0;
}