diff -r 2f92ad2dc5db -r 1df514389a47 kernel/eka/drivers/dma/dmapil.cpp --- a/kernel/eka/drivers/dma/dmapil.cpp Wed Mar 31 23:38:45 2010 +0300 +++ b/kernel/eka/drivers/dma/dmapil.cpp Wed Apr 14 17:22:59 2010 +0300 @@ -491,20 +491,20 @@ *iChannel.iNullPtr = iFirstHdr; iChannel.iNullPtr = &(iLastHdr->iNext); iChannel.DoQueue(*this); + __DMA_INVARIANT(); iChannel.Signal(); } else { // Someone is cancelling all requests... req_count = --iChannel.iQueuedRequests; + __DMA_INVARIANT(); iChannel.Signal(); if (req_count == 0) { iChannel.QueuedRequestCountChanged(); } } - - __DMA_INVARIANT(); } EXPORT_C TInt DDmaRequest::ExpandDesList(TInt aCount) @@ -574,7 +574,15 @@ void DDmaRequest::Invariant() { - iChannel.Wait(); + // This invariant may be called either with, + // or without the channel lock already held + TBool channelLockAquired=EFalse; + if(!iChannel.iLock.HeldByCurrentThread()) + { + iChannel.Wait(); + channelLockAquired = ETrue; + } + __DMA_ASSERTD(iChannel.IsOpened()); __DMA_ASSERTD(0 <= iMaxTransferSize); __DMA_ASSERTD(0 <= iDesCount && iDesCount <= iChannel.iMaxDesCount); @@ -588,7 +596,11 @@ __DMA_ASSERTD(iChannel.iController->IsValidHdr(iFirstHdr)); __DMA_ASSERTD(iChannel.iController->IsValidHdr(iLastHdr)); } - iChannel.Signal(); + + if(channelLockAquired) + { + iChannel.Signal(); + } } #endif