Re: [PATCH 1/2] dma: Add timb-dma
From: Dan Williams
Date: Thu Mar 25 2010 - 20:55:21 EST
On Thu, Mar 25, 2010 at 11:44 AM, Richard Röjfors
<richard.rojfors@xxxxxxxxxxxxxx> wrote:
> Adds the support for the DMA engine withing the timberdale FPGA.
>
> The DMA channels are strict device to host, or host to device
> and can not be used for generic memcpy.
>
> Signed-off-by: Richard Röjfors <richard.rojfors@xxxxxxxxxxxxxx>
[..]
> +struct timb_dma_chan {
> + struct dma_chan chan;
> + void __iomem *membase;
> + spinlock_t lock; /* Used for mutual exclusion */
Please add some value to this comment. I can assume it protects all
list manipulations, anything non-obvious worth noting?
[..]
> +
> +static int td_fill_desc(struct timb_dma_chan *td_chan, u8 *dma_desc,
> + struct scatterlist *sg, bool last)
> +{
> + if (sg_dma_len(sg) > USHORT_MAX) {
> + dev_err(chan2dev(&td_chan->chan), "Too big sg element\n");
> + return -EINVAL;
> + }
> +
> + /* length must be word aligned */
> + if (sg_dma_len(sg) % sizeof(u32)) {
> + dev_err(chan2dev(&td_chan->chan), "Incorrect length: %d\n",
> + sg_dma_len(sg));
> + return -EINVAL;
> + }
> +
> + dev_dbg(chan2dev(&td_chan->chan), "desc: %p, addr: %p\n",
> + dma_desc, (void *)(int)sg_dma_address(sg));
That (int) cast is not needed, causes a compiler warning, and can be dropped.
Nice simple driver. You can just send a follow up patch to fix up
those minor issues. I've pushed it out to my 'next' branch [1].
--
Dan
git://git.kernel.org/pub/scm/linux/kernel/git/djbw/async_tx.git next
--
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/