lkml.org 
[lkml]   [2013]   [Oct]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1/2] dma: Add interface to calculate data transferred
On Fri, Oct 11, 2013 at 05:42:17PM -0400, Youquan Song wrote:
> Currently, the DMA channel calculates its data transferred only at network
> device driver. When other devices like UART or SPI etc, transfers data by DMA
> mode, but it always shows 0 at /sys/class/dma/dma0chan*/bytes_transferred.

Is that really a problem? I have never heard anyone complaining about
it. Where are the reports of this?

> This patch add a new function which will calculate how many the data has been
> transferred after doing it by DMA mode. It can be used by other modules and
> also simplify current duplicated code.
>
> Signed-off-by: Youquan Song <youquan.song@intel.com>
> ---
> drivers/dma/dmaengine.c | 35 +++++++++++++++++++----------------
> include/linux/dmaengine.h | 3 +++
> 2 files changed, 22 insertions(+), 16 deletions(-)
>
> diff --git a/drivers/dma/dmaengine.c b/drivers/dma/dmaengine.c
> index 9162ac8..4356a7e 100644
> --- a/drivers/dma/dmaengine.c
> +++ b/drivers/dma/dmaengine.c
> @@ -901,6 +901,23 @@ void dma_async_device_unregister(struct dma_device *device)
> }
> EXPORT_SYMBOL(dma_async_device_unregister);
>
> +dma_cookie_t
> +dma_tx_submit_cal(struct dma_async_tx_descriptor *tx,
> + struct dma_chan *chan, size_t len)
> +{
> +
> + dma_cookie_t cookie;
> + cookie = tx->tx_submit(tx);
> +
> + preempt_disable();
> + __this_cpu_add(chan->local->bytes_transferred, len);
> + __this_cpu_inc(chan->local->memcpy_count);
> + preempt_enable();
> +
> + return cookie;
> +
> +}

You create a function, yet no driver can use it as it's not exported, so
I guess you don't want anyone to use it :)

Anyway, I don't think this is a good idea, see my response to the serial
driver patch for why not.

sorry,

greg k-h


\
 
 \ /
  Last update: 2013-10-11 17:41    [W:0.112 / U:0.488 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site