return; 
return 0; 
static void scsi_probe_lun(struct scsi_request *sreq, char *inq_result,			   int *bflags){	struct scsi_device *sdev = sreq->sr_device;	/* a bit ugly */	unsigned char scsi_cmd[MAX_COMMAND_SIZE];	int first_inquiry_len, try_inquiry_len, next_inquiry_len;	int response_len = 0;	int pass, count;	struct scsi_sense_hdr sshdr;	*bflags = 0;	/* Perform up to 3 passes.  The first pass uses a conservative	 * transfer length of 36 unless sdev->inquiry_len specifies a	 * different value. */	first_inquiry_len = sdev->inquiry_len ? sdev->inquiry_len : 36;	try_inquiry_len = first_inquiry_len;	pass = 1; next_pass:	SCSI_LOG_SCAN_BUS(3, printk(KERN_INFO "scsi scan: INQUIRY pass %d "			"to host %d channel %d id %d lun %d, length %d\n",			pass, sdev->host->host_no, sdev->channel,			sdev->id, sdev->lun, try_inquiry_len));	/* Each pass gets up to three chances to ignore Unit Attention */	for (count = 0; count < 3; ++count) {		memset(scsi_cmd, 0, 6);		scsi_cmd[0] = INQUIRY;		scsi_cmd[4] = (unsigned char) try_inquiry_len;		sreq->sr_cmd_len = 0;		sreq->sr_data_direction = DMA_FROM_DEVICE;		memset(inq_result, 0, try_inquiry_len);		scsi_wait_req(sreq, (void *) scsi_cmd, (void *) inq_result,				try_inquiry_len,				HZ/2 + HZ*scsi_inq_timeout, 3);		SCSI_LOG_SCAN_BUS(3, printk(KERN_INFO "scsi scan: INQUIRY %s "				"with code 0x%x\n",				sreq->sr_result ? "failed" : "successful",				sreq->sr_result));		if (sreq->sr_result) {			/*			 * not-ready to ready transition [asc/ascq=0x28/0x0]			 * or power-on, reset [asc/ascq=0x29/0x0], continue.			 * INQUIRY should not yield UNIT_ATTENTION			 * but many buggy devices do so anyway. 			 */			if ((driver_byte(sreq->sr_result) & DRIVER_SENSE) &&			    scsi_request_normalize_sense(sreq, &sshdr)) {				if ((sshdr.sense_key == UNIT_ATTENTION) &&				    ((sshdr.asc == 0x28) ||				     (sshdr.asc == 0x29)) &&				    (sshdr.ascq == 0))					continue;			}		}		break;	}	if (sreq->sr_result == 0) {		response_len = (unsigned char) inq_result[4] + 5;		if (response_len > 255)			response_len = first_inquiry_len;	/* sanity */		/*		 * Get any flags for this device.		 *		 * XXX add a bflags to Scsi_Device, and replace the		 * corresponding bit fields in Scsi_Device, so bflags		 * need not be passed as an argument.		 */		*bflags = scsi_get_device_flags(sdev, &inq_result[8],				&inq_result[16]);		/* When the first pass succeeds we gain information about		 * what larger transfer lengths might work. */		if (pass == 1) {			if (BLIST_INQUIRY_36 & *bflags)				next_inquiry_len = 36;			else if (BLIST_INQUIRY_58 & *bflags)				next_inquiry_len = 58;			else if (sdev->inquiry_len)				next_inquiry_len = sdev->inquiry_len;			else				next_inquiry_len = response_len;			/* If more data is available perform the second pass */			if (next_inquiry_len > try_inquiry_len) {				try_inquiry_len = next_inquiry_len;				pass = 2;				goto next_pass;			}		}	} else if (pass == 2) {		printk(KERN_INFO "scsi scan: %d byte inquiry failed.  "				"Consider BLIST_INQUIRY_36 for this device\n",				try_inquiry_len);		/* If this pass failed, the third pass goes back and transfers		 * the same amount as we successfully got in the first pass. */		try_inquiry_len = first_inquiry_len;		pass = 3;		goto next_pass;	}	/* If the last transfer attempt got an error, assume the	 * peripheral doesn't exist or is dead. */	if (sreq->sr_result)		return;	/* Don't report any more data than the device says is valid */	sdev->inquiry_len = min(try_inquiry_len, response_len);	/*	 * XXX Abort if the response length is less than 36? If less than	 * 32, the lookup of the device flags (above) could be invalid,	 * and it would be possible to take an incorrect action - we do	 * not want to hang because of a short INQUIRY. On the flip side,	 * if the device is spun down or becoming ready (and so it gives a	 * short INQUIRY), an abort here prevents any further use of the	 * device, including spin up.	 *	 * Related to the above issue:	 *	 * XXX Devices (disk or all?) should be sent a TEST UNIT READY,	 * and if not ready, sent a START_STOP to start (maybe spin up) and	 * then send the INQUIRY again, since the INQUIRY can change after	 * a device is initialized.	 *	 * Ideally, start a device if explicitly asked to do so.  This	 * assumes that a device is spun up on power on, spun down on	 * request, and then spun up on request.	 */	/*	 * The scanning code needs to know the scsi_level, even if no	 * device is attached at LUN 0 (SCSI_SCAN_TARGET_PRESENT) so	 * non-zero LUNs can be scanned.	 */	sdev->scsi_level = inq_result[2] & 0x07;	if (sdev->scsi_level >= 2 ||	    (sdev->scsi_level == 1 && (inq_result[3] & 0x0f) == 1))		sdev->scsi_level++;	return;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/392160335c798bbe94ab3aae6ea0c85d32b81bbc/scsi_scan.c/buggy/drivers/scsi/scsi_scan.c