scsi_done(cmd); 
__scsi_done(cmd); 
int scsi_dispatch_cmd(struct scsi_cmnd *cmd){	struct Scsi_Host *host = cmd->device->host;	unsigned long flags = 0;	unsigned long timeout;	int rtn = 0;	/* check if the device is still usable */	if (unlikely(cmd->device->sdev_state == SDEV_DEL)) {		/* in SDEV_DEL we error all commands. DID_NO_CONNECT		 * returns an immediate error upwards, and signals		 * that the device is no longer present */		cmd->result = DID_NO_CONNECT << 16;		atomic_inc(&cmd->device->iorequest_cnt);		scsi_done(cmd);		/* return 0 (because the command has been processed) */		goto out;	}	/* Check to see if the scsi lld put this device into state SDEV_BLOCK. */	if (unlikely(cmd->device->sdev_state == SDEV_BLOCK)) {		/* 		 * in SDEV_BLOCK, the command is just put back on the device		 * queue.  The suspend state has already blocked the queue so		 * future requests should not occur until the device 		 * transitions out of the suspend state.		 */		scsi_queue_insert(cmd, SCSI_MLQUEUE_DEVICE_BUSY);		SCSI_LOG_MLQUEUE(3, printk("queuecommand : device blocked \n"));		/*		 * NOTE: rtn is still zero here because we don't need the		 * queue to be plugged on return (it's already stopped)		 */		goto out;	}	/* 	 * If SCSI-2 or lower, store the LUN value in cmnd.	 */	if (cmd->device->scsi_level <= SCSI_2) {		cmd->cmnd[1] = (cmd->cmnd[1] & 0x1f) |			       (cmd->device->lun << 5 & 0xe0);	}	/*	 * We will wait MIN_RESET_DELAY clock ticks after the last reset so	 * we can avoid the drive not being ready.	 */	timeout = host->last_reset + MIN_RESET_DELAY;	if (host->resetting && time_before(jiffies, timeout)) {		int ticks_remaining = timeout - jiffies;		/*		 * NOTE: This may be executed from within an interrupt		 * handler!  This is bad, but for now, it'll do.  The irq		 * level of the interrupt handler has been masked out by the		 * platform dependent interrupt handling code already, so the		 * sti() here will not cause another call to the SCSI host's		 * interrupt handler (assuming there is one irq-level per		 * host).		 */		while (--ticks_remaining >= 0)			mdelay(1 + 999 / HZ);		host->resetting = 0;	}	/* 	 * AK: unlikely race here: for some reason the timer could	 * expire before the serial number is set up below.	 */	scsi_add_timer(cmd, cmd->timeout_per_command, scsi_times_out);	scsi_log_send(cmd);	/*	 * We will use a queued command if possible, otherwise we will	 * emulate the queuing and calling of completion function ourselves.	 */	cmd->state = SCSI_STATE_QUEUED;	cmd->owner = SCSI_OWNER_LOWLEVEL;	atomic_inc(&cmd->device->iorequest_cnt);	/*	 * Before we queue this command, check if the command	 * length exceeds what the host adapter can handle.	 */	if (CDB_SIZE(cmd) > cmd->device->host->max_cmd_len) {		SCSI_LOG_MLQUEUE(3,				printk("queuecommand : command too long.\n"));		cmd->result = (DID_ABORT << 16);		scsi_done(cmd);		goto out;	}	spin_lock_irqsave(host->host_lock, flags);	scsi_cmd_get_serial(host, cmd); 	if (unlikely(test_bit(SHOST_CANCEL, &host->shost_state))) {		cmd->result = (DID_NO_CONNECT << 16);		scsi_done(cmd);	} else {		rtn = host->hostt->queuecommand(cmd, scsi_done);	}	spin_unlock_irqrestore(host->host_lock, flags);	if (rtn) {		atomic_inc(&cmd->device->iodone_cnt);		scsi_queue_insert(cmd,				(rtn == SCSI_MLQUEUE_DEVICE_BUSY) ?				 rtn : SCSI_MLQUEUE_HOST_BUSY);		SCSI_LOG_MLQUEUE(3,		    printk("queuecommand : request rejected\n"));	} out:	SCSI_LOG_MLQUEUE(3, printk("leaving scsi_dispatch_cmnd()\n"));	return rtn;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/69b528936b702d4c13ffa0d14215a029dc754e50/scsi.c/clean/drivers/scsi/scsi.c