spin_lock_irq(&adpt_wq_i2o_post.lock); __remove_wait_queue(&adpt_wq_i2o_post, &wait); spin_unlock_irqrestore(&adpt_wq_i2o_post.lock, flags); 
remove_wait_queue(&adpt_wq_i2o_post, &wait); 
static int adpt_i2o_post_wait(adpt_hba* pHba, u32* msg, int len, int timeout){	// I used my own version of the WAIT_QUEUE_HEAD	// to handle some version differences	// When embedded in the kernel this could go back to the vanilla one	ADPT_DECLARE_WAIT_QUEUE_HEAD(adpt_wq_i2o_post);	int status = 0;	ulong flags = 0;	struct adpt_i2o_post_wait_data *p1, *p2;	struct adpt_i2o_post_wait_data *wait_data =		kmalloc(sizeof(struct adpt_i2o_post_wait_data),GFP_KERNEL);	adpt_wait_queue_t wait;	if(!wait_data){		return -ENOMEM;	}	/*	 * The spin locking is needed to keep anyone from playing	 * with the queue pointers and id while we do the same	 */	spin_lock_irqsave(&adpt_post_wait_lock, flags);       // TODO we need a MORE unique way of getting ids       // to support async LCT get	wait_data->next = adpt_post_wait_queue;	adpt_post_wait_queue = wait_data;	adpt_post_wait_id++;	adpt_post_wait_id &= 0x7fff;	wait_data->id =  adpt_post_wait_id;	spin_unlock_irqrestore(&adpt_post_wait_lock, flags);	wait_data->wq = &adpt_wq_i2o_post;	wait_data->status = -ETIMEDOUT;	// this code is taken from kernel/sched.c:interruptible_sleep_on_timeout	wait.task = current;	init_waitqueue_entry(&wait, current);	spin_lock_irqsave(&adpt_wq_i2o_post.lock, flags);	__add_wait_queue(&adpt_wq_i2o_post, &wait);	spin_unlock(&adpt_wq_i2o_post.lock);	msg[2] |= 0x80000000 | ((u32)wait_data->id);	timeout *= HZ;	if((status = adpt_i2o_post_this(pHba, msg, len)) == 0){		set_current_state(TASK_INTERRUPTIBLE);		if(pHba->host)			spin_unlock_irq(pHba->host->host_lock);		if (!timeout)			schedule();		else{			timeout = schedule_timeout(timeout);			if (timeout == 0) {				// I/O issued, but cannot get result in				// specified time. Freeing resorces is				// dangerous.				status = -ETIME;			}		}		if(pHba->host)			spin_lock_irq(pHba->host->host_lock);	}	spin_lock_irq(&adpt_wq_i2o_post.lock);	__remove_wait_queue(&adpt_wq_i2o_post, &wait);	spin_unlock_irqrestore(&adpt_wq_i2o_post.lock, flags);	if(status == -ETIMEDOUT){		printk(KERN_INFO"dpti%d: POST WAIT TIMEOUT\n",pHba->unit);		// We will have to free the wait_data memory during shutdown		return status;	}	/* Remove the entry from the queue.  */	p2 = NULL;	spin_lock_irqsave(&adpt_post_wait_lock, flags);	for(p1 = adpt_post_wait_queue; p1; p2 = p1, p1 = p1->next) {		if(p1 == wait_data) {			if(p1->status == I2O_DETAIL_STATUS_UNSUPPORTED_FUNCTION ) {				status = -EOPNOTSUPP;			}			if(p2) {				p2->next = p1->next;			} else {				adpt_post_wait_queue = p1->next;			}			break;		}	}	spin_unlock_irqrestore(&adpt_post_wait_lock, flags);	kfree(wait_data);	return status;}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/4452ea509e29df2f019bed2f7a1e0f5eea092b26/dpt_i2o.c/buggy/drivers/scsi/dpt_i2o.c