kernels/linux-2.4.0/drivers/sound/ymfpci.c
/*
 * Wait until output is drained.
 * This does not kill the hardware for the sake of ioctls.
 */
Wait until output is drained.
This does not kill the hardware for the sake of ioctls.
Wait until output is drained . This does not kill the hardware for the sake of ioctls .
static void ymf_wait_dac(struct ymf_state *state)
{
	struct ymf_unit *unit = state->unit;
	ymfpci_pcm_t *ypcm = &state->ypcm;
	DECLARE_WAITQUEUE(waita, current);
	unsigned long flags;
	add_wait_queue(&state->dmabuf.wait, &waita);
	spin_lock_irqsave(&unit->reg_lock, flags);
	if (state->dmabuf.count != 0 && !state->ypcm.running) {
		ymf_playback_trigger(unit, ypcm, 1);
	}
#if 0
	if (file->f_flags & O_NONBLOCK) {
	}
#endif
	while (ypcm->running) {
		spin_unlock_irqrestore(&unit->reg_lock, flags);
		set_current_state(TASK_UNINTERRUPTIBLE);
		schedule();
		spin_lock_irqsave(&unit->reg_lock, flags);
	}
	spin_unlock_irqrestore(&unit->reg_lock, flags);
	set_current_state(TASK_RUNNING);
	remove_wait_queue(&state->dmabuf.wait, &waita);
}
static void ymf_wait_dac ( struct ymf_state * state ) { struct ymf_unit * unit = state -> unit ; ymfpci_pcm_t * ypcm = & state -> ypcm ; DECLARE_WAITQUEUE ( waita , current ) ; unsigned long flags ; add_wait_queue ( & state -> dmabuf . wait , & waita ) ; spin_lock_irqsave ( & unit -> reg_lock , flags ) ; if ( state -> dmabuf . count != 0 && ! state -> ypcm . running ) { ymf_playback_trigger ( unit , ypcm , 1 ) ; } #if 0 if ( file -> f_flags & O_NONBLOCK ) { } #endif while ( ypcm -> running ) { spin_unlock_irqrestore ( & unit -> reg_lock , flags ) ; set_current_state ( TASK_UNINTERRUPTIBLE ) ; schedule ( ) ; spin_lock_irqsave ( & unit -> reg_lock , flags ) ; } spin_unlock_irqrestore ( & unit -> reg_lock , flags ) ; set_current_state ( TASK_RUNNING ) ; remove_wait_queue ( & state -> dmabuf . wait , & waita ) ; }
Wait until output is drained.
Wait until output is drained .
/*
		 * XXX Our  mistake is to attach DMA buffer to state
		 * rather than to some per-device structure.
		 * Cannot skip waiting, can only make it shorter.
		 */ /*
	 * This function may take up to 4 seconds to reach this point
	 * (32K circular buffer, 8000 Hz). User notices.
	 */