Re: [PATCH v2] spi: qup: Add DMA capabilities

From: Andy Gross
Date: Tue Feb 24 2015 - 17:38:47 EST


On Tue, Feb 24, 2015 at 06:08:54PM +0200, Stanimir Varbanov wrote:

<snip>

>
> yes, there is a potential race between atomic_inc and dma callback. I
> reordered these calls to save few checks, and now it returns to me.
>
> I imagine few options here:
>
> - reorder the dmaengine calls and atomic operations, i.e.
> call atomic_inc for rx and tx channels before corresponding
> dmaengine_submit and dmaengine_issue_pending.
>
> - have two different dma callbacks and two completions and waiting for
> the two.

This is probably the better solution. The only thing you'll have to take into
consideration is that you may not have a RX DMA transactions.

>
> - manage to receive only one dma callback, i.e. the last transfer in
> case of presence of the rx_buf and tx_buf at the same time.

You use separate channels for the RX and TX, so as long as you have separate
callbacks, it shouldnt be a problem.


--
Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project

--
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/