irq_ptr->state == QDIO_IRQ_STATE_ERR, QDIO_ESTABLISH_TIMEOUT); 
irq_ptr->state == QDIO_IRQ_STATE_ERR); 
qdio_establish(struct qdio_initialize *init_data){	struct qdio_irq *irq_ptr;	unsigned long saveflags;	int result, result2;	struct ccw_device *cdev;	char dbf_text[20];	cdev=init_data->cdev;	irq_ptr = cdev->private->qdio_data;	if (!irq_ptr)		return -EINVAL;	if (cdev->private->state != DEV_STATE_ONLINE)		return -EINVAL;		down(&irq_ptr->setting_up_sema);	qdio_fill_irq(init_data);	/* the thinint CHSC stuff */	if (irq_ptr->is_thinint_irq) {		result = tiqdio_set_subchannel_ind(irq_ptr,0);		if (result) {			up(&irq_ptr->setting_up_sema);			qdio_shutdown(cdev, QDIO_FLAG_CLEANUP_USING_CLEAR);			return result;		}		tiqdio_set_delay_target(irq_ptr,TIQDIO_DELAY_TARGET);	}	sprintf(dbf_text,"qest%4x",cdev->private->irq);	QDIO_DBF_TEXT0(0,setup,dbf_text);	QDIO_DBF_TEXT0(0,trace,dbf_text);	/* establish q */	irq_ptr->ccw.cmd_code=irq_ptr->equeue.cmd;	irq_ptr->ccw.flags=CCW_FLAG_SLI;	irq_ptr->ccw.count=irq_ptr->equeue.count;	irq_ptr->ccw.cda=QDIO_GET_ADDR(irq_ptr->qdr);	spin_lock_irqsave(get_ccwdev_lock(cdev),saveflags);	ccw_device_set_options(cdev, 0);	result=ccw_device_start_timeout(cdev,&irq_ptr->ccw,					QDIO_DOING_ESTABLISH,0, 0,					QDIO_ESTABLISH_TIMEOUT);	if (result) {		result2=ccw_device_start_timeout(cdev,&irq_ptr->ccw,						 QDIO_DOING_ESTABLISH,0,0,						 QDIO_ESTABLISH_TIMEOUT);		sprintf(dbf_text,"eq:io%4x",result);		QDIO_DBF_TEXT2(1,setup,dbf_text);		if (result2) {			sprintf(dbf_text,"eq:io%4x",result);			QDIO_DBF_TEXT2(1,setup,dbf_text);		}		QDIO_PRINT_WARN("establish queues on irq %04x: do_IO " \                           "returned %i, next try returned %i\n",                           irq_ptr->irq,result,result2);		result=result2;		if (result)			ccw_device_set_timeout(cdev, 0);	}	spin_unlock_irqrestore(get_ccwdev_lock(cdev),saveflags);	if (result) {		up(&irq_ptr->setting_up_sema);		qdio_shutdown(cdev,QDIO_FLAG_CLEANUP_USING_CLEAR);		return result;	}		wait_event_interruptible_timeout(cdev->private->wait_q,		 irq_ptr->state == QDIO_IRQ_STATE_ESTABLISHED ||		 irq_ptr->state == QDIO_IRQ_STATE_ERR,		 QDIO_ESTABLISH_TIMEOUT);	if (irq_ptr->state == QDIO_IRQ_STATE_ESTABLISHED)		result = 0;	else {		up(&irq_ptr->setting_up_sema);		qdio_shutdown(cdev, QDIO_FLAG_CLEANUP_USING_CLEAR);		return -EIO;	}	irq_ptr->qdioac=qdio_check_siga_needs(irq_ptr->irq);	/* if this gets set once, we're running under VM and can omit SVSes */	if (irq_ptr->qdioac&CHSC_FLAG_SIGA_SYNC_NECESSARY)		omit_svs=1;	sprintf(dbf_text,"qdioac%2x",irq_ptr->qdioac);	QDIO_DBF_TEXT2(0,setup,dbf_text);	sprintf(dbf_text,"qib ac%2x",irq_ptr->qib.ac);	QDIO_DBF_TEXT2(0,setup,dbf_text);	irq_ptr->hydra_gives_outbound_pcis=		irq_ptr->qib.ac&QIB_AC_OUTBOUND_PCI_SUPPORTED;	irq_ptr->sync_done_on_outb_pcis=		irq_ptr->qdioac&CHSC_FLAG_SIGA_SYNC_DONE_ON_OUTB_PCIS;	qdio_initialize_set_siga_flags_input(irq_ptr);	qdio_initialize_set_siga_flags_output(irq_ptr);	up(&irq_ptr->setting_up_sema);	return result;	}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/cdb32dc90bd38503befd1f4d0b762a1ace09bb28/qdio.c/clean/drivers/s390/cio/qdio.c