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) { /* * Scan for a specific host/chan/id/lun. */ scsi_probe_and_add_lun(starget, lun, NULL, NULL, rescan, NULL); goto out_reap; }  /* * 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(starget, 0, &bflags, &sdev, rescan, NULL); if (res == SCSI_SCAN_LUN_PRESENT) { if (scsi_report_lun_scan(sdev, bflags, rescan) != 0) /* * The REPORT LUN did not scan the target, * do a sequential scan. */ scsi_sequential_lun_scan(starget, bflags, res, sdev->scsi_level, rescan); } else if (res == SCSI_SCAN_TARGET_PRESENT) { /* * There's a target here, but lun 0 is offline so we * can't use the report_lun scan.  Fall back to a * sequential lun scan with a bflags of SPARSELUN and * a default scsi level of SCSI_2 */ scsi_sequential_lun_scan(starget, BLIST_SPARSELUN, SCSI_SCAN_TARGET_PRESENT, SCSI_2, rescan); } if (sdev) scsi_device_put(sdev);  out_reap: /* now determine if the target has any children at all * and if not, nuke it */ scsi_target_reap(starget);  put_device(&starget->dev); 
down(&shost->scan_mutex); if (scsi_host_scan_allowed(shost)) __scsi_scan_target(parent, channel, id, lun, rescan); up(&shost->scan_mutex); 
void scsi_scan_target(struct device *parent, unsigned int channel,		      unsigned int id, unsigned int lun, int rescan){	struct Scsi_Host *shost = dev_to_shost(parent);	int bflags = 0;	int res;	struct scsi_device *sdev = NULL;	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) {		/*		 * Scan for a specific host/chan/id/lun.		 */		scsi_probe_and_add_lun(starget, lun, NULL, NULL, rescan, NULL);		goto out_reap;	}	/*	 * 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(starget, 0, &bflags, &sdev, rescan, NULL);	if (res == SCSI_SCAN_LUN_PRESENT) {		if (scsi_report_lun_scan(sdev, bflags, rescan) != 0)			/*			 * The REPORT LUN did not scan the target,			 * do a sequential scan.			 */			scsi_sequential_lun_scan(starget, bflags,				       	res, sdev->scsi_level, rescan);	} else if (res == SCSI_SCAN_TARGET_PRESENT) {		/*		 * There's a target here, but lun 0 is offline so we		 * can't use the report_lun scan.  Fall back to a		 * sequential lun scan with a bflags of SPARSELUN and		 * a default scsi level of SCSI_2		 */		scsi_sequential_lun_scan(starget, BLIST_SPARSELUN,				SCSI_SCAN_TARGET_PRESENT, SCSI_2, rescan);	}	if (sdev)		scsi_device_put(sdev); out_reap:	/* now determine if the target has any children at all	 * and if not, nuke it */	scsi_target_reap(starget);	put_device(&starget->dev);}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/e517d3133f62c27b211f305a6dbd6f6ccac0db1b/scsi_scan.c/buggy/drivers/scsi/scsi_scan.c