"Dan Williams" <dan.j.williams@xxxxxxxxx> wrote: > Actually we will probably need something like the following. > ->client_count is protected by the dma_list_mutex. > > diff --git a/drivers/dma/dmaengine.c b/drivers/dma/dmaengine.c > index 99c22b4..10de69e 100644 > --- a/drivers/dma/dmaengine.c > +++ b/drivers/dma/dmaengine.c > @@ -183,9 +183,10 @@ static void dma_client_chan_alloc(struct > dma_client *client) > /* we are done once this client rejects > * an available resource > */ > - if (ack == DMA_ACK) > + if (ack == DMA_ACK) { > dma_chan_get(chan); > - else if (ack == DMA_NAK) > + chan->client_count++; > + } else if (ack == DMA_NAK) > return; > } This looks good to me. I can use client_count to determine if dwc->dws is actually valid so that channels that were initially allocated for a slave but NAK'ed or DUP'ed can be reclaimed for other purposes. It still doesn't solve the issue with memory wastage, but we probably shouldn't expect to keep a lot of unused channels around anyway. Thanks! Haavard -- To unsubscribe from this list: send the line "unsubscribe linux-embedded" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html