[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20080702095940.699fe704@hskinnemo-gx745.norway.atmel.com>
Date: Wed, 2 Jul 2008 09:59:40 +0200
From: Haavard Skinnemoen <haavard.skinnemoen@...el.com>
To: "Dan Williams" <dan.j.williams@...el.com>
Cc: "Pierre Ossman" <drzeus-list@...eus.cx>,
linux-kernel@...r.kernel.org, linux-embedded@...r.kernel.org,
kernel@...32linux.org, shannon.nelson@...el.com,
"David Brownell" <david-b@...bell.net>
Subject: Re: [PATCH v4 2/6] dmaengine: Add dma_chan_is_in_use() function
"Dan Williams" <dan.j.williams@...el.com> 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-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists