mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
To: Vinod Koul <vinod.koul@intel.com>
Cc: dan.j.williams@intel.com, linux-kernel@vger.kernel.org,
	jaswinder.singh@linaro.org, 21cnbao@gmail.com,
	rmk@arm.linux.org.uk, Vinod Koul <vinod.koul@linux.intel.com>,
	Russell King <rmk+kernel@arm.linux.org.uk>,
	Viresh Kumar <viresh.kumar@st.com>,
	Linus Walleij <linus.walleij@linaro.org>,
	Nicolas Ferre <nicolas.ferre@atmel.com>,
	Mika Westerberg <mika.westerberg@iki.fi>,
	H Hartley Sweeten <hartleys@visionengravers.com>,
	Li Yang <leoli@freescale.com>, Zhang Wei <zw@zh-kernel.org>,
	Sascha Hauer <s.hauer@pengutronix.de>,
	Shawn Guo <shawn.guo@freescale.com>,
	Yong Wang <yong.y.wang@intel.com>,
	Tomoya MORINAGA <tomoya-linux@dsn.lapis-semi.com>,
	Boojin Kim <boojin.kim@samsung.com>,
	Barry Song <Baohua.Song@csr.com>
Subject: Re: [PATCH 02/10] dmaengine: move drivers to dma_transfer_direction
Date: Mon, 17 Oct 2011 14:52:29 +0200 (CEST)	[thread overview]
Message-ID: <Pine.LNX.4.64.1110171023070.18438@axis700.grange> (raw)
In-Reply-To: <1318570705-17595-3-git-send-email-vinod.koul@intel.com>

A general note to this rework. I haven't been cc'ed on patch 00/10, so, 
replying here. Are we sure it is a good idea to name these new macros like 
this:

MEM_TO_DEV,
DEV_TO_MEM,
...

i.e., without a common namespace? Wouldn't something like DMA_DIRECTION_* 
be better?

On Fri, 14 Oct 2011, Vinod Koul wrote:

> From: Vinod Koul <vinod.koul@linux.intel.com>
> 
> Signed-off-by: Vinod Koul <vinod.koul@linux.intel.com>
> Cc: Jassi Brar <jaswinder.singh@linaro.org>
> Cc: Russell King <rmk+kernel@arm.linux.org.uk>
> Cc: Viresh Kumar <viresh.kumar@st.com>
> Cc: Linus Walleij <linus.walleij@linaro.org>
> Cc: Nicolas Ferre <nicolas.ferre@atmel.com>
> Cc: Mika Westerberg <mika.westerberg@iki.fi>
> Cc: H Hartley Sweeten <hartleys@visionengravers.com>
> Cc: Li Yang <leoli@freescale.com>
> Cc: Zhang Wei <zw@zh-kernel.org>
> Cc: Sascha Hauer <s.hauer@pengutronix.de>
> Cc: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
> Cc: Shawn Guo <shawn.guo@freescale.com>
> Cc: Yong Wang <yong.y.wang@intel.com>
> Cc: Tomoya MORINAGA <tomoya-linux@dsn.lapis-semi.com>
> Cc: Boojin Kim <boojin.kim@samsung.com>
> Cc: Barry Song <Baohua.Song@csr.com>
> ---

[snip]

> diff --git a/drivers/dma/shdma.c b/drivers/dma/shdma.c
> index 81809c2..cab7d3e 100644
> --- a/drivers/dma/shdma.c
> +++ b/drivers/dma/shdma.c
> @@ -23,7 +23,6 @@
>  #include <linux/interrupt.h>
>  #include <linux/dmaengine.h>
>  #include <linux/delay.h>
> -#include <linux/dma-mapping.h>
>  #include <linux/platform_device.h>
>  #include <linux/pm_runtime.h>
>  #include <linux/sh_dma.h>
> @@ -479,19 +478,19 @@ static void sh_dmae_free_chan_resources(struct dma_chan *chan)
>   * @sh_chan:	DMA channel
>   * @flags:	DMA transfer flags
>   * @dest:	destination DMA address, incremented when direction equals
> - *		DMA_FROM_DEVICE or DMA_BIDIRECTIONAL
> + *		DEV_TO_MEM
>   * @src:	source DMA address, incremented when direction equals
> - *		DMA_TO_DEVICE or DMA_BIDIRECTIONAL
> + *		MEM_TO_DEV

Why have you changed the above two comments? Doesn't seem correct to me.

>   * @len:	DMA transfer length
>   * @first:	if NULL, set to the current descriptor and cookie set to -EBUSY
>   * @direction:	needed for slave DMA to decide which address to keep constant,
> - *		equals DMA_BIDIRECTIONAL for MEMCPY
> + *		equals MEM_TO_MEM for MEMCPY
>   * Returns 0 or an error
>   * Locks: called with desc_lock held
>   */
>  static struct sh_desc *sh_dmae_add_desc(struct sh_dmae_chan *sh_chan,
>  	unsigned long flags, dma_addr_t *dest, dma_addr_t *src, size_t *len,
> -	struct sh_desc **first, enum dma_data_direction direction)
> +	struct sh_desc **first, enum dma_transfer_direction direction)
>  {
>  	struct sh_desc *new;
>  	size_t copy_size;
> @@ -531,9 +530,9 @@ static struct sh_desc *sh_dmae_add_desc(struct sh_dmae_chan *sh_chan,
>  	new->direction = direction;
>  
>  	*len -= copy_size;
> -	if (direction == DMA_BIDIRECTIONAL || direction == DMA_TO_DEVICE)
> +	if (direction == MEM_TO_MEM || direction == MEM_TO_DEV)
>  		*src += copy_size;
> -	if (direction == DMA_BIDIRECTIONAL || direction == DMA_FROM_DEVICE)
> +	if (direction == MEM_TO_MEM || direction == DEV_TO_MEM)
>  		*dest += copy_size;
>  
>  	return new;
> @@ -546,12 +545,12 @@ static struct sh_desc *sh_dmae_add_desc(struct sh_dmae_chan *sh_chan,
>   * converted to scatter-gather to guarantee consistent locking and a correct
>   * list manipulation. For slave DMA direction carries the usual meaning, and,
>   * logically, the SG list is RAM and the addr variable contains slave address,
> - * e.g., the FIFO I/O register. For MEMCPY direction equals DMA_BIDIRECTIONAL
> + * e.g., the FIFO I/O register. For MEMCPY direction equals MEM_TO_MEM
>   * and the SG list contains only one element and points at the source buffer.
>   */
>  static struct dma_async_tx_descriptor *sh_dmae_prep_sg(struct sh_dmae_chan *sh_chan,
>  	struct scatterlist *sgl, unsigned int sg_len, dma_addr_t *addr,
> -	enum dma_data_direction direction, unsigned long flags)
> +	enum dma_transfer_direction direction, unsigned long flags)
>  {
>  	struct scatterlist *sg;
>  	struct sh_desc *first = NULL, *new = NULL /* compiler... */;
> @@ -592,7 +591,7 @@ static struct dma_async_tx_descriptor *sh_dmae_prep_sg(struct sh_dmae_chan *sh_c
>  			dev_dbg(sh_chan->dev, "Add SG #%d@%p[%d], dma %llx\n",
>  				i, sg, len, (unsigned long long)sg_addr);
>  
> -			if (direction == DMA_FROM_DEVICE)
> +			if (direction == DEV_TO_MEM)
>  				new = sh_dmae_add_desc(sh_chan, flags,
>  						&sg_addr, addr, &len, &first,
>  						direction);
> @@ -646,13 +645,13 @@ static struct dma_async_tx_descriptor *sh_dmae_prep_memcpy(
>  	sg_dma_address(&sg) = dma_src;
>  	sg_dma_len(&sg) = len;
>  
> -	return sh_dmae_prep_sg(sh_chan, &sg, 1, &dma_dest, DMA_BIDIRECTIONAL,
> +	return sh_dmae_prep_sg(sh_chan, &sg, 1, &dma_dest, MEM_TO_MEM,
>  			       flags);
>  }
>  
>  static struct dma_async_tx_descriptor *sh_dmae_prep_slave_sg(
>  	struct dma_chan *chan, struct scatterlist *sgl, unsigned int sg_len,
> -	enum dma_data_direction direction, unsigned long flags)
> +	enum dma_transfer_direction direction, unsigned long flags)
>  {
>  	struct sh_dmae_slave *param;
>  	struct sh_dmae_chan *sh_chan;
> @@ -996,7 +995,7 @@ static void dmae_do_tasklet(unsigned long data)
>  	spin_lock_irq(&sh_chan->desc_lock);
>  	list_for_each_entry(desc, &sh_chan->ld_queue, node) {
>  		if (desc->mark == DESC_SUBMITTED &&
> -		    ((desc->direction == DMA_FROM_DEVICE &&
> +		    ((desc->direction == DEV_TO_MEM &&
>  		      (desc->hw.dar + desc->hw.tcr) == dar_buf) ||
>  		     (desc->hw.sar + desc->hw.tcr) == sar_buf)) {
>  			dev_dbg(sh_chan->dev, "done #%d@%p dst %u\n",

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/

  parent reply	other threads:[~2011-10-17 12:52 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-14  5:38 [PATCH 00/10] dmaengine: move to enum dma_transfer_direction Vinod Koul
2011-10-14  5:38 ` [PATCH 01/10] dmaengine: add new " Vinod Koul
2011-10-14  6:15   ` Barry Song
2011-10-15 12:46   ` Russell King
2011-10-15 14:22     ` Barry Song
2011-10-15 17:04     ` Vinod Koul
2011-10-14  5:38 ` [PATCH 02/10] dmaengine: move drivers to dma_transfer_direction Vinod Koul
2011-10-15 19:02   ` Mika Westerberg
2011-10-16 11:02   ` Linus Walleij
2011-10-17  5:28   ` Viresh Kumar
2011-10-17 13:15     ` Vinod Koul
2011-10-18  9:06       ` Viresh Kumar
2011-10-17  9:58   ` Nicolas Ferre
2011-10-17 12:52   ` Guennadi Liakhovetski [this message]
2011-10-18  2:48     ` Vinod Koul
2011-10-27 16:56     ` Vinod Koul
2011-11-21 12:20   ` Dan Carpenter
2011-11-21 16:03     ` Vinod Koul
2011-10-14  5:38 ` [PATCH 03/10] plat-samsung: move " Vinod Koul
2011-10-14  7:28   ` Kukjin Kim
2011-10-14 16:14     ` Vinod Koul
2011-10-14  5:38 ` [PATCH 04/10] media-video: " Vinod Koul
2011-10-17 12:52   ` Guennadi Liakhovetski
2011-10-14  5:38 ` [PATCH 05/10] carma: " Vinod Koul
2011-10-14  5:38 ` [PATCH 06/10] mmc-host: " Vinod Koul
2011-10-17  9:56   ` Nicolas Ferre
2011-10-17 12:59   ` Guennadi Liakhovetski
2011-10-14  5:38 ` [PATCH 07/10] spi, serial: " Vinod Koul
2011-10-15 19:00   ` Mika Westerberg
2011-10-16  8:01     ` Vinod Koul
2011-10-16  4:21   ` Grant Likely
2011-10-16  8:03     ` Vinod Koul
2011-10-14  5:38 ` [PATCH 08/10] sound-soc: " Vinod Koul
2011-10-14  9:40   ` Mark Brown
2011-10-14  5:38 ` [PATCH 09/10] USB: " Vinod Koul
2011-10-14  7:20   ` Felipe Balbi
2011-10-14  7:17     ` Vinod Koul
2011-10-14 11:01   ` Jassi Brar
2011-10-14 16:13     ` Vinod Koul
2011-10-14  5:38 ` [PATCH 10/10] net-ks8842: " Vinod Koul
2011-10-14 16:39 ` [PATCH v2 1/2] USB-musb: " Vinod Koul
2011-11-08 14:02   ` Felipe Balbi
2011-11-08 14:07     ` Felipe Balbi
2011-11-08 16:12       ` Vinod Koul
2011-11-09  6:09   ` Felipe Balbi
2011-11-09  8:38     ` Mian Yousaf Kaukab
2011-10-14 16:39 ` [PATCH 2/2] USB-renesas: " Vinod Koul
2011-11-08 14:02   ` Felipe Balbi
2011-11-09  6:10   ` Felipe Balbi
2011-11-10  0:06     ` Kuninori Morimoto
2011-11-10  0:06     ` Kuninori Morimoto
2011-11-17  9:19 ` [PATCH 00/10] dmaengine: move to enum dma_transfer_direction Vinod Koul

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.64.1110171023070.18438@axis700.grange \
    --to=g.liakhovetski@gmx.de \
    --cc=21cnbao@gmail.com \
    --cc=Baohua.Song@csr.com \
    --cc=boojin.kim@samsung.com \
    --cc=dan.j.williams@intel.com \
    --cc=hartleys@visionengravers.com \
    --cc=jaswinder.singh@linaro.org \
    --cc=leoli@freescale.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mika.westerberg@iki.fi \
    --cc=nicolas.ferre@atmel.com \
    --cc=rmk+kernel@arm.linux.org.uk \
    --cc=rmk@arm.linux.org.uk \
    --cc=s.hauer@pengutronix.de \
    --cc=shawn.guo@freescale.com \
    --cc=tomoya-linux@dsn.lapis-semi.com \
    --cc=vinod.koul@intel.com \
    --cc=vinod.koul@linux.intel.com \
    --cc=viresh.kumar@st.com \
    --cc=yong.y.wang@intel.com \
    --cc=zw@zh-kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®