Re: [PATCH] dmatest: Simple DMA memcpy test client

From: Haavard Skinnemoen
Date: Tue Jul 01 2008 - 09:53:42 EST


Subject: [PATCH] dmatest: Return DMA_NAK if nr_channels >= max_channels

"Sosnowski, Maciej" <maciej.sosnowski@xxxxxxxxx> wrote:
> In case when nr_channels exceeds max_channels
> ack should be rather set to DMA_NAK than DMA_DUP.

You're right. The below patch should take care of this.

Signed-off-by: Haavard Skinnemoen <haavard.skinnemoen@xxxxxxxxx>
---
drivers/dma/dmatest.c | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/dma/dmatest.c b/drivers/dma/dmatest.c
index 5c9fd10..a08d197 100644
--- a/drivers/dma/dmatest.c
+++ b/drivers/dma/dmatest.c
@@ -398,13 +398,13 @@ dmatest_event(struct dma_client *client, struct dma_chan *chan,

switch (state) {
case DMA_RESOURCE_AVAILABLE:
- if (dmatest_match_channel(chan)
- && dmatest_match_device(chan->device)
- && (!max_channels
- || nr_channels < max_channels))
- ack = dmatest_add_channel(chan);
- else
+ if (!dmatest_match_channel(chan)
+ || !dmatest_match_device(chan->device))
ack = DMA_DUP;
+ else if (max_channels && nr_channels >= max_channels)
+ ack = DMA_NAK;
+ else
+ ack = dmatest_add_channel(chan);
break;

case DMA_RESOURCE_REMOVED:
--
1.5.6

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