Re: [PATCH] spi: tegra: slink: do not prepare dma transfer with DMA_CTRL_ACK flag

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tuesday 27 November 2012 03:33 AM, Stephen Warren wrote:
On 11/23/2012 02:22 AM, Laxman Dewangan wrote:
Spi starts transfer using dma with DMA_CTRL_ACK which is not require
becasue spi driver does not use completed dma_desc after transfer
done and so it does not ack the dma descriptor. Removing the
DMA_CTRL_ACK flag to avoid memory leak in dma driver.
I'm not quite sure, but isn't this the opposite of what's wanted. I
think that setting this flag in prep() means that the SPI driver need
not explicitly ack it later?

At least, tegra_dma_desc_get() returns an allocated descriptor if one
exists and async_tx_test_ack()==true for it, and it's true when the
DMA_CTRL_ACK flag is set, which happens either due to calling
async_tx_ack(), or because tegra_dma_prep_slave_sg() was called with
DMA_CTRL_ACK in flags.

I think DMA_CTRL_ACK flag is require if we want to free/reuse desc only when client ack it.

Although some part of implementation is wrong in the tegra20-apb-dma.c.

static struct tegra_dma_desc *tegra_dma_desc_get(
                struct tegra_dma_channel *tdc)
{
        struct tegra_dma_desc *dma_desc;
        unsigned long flags;

        spin_lock_irqsave(&tdc->lock, flags);

        /* Do not allocate if desc are waiting for ack */
        list_for_each_entry(dma_desc, &tdc->free_dma_desc, node) {
                if (async_tx_test_ack(&dma_desc->txd)) {
                        list_del(&dma_desc->node);
:::::::::::::::

}

In above it should be if (!async_tx_test_ack())

And when client done with the desc, then it can say as async_tx_clear_ack().

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


[Index of Archives]     [ARM Kernel]     [Linux ARM]     [Linux ARM MSM]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux