while(test_and_set_bit(board, (void *)&j->busyflags) != 0) { set_current_state(TASK_INTERRUPTIBLE); schedule_timeout(1); } 
while(test_and_set_bit(board, (void *)&j->busyflags) != 0) schedule_timeout_interruptible(1); 
static int ixj_release(struct inode *inode, struct file *file_p){	IXJ_TONE ti;	int cnt;	IXJ *j = file_p->private_data;	int board = j->p.board;	/*	 *    Set up locks to ensure that only one process is talking to the DSP at a time.	 *    This is necessary to keep the DSP from locking up.	 */	while(test_and_set_bit(board, (void *)&j->busyflags) != 0) {		set_current_state(TASK_INTERRUPTIBLE);		schedule_timeout(1);	}	if (ixjdebug & 0x0002)		printk(KERN_INFO "Closing board %d\n", NUM(inode));	if (j->cardtype == QTI_PHONECARD)		ixj_set_port(j, PORT_SPEAKER);	else		ixj_set_port(j, PORT_POTS);	aec_stop(j);	ixj_play_stop(j);	ixj_record_stop(j);	set_play_volume(j, 0x100);	set_rec_volume(j, 0x100);	ixj_ring_off(j);	/* Restore the tone table to default settings. */	ti.tone_index = 10;	ti.gain0 = 1;	ti.freq0 = hz941;	ti.gain1 = 0;	ti.freq1 = hz1209;	ixj_init_tone(j, &ti);	ti.tone_index = 11;	ti.gain0 = 1;	ti.freq0 = hz941;	ti.gain1 = 0;	ti.freq1 = hz1336;	ixj_init_tone(j, &ti);	ti.tone_index = 12;	ti.gain0 = 1;	ti.freq0 = hz941;	ti.gain1 = 0;	ti.freq1 = hz1477;	ixj_init_tone(j, &ti);	ti.tone_index = 13;	ti.gain0 = 1;	ti.freq0 = hz800;	ti.gain1 = 0;	ti.freq1 = 0;	ixj_init_tone(j, &ti);	ti.tone_index = 14;	ti.gain0 = 1;	ti.freq0 = hz1000;	ti.gain1 = 0;	ti.freq1 = 0;	ixj_init_tone(j, &ti);	ti.tone_index = 15;	ti.gain0 = 1;	ti.freq0 = hz1250;	ti.gain1 = 0;	ti.freq1 = 0;	ixj_init_tone(j, &ti);	ti.tone_index = 16;	ti.gain0 = 1;	ti.freq0 = hz950;	ti.gain1 = 0;	ti.freq1 = 0;	ixj_init_tone(j, &ti);	ti.tone_index = 17;	ti.gain0 = 1;	ti.freq0 = hz1100;	ti.gain1 = 0;	ti.freq1 = 0;	ixj_init_tone(j, &ti);	ti.tone_index = 18;	ti.gain0 = 1;	ti.freq0 = hz1400;	ti.gain1 = 0;	ti.freq1 = 0;	ixj_init_tone(j, &ti);	ti.tone_index = 19;	ti.gain0 = 1;	ti.freq0 = hz1500;	ti.gain1 = 0;	ti.freq1 = 0;	ixj_init_tone(j, &ti);	ti.tone_index = 20;	ti.gain0 = 1;	ti.freq0 = hz1600;	ti.gain1 = 0;	ti.freq1 = 0;	ixj_init_tone(j, &ti);	ti.tone_index = 21;	ti.gain0 = 1;	ti.freq0 = hz1800;	ti.gain1 = 0;	ti.freq1 = 0;	ixj_init_tone(j, &ti);	ti.tone_index = 22;	ti.gain0 = 1;	ti.freq0 = hz2100;	ti.gain1 = 0;	ti.freq1 = 0;	ixj_init_tone(j, &ti);	ti.tone_index = 23;	ti.gain0 = 1;	ti.freq0 = hz1300;	ti.gain1 = 0;	ti.freq1 = 0;	ixj_init_tone(j, &ti);	ti.tone_index = 24;	ti.gain0 = 1;	ti.freq0 = hz2450;	ti.gain1 = 0;	ti.freq1 = 0;	ixj_init_tone(j, &ti);	ti.tone_index = 25;	ti.gain0 = 1;	ti.freq0 = hz350;	ti.gain1 = 0;	ti.freq1 = hz440;	ixj_init_tone(j, &ti);	ti.tone_index = 26;	ti.gain0 = 1;	ti.freq0 = hz440;	ti.gain1 = 0;	ti.freq1 = hz480;	ixj_init_tone(j, &ti);	ti.tone_index = 27;	ti.gain0 = 1;	ti.freq0 = hz480;	ti.gain1 = 0;	ti.freq1 = hz620;	ixj_init_tone(j, &ti);	set_rec_depth(j, 2);	/* Set Record Channel Limit to 2 frames */	set_play_depth(j, 2);	/* Set Playback Channel Limit to 2 frames */	j->ex.bits.dtmf_ready = 0;	j->dtmf_state = 0;	j->dtmf_wp = j->dtmf_rp = 0;	j->rec_mode = j->play_mode = -1;	j->flags.ringing = 0;	j->maxrings = MAXRINGS;	j->ring_cadence = USA_RING_CADENCE;	if(j->cadence_f[5].enable) {		j->cadence_f[5].enable = j->cadence_f[5].en_filter = j->cadence_f[5].state = 0;	}	j->drybuffer = 0;	j->winktime = 320;	j->flags.dtmf_oob = 0;	for (cnt = 0; cnt < 4; cnt++)		j->cadence_f[cnt].enable = 0;	idle(j);	if(j->cardtype == QTI_PHONECARD) {		SLIC_SetState(PLD_SLIC_STATE_OC, j);	}	if (file_p->f_mode & FMODE_READ)		j->readers--;	if (file_p->f_mode & FMODE_WRITE)		j->writers--;	if (j->read_buffer && !j->readers) {		kfree(j->read_buffer);		j->read_buffer = NULL;		j->read_buffer_size = 0;	}	if (j->write_buffer && !j->writers) {		kfree(j->write_buffer);		j->write_buffer = NULL;		j->write_buffer_size = 0;	}	j->rec_codec = j->play_codec = 0;	j->rec_frame_size = j->play_frame_size = 0;	j->flags.cidsent = j->flags.cidring = 0;	ixj_fasync(-1, file_p, 0);	/* remove from list of async notification */	if(j->cardtype == QTI_LINEJACK && !j->readers && !j->writers) {		ixj_set_port(j, PORT_PSTN);		daa_set_mode(j, SOP_PU_SLEEP);		ixj_set_pots(j, 1);	}	ixj_WriteDSPCommand(0x0FE3, j);	/* Put the DSP in 1/5 power mode. */	/* Set up the default signals for events */	for (cnt = 0; cnt < 35; cnt++)		j->ixj_signals[cnt] = SIGIO;	/* Set the excetion signal enable flags */	j->ex_sig.bits.dtmf_ready = j->ex_sig.bits.hookstate = j->ex_sig.bits.flash = j->ex_sig.bits.pstn_ring = 	j->ex_sig.bits.caller_id = j->ex_sig.bits.pstn_wink = j->ex_sig.bits.f0 = j->ex_sig.bits.f1 = j->ex_sig.bits.f2 = 	j->ex_sig.bits.f3 = j->ex_sig.bits.fc0 = j->ex_sig.bits.fc1 = j->ex_sig.bits.fc2 = j->ex_sig.bits.fc3 = 1;	file_p->private_data = NULL;	clear_bit(board, &j->busyflags);	return 0;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/1e63bc7342c40f0f1dd83d80d368665bd06f4963/ixj.c/clean/drivers/telephony/ixj.c