list_remove_head(scsi_buf_list, lpfc_cmd, struct lpfc_scsi_buf, list); 
lpfc_cmd = lpfc_sli_get_scsi_buf (phba); 
__lpfc_reset_bus_handler(struct scsi_cmnd *cmnd){	struct Scsi_Host *shost = cmnd->device->host;	struct lpfc_hba *phba = (struct lpfc_hba *)shost->hostdata[0];	struct lpfc_nodelist *ndlp = NULL;	int match;	int ret = FAILED, i, err_count = 0;	int cnt, loopcnt;	unsigned int midlayer_id = 0;	struct lpfc_scsi_buf * lpfc_cmd = NULL;	struct list_head *scsi_buf_list = &phba->lpfc_scsi_buf_list;	list_remove_head(scsi_buf_list, lpfc_cmd, struct lpfc_scsi_buf, list);	if (lpfc_cmd == NULL)		goto out;	/* The lpfc_cmd storage is reused.  Set all loop invariants. */	lpfc_cmd->timeout = 60;	lpfc_cmd->pCmd = cmnd;	lpfc_cmd->scsi_hba = phba;	/*	 * Since the driver manages a single bus device, reset all	 * targets known to the driver.  Should any target reset	 * fail, this routine returns failure to the midlayer.	 */	midlayer_id = cmnd->device->id;	for (i = 0; i < MAX_FCP_TARGET; i++) {		/* Search the mapped list for this target ID */		match = 0;		list_for_each_entry(ndlp, &phba->fc_nlpmap_list, nlp_listp) {			if ((i == ndlp->nlp_sid) && ndlp->rport) {				match = 1;				break;			}		}		if (!match)			continue;		lpfc_cmd->pCmd->device->id = i;		lpfc_cmd->pCmd->device->hostdata = ndlp->rport->dd_data;		ret = lpfc_scsi_tgt_reset(lpfc_cmd, phba);		if (ret != SUCCESS) {			lpfc_printf_log(phba, KERN_INFO, LOG_FCP,				"%d:0713 Bus Reset on target %d failed\n",				phba->brd_no, i);			err_count++;		}	}	cmnd->device->id = midlayer_id;	loopcnt = 0;	while((cnt = lpfc_sli_sum_iocb(phba,				&phba->sli.ring[phba->sli.fcp_ring],				0, 0, LPFC_CTX_HOST))) {		spin_unlock_irq(phba->host->host_lock);		set_current_state(TASK_UNINTERRUPTIBLE);		schedule_timeout(LPFC_RESET_WAIT*HZ);		spin_lock_irq(phba->host->host_lock);		if (++loopcnt		    > (2 * phba->cfg_nodev_tmo)/LPFC_RESET_WAIT)			break;	}	if (cnt) {		/* flush all outstanding commands on the host */		i = lpfc_sli_abort_iocb(phba,				&phba->sli.ring[phba->sli.fcp_ring], 0, 0, 0,				LPFC_CTX_HOST);		lpfc_printf_log(phba, KERN_INFO, LOG_FCP,		   "%d:0715 Bus Reset I/O flush failure: cnt x%x left x%x\n",		   phba->brd_no, cnt, i);	}	if (!err_count)		ret = SUCCESS;	lpfc_free_scsi_buf(lpfc_cmd);	lpfc_printf_log(phba,			KERN_ERR,			LOG_FCP,			"%d:0714 SCSI layer issued Bus Reset Data: x%x\n",			phba->brd_no, ret);out:	return ret;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/0bd4ca25ad2ace4aa717c83dbd4ed21c53c953cb/lpfc_scsi.c/clean/drivers/scsi/lpfc/lpfc_scsi.c