Re: [Alsa-devel] Re: [linuxsh-dev] [PATCH] ALSA driver for YamaaAICA on Sega Dreamcast

From: Adrian McMenamin
Date: Mon Apr 17 2006 - 05:46:54 EST


On Mon, 2006-04-17 at 04:29 +0300, Paul Mundt wrote:
> A few quick comments.. though looking at the earlier thread, most of
> these were already pointed out..
>

>
> You can't be serious, you're trying to setup, transfer, and wait for
> completion for a DMA transfer while holding a spinlock? The fact this
> hasn't blown up on you is sheer luck. Use dma_wait_for_completion(), it
> does the right thing.
>
> Additionaly you need a timeout here if you were for some reason intent on
> doing this while working against the DMA subsystem, if your DMA gets
> stuck this will blow up.
>

As I wrote last week dma_wait_for_completion won't hack G2 DMA:


147 void dma_wait_for_completion(unsigned int chan)
148 {
149 struct dma_info *info = get_dma_info(chan);
150 struct dma_channel *channel = &info->channels[chan];
151
152 if (channel->flags & DMA_TEI_CAPABLE) {
153 wait_event(channel->wait_queue,
154 (info->ops->get_residue(channel) == 0));
155 return;
156 }
157
158 while (info->ops->get_residue(channel))
159 cpu_relax();
160 }

get_residue never returns 0 for G2 DMA. When the dma is complete get_residue returns the size of the total transfer. Therefore I've no choice but to write my own handler (spinlocks question aside).

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/