[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1227032661.15042.10.camel@dwillia2-linux.ch.intel.com>
Date: Tue, 18 Nov 2008 11:24:21 -0700
From: Dan Williams <dan.j.williams@...el.com>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"Sosnowski, Maciej" <maciej.sosnowski@...el.com>,
"hskinnemoen@...el.com" <hskinnemoen@...el.com>,
"g.liakhovetski@....de" <g.liakhovetski@....de>,
"nicolas.ferre@...el.com" <nicolas.ferre@...el.com>
Subject: Re: [PATCH 08/13] dmatest: convert to dma_request_channel
On Fri, 2008-11-14 at 23:17 -0700, Andrew Morton wrote:
> On Fri, 14 Nov 2008 14:34:58 -0700 Dan Williams <dan.j.williams@...el.com> wrote:
>
> > static int __init dmatest_init(void)
> > {
> > - dma_cap_set(DMA_MEMCPY, dmatest_client.cap_mask);
> > - dma_async_client_register(&dmatest_client);
> > - dma_async_client_chan_request(&dmatest_client);
> > + dma_cap_mask_t mask;
> > + struct dma_chan *chan;
> > +
> > + dma_cap_zero(mask);
> > + dma_cap_set(DMA_MEMCPY, mask);
> > + for (;;) {
> > + chan = dma_request_channel(mask, filter, NULL);
> > + if (chan) {
> > + if (dmatest_add_channel(chan) == 0)
> > + continue;
>
> hrm. I trust this loop can't lock up the box.
>
Only if the system has infinite channels, but we should break if
dma_add_channel fails.
diff --git a/drivers/dma/dmatest.c b/drivers/dma/dmatest.c
index e0f9139..c77d47c 100644
--- a/drivers/dma/dmatest.c
+++ b/drivers/dma/dmatest.c
@@ -375,23 +375,27 @@ static int __init dmatest_init(void)
{
dma_cap_mask_t mask;
struct dma_chan *chan;
+ int err = 0;
dma_cap_zero(mask);
dma_cap_set(DMA_MEMCPY, mask);
for (;;) {
chan = dma_request_channel(mask, filter, NULL);
if (chan) {
- if (dmatest_add_channel(chan) == 0)
+ err = dmatest_add_channel(chan);
+ if (err == 0)
continue;
- else
+ else {
dma_release_channel(chan);
+ break; /* add_channel failed, punt */
+ }
} else
break; /* no more channels available */
if (max_channels && nr_channels >= max_channels)
break; /* we have all we need */
}
- return 0;
+ return err;
}
/* when compiled-in wait for drivers to load first */
late_initcall(dmatest_init);
---
Ok, so I now have:
# git shortlog `stg id akpm-review-spell-fixes.patch`^..
Dan Williams (6):
dmaengine review: spelling/grammar fixes
dmaengine review: dma_wait_for_async_tx clarification
dmaengine review: fix up kernel doc for dma_list_mutex usage
dmaengine review: propagate alloc_chan_resources error code
dmaengine review: return meaningful error code from initcall
dmaengine review: dmatest stop on dmatest_add_channel failure
May I add your Reviewed-by for these and the original 13. I could fold
these into the originals but perhaps it is better to document fixups
when they are the result of review [1].
Thanks,
Dan
[1] http://lwn.net/Articles/306690/
--
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