Re: [PATCH] dma: Revert "dmaengine: mic_x100: add missing spin_unlock"

From: Lars-Peter Clausen
Date: Mon Jan 04 2016 - 09:35:43 EST


On 01/04/2016 04:35 AM, Vinod Koul wrote:
> On Tue, Dec 22, 2015 at 07:35:23PM -0800, Ashutosh Dixit wrote:
>> This reverts commit e958e079e254 ("dmaengine: mic_x100: add missing
>> spin_unlock").
>>
>> The above patch is incorrect. There is nothing wrong with the original
>> code. The spin_lock is acquired in the "prep" functions and released
>> in "submit".
>
> And going by dmaengine sematics, I do not think that is entrely right.
>
> A user may choose to prepare multiple desciptors and then sumbit later,
> looking at code I do not see how that will work.

The DMAengine API actually mandates that prep and submit must always be
called in pairs, without any other DMAengine calls in between. The patch is
correct.

Quoting from Documentation/dmaengine/client.txt:

Once a descriptor has been obtained, the callback information can be
added and the descriptor must then be submitted. Some DMA engine
drivers may hold a spinlock between a successful preparation and
submission so it is important that these two operations are closely
paired.
--
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/