unmap_cmd_data(&tmp_evt->iu.srp.cmd, tmp_evt->hostdata->dev); 
unmap_cmd_data(&tmp_evt->iu.srp.cmd, tmp_evt, tmp_evt->hostdata->dev); 
static int ibmvscsi_eh_device_reset_handler(struct scsi_cmnd *cmd){	struct ibmvscsi_host_data *hostdata =	    (struct ibmvscsi_host_data *)cmd->device->host->hostdata;	struct srp_tsk_mgmt *tsk_mgmt;	struct srp_event_struct *evt;	struct srp_event_struct *tmp_evt, *pos;	union viosrp_iu srp_rsp;	int rsp_rc;	unsigned long flags;	u16 lun = lun_from_dev(cmd->device);	spin_lock_irqsave(hostdata->host->host_lock, flags);	evt = get_event_struct(&hostdata->pool);	if (evt == NULL) {		spin_unlock_irqrestore(hostdata->host->host_lock, flags);		printk(KERN_ERR "ibmvscsi: failed to allocate reset event\n");		return FAILED;	}		init_event_struct(evt,			  sync_completion,			  VIOSRP_SRP_FORMAT,			  init_timeout * HZ);	tsk_mgmt = &evt->iu.srp.tsk_mgmt;	/* Set up a lun reset SRP command */	memset(tsk_mgmt, 0x00, sizeof(*tsk_mgmt));	tsk_mgmt->type = SRP_TSK_MGMT_TYPE;	tsk_mgmt->lun = ((u64) lun) << 48;	tsk_mgmt->task_mgmt_flags = 0x08;	/* LUN RESET */	printk(KERN_INFO "ibmvscsi: resetting device. lun 0x%lx\n",	       tsk_mgmt->lun);	evt->sync_srp = &srp_rsp;	init_completion(&evt->comp);	rsp_rc = ibmvscsi_send_srp_event(evt, hostdata);	spin_unlock_irqrestore(hostdata->host->host_lock, flags);	if (rsp_rc != 0) {		printk(KERN_ERR "ibmvscsi: failed to send reset event\n");		return FAILED;	}	wait_for_completion(&evt->comp);	/* make sure we got a good response */	if (unlikely(srp_rsp.srp.generic.type != SRP_RSP_TYPE)) {		if (printk_ratelimit())			printk(KERN_WARNING 			       "ibmvscsi: reset bad SRP RSP type %d\n",			       srp_rsp.srp.generic.type);		return FAILED;	}	if (srp_rsp.srp.rsp.rspvalid)		rsp_rc = *((int *)srp_rsp.srp.rsp.sense_and_response_data);	else		rsp_rc = srp_rsp.srp.rsp.status;	if (rsp_rc) {		if (printk_ratelimit())			printk(KERN_WARNING 			       "ibmvscsi: reset code %d for task tag 0x%lx\n",		       rsp_rc,			       tsk_mgmt->managed_task_tag);		return FAILED;	}	/* We need to find all commands for this LUN that have not yet been	 * responded to, and fail them with DID_RESET	 */	spin_lock_irqsave(hostdata->host->host_lock, flags);	list_for_each_entry_safe(tmp_evt, pos, &hostdata->sent, list) {		if ((tmp_evt->cmnd) && (tmp_evt->cmnd->device == cmd->device)) {			if (tmp_evt->cmnd)				tmp_evt->cmnd->result = (DID_RESET << 16);			list_del(&tmp_evt->list);			unmap_cmd_data(&tmp_evt->iu.srp.cmd, tmp_evt->hostdata->dev);			free_event_struct(&tmp_evt->hostdata->pool,						   tmp_evt);			atomic_inc(&hostdata->request_limit);			if (tmp_evt->cmnd_done)				tmp_evt->cmnd_done(tmp_evt->cmnd);			else if (tmp_evt->done)				tmp_evt->done(tmp_evt);		}	}	spin_unlock_irqrestore(hostdata->host->host_lock, flags);	return SUCCESS;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/4dddbc26c3895ecdab1f4b16435685b47f96f599/ibmvscsi.c/buggy/drivers/scsi/ibmvscsi/ibmvscsi.c