diff mbox

dmaengine: add helper function for slave_single

Message ID 1311608235.8206.24.camel@vkoul-mobl4 (mailing list archive)
State New, archived
Headers show

Commit Message

Vinod Koul July 25, 2011, 3:37 p.m. UTC
From af9afd16e9954edb45f0cf71834653133d75e79c Mon Sep 17 00:00:00 2001
From: Vinod Koul <vinod.koul@intel.com>
Date: Mon, 25 Jul 2011 19:57:52 +0530
Subject: [PATCH] dmaengine: add helper function for slave_single

For clients which require a single slave transfer and dont want to be bothered
about the scatterlist api, this helper gives simple API for this transfer and
creates single scatterlist for DMA API

Idea from Russel King

Signed-off-by: Vinod Koul <vinod.koul@intel.com>
---
 include/linux/dmaengine.h |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

Comments

Russell King - ARM Linux July 25, 2011, 3:47 p.m. UTC | #1
On Mon, Jul 25, 2011 at 09:07:15PM +0530, Vinod Koul wrote:
> >From af9afd16e9954edb45f0cf71834653133d75e79c Mon Sep 17 00:00:00 2001
> From: Vinod Koul <vinod.koul@intel.com>
> Date: Mon, 25 Jul 2011 19:57:52 +0530
> Subject: [PATCH] dmaengine: add helper function for slave_single
> 
> For clients which require a single slave transfer and dont want to be bothered
> about the scatterlist api, this helper gives simple API for this transfer and
> creates single scatterlist for DMA API
> 
> Idea from Russel King

Please correct this, thanks.
Vinod Koul Aug. 4, 2011, 4:27 a.m. UTC | #2
On Mon, 2011-07-25 at 16:47 +0100, Russell King - ARM Linux wrote:
> On Mon, Jul 25, 2011 at 09:07:15PM +0530, Vinod Koul wrote:
> > >From af9afd16e9954edb45f0cf71834653133d75e79c Mon Sep 17 00:00:00 2001
> > From: Vinod Koul <vinod.koul@intel.com>
> > Date: Mon, 25 Jul 2011 19:57:52 +0530
> > Subject: [PATCH] dmaengine: add helper function for slave_single
> > 
> > For clients which require a single slave transfer and dont want to be bothered
> > about the scatterlist api, this helper gives simple API for this transfer and
> > creates single scatterlist for DMA API
> > 
> > Idea from Russel King
> 
> Please correct this, thanks.
Your wish, I recall you posting similar code in some other thread

I will apply this so that ppl can start using it
diff mbox

Patch

diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
index eee7add..97dafc6 100644
--- a/include/linux/dmaengine.h
+++ b/include/linux/dmaengine.h
@@ -517,6 +517,16 @@  static inline int dmaengine_slave_config(struct dma_chan *chan,
 			(unsigned long)config);
 }
 
+static inline struct dma_async_tx_descriptor *dmaengine_prep_slave_single(
+	struct dma_chan *chan, void *buf, size_t len,
+	enum dma_data_direction dir, unsigned long flags)
+{
+	struct scatterlist sg;
+	sg_init_one(&sg, buf, len);
+
+	return chan->device->device_prep_slave_sg(chan, &sg, 1, dir, flags);
+}
+
 static inline int dmaengine_terminate_all(struct dma_chan *chan)
 {
 	return dmaengine_device_control(chan, DMA_TERMINATE_ALL, 0);