SUPERH platform development
 help / color / mirror / Atom feed
* [PATCH] dma: rcar-audmapp: Fix for no corresponding slave ID
@ 2014-08-21  0:53 Kuninori Morimoto
  2014-08-22  3:37 ` Simon Horman
  2014-08-22  4:32 ` Kuninori Morimoto
  0 siblings, 2 replies; 3+ messages in thread
From: Kuninori Morimoto @ 2014-08-21  0:53 UTC (permalink / raw)
  To: linux-sh

From: Ryo Kataoka <ryo.kataoka.wt@renesas.com>

In case of no corresponding slave ID, the audmapp_set_slave() returns
-ENXIO same as sh_dmae_set_slave() of shdmac.c.
DMAEngine might return wrong channel without this patch

Signed-off-by: Ryo Kataoka <ryo.kataoka.wt@renesas.com>
Signed-off-by: Jun Watanabe <jun.watanabe.ue@renesas.com>,
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 drivers/dma/sh/rcar-audmapp.c |   15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/drivers/dma/sh/rcar-audmapp.c b/drivers/dma/sh/rcar-audmapp.c
index dabbf0a..80fd2ae 100644
--- a/drivers/dma/sh/rcar-audmapp.c
+++ b/drivers/dma/sh/rcar-audmapp.c
@@ -117,7 +117,7 @@ static void audmapp_start_xfer(struct shdma_chan *schan,
 	audmapp_write(auchan, chcr,	PDMACHCR);
 }
 
-static void audmapp_get_config(struct audmapp_chan *auchan, int slave_id,
+static int audmapp_get_config(struct audmapp_chan *auchan, int slave_id,
 			      u32 *chcr, dma_addr_t *dst)
 {
 	struct audmapp_device *audev = to_dev(auchan);
@@ -131,20 +131,22 @@ static void audmapp_get_config(struct audmapp_chan *auchan, int slave_id,
 	if (!pdata) { /* DT */
 		*chcr = ((u32)slave_id) << 16;
 		auchan->shdma_chan.slave_id = (slave_id) >> 8;
-		return;
+		return 0;
 	}
 
 	/* non-DT */
 
 	if (slave_id >= AUDMAPP_SLAVE_NUMBER)
-		return;
+		return -ENXIO;
 
 	for (i = 0, cfg = pdata->slave; i < pdata->slave_num; i++, cfg++)
 		if (cfg->slave_id = slave_id) {
 			*chcr	= cfg->chcr;
 			*dst	= cfg->dst;
-			break;
+			return 0;
 		}
+
+	return -ENXIO;
 }
 
 static int audmapp_set_slave(struct shdma_chan *schan, int slave_id,
@@ -153,8 +155,11 @@ static int audmapp_set_slave(struct shdma_chan *schan, int slave_id,
 	struct audmapp_chan *auchan = to_chan(schan);
 	u32 chcr;
 	dma_addr_t dst;
+	int ret;
 
-	audmapp_get_config(auchan, slave_id, &chcr, &dst);
+	ret = audmapp_get_config(auchan, slave_id, &chcr, &dst);
+	if (ret < 0)
+		return ret;
 
 	if (try)
 		return 0;
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] dma: rcar-audmapp: Fix for no corresponding slave ID
  2014-08-21  0:53 [PATCH] dma: rcar-audmapp: Fix for no corresponding slave ID Kuninori Morimoto
@ 2014-08-22  3:37 ` Simon Horman
  2014-08-22  4:32 ` Kuninori Morimoto
  1 sibling, 0 replies; 3+ messages in thread
From: Simon Horman @ 2014-08-22  3:37 UTC (permalink / raw)
  To: linux-sh

On Wed, Aug 20, 2014 at 05:53:03PM -0700, Kuninori Morimoto wrote:
> From: Ryo Kataoka <ryo.kataoka.wt@renesas.com>
> 
> In case of no corresponding slave ID, the audmapp_set_slave() returns
> -ENXIO same as sh_dmae_set_slave() of shdmac.c.
> DMAEngine might return wrong channel without this patch

Hi Morimoto-san,

could you please make a note of which commit introduced this problem
and if is known to manifest at this time?

> Signed-off-by: Ryo Kataoka <ryo.kataoka.wt@renesas.com>
> Signed-off-by: Jun Watanabe <jun.watanabe.ue@renesas.com>,
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> ---
>  drivers/dma/sh/rcar-audmapp.c |   15 ++++++++++-----
>  1 file changed, 10 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/dma/sh/rcar-audmapp.c b/drivers/dma/sh/rcar-audmapp.c
> index dabbf0a..80fd2ae 100644
> --- a/drivers/dma/sh/rcar-audmapp.c
> +++ b/drivers/dma/sh/rcar-audmapp.c
> @@ -117,7 +117,7 @@ static void audmapp_start_xfer(struct shdma_chan *schan,
>  	audmapp_write(auchan, chcr,	PDMACHCR);
>  }
>  
> -static void audmapp_get_config(struct audmapp_chan *auchan, int slave_id,
> +static int audmapp_get_config(struct audmapp_chan *auchan, int slave_id,
>  			      u32 *chcr, dma_addr_t *dst)
>  {
>  	struct audmapp_device *audev = to_dev(auchan);
> @@ -131,20 +131,22 @@ static void audmapp_get_config(struct audmapp_chan *auchan, int slave_id,
>  	if (!pdata) { /* DT */
>  		*chcr = ((u32)slave_id) << 16;
>  		auchan->shdma_chan.slave_id = (slave_id) >> 8;
> -		return;
> +		return 0;
>  	}
>  
>  	/* non-DT */
>  
>  	if (slave_id >= AUDMAPP_SLAVE_NUMBER)
> -		return;
> +		return -ENXIO;
>  
>  	for (i = 0, cfg = pdata->slave; i < pdata->slave_num; i++, cfg++)
>  		if (cfg->slave_id = slave_id) {
>  			*chcr	= cfg->chcr;
>  			*dst	= cfg->dst;
> -			break;
> +			return 0;
>  		}
> +
> +	return -ENXIO;
>  }
>  
>  static int audmapp_set_slave(struct shdma_chan *schan, int slave_id,
> @@ -153,8 +155,11 @@ static int audmapp_set_slave(struct shdma_chan *schan, int slave_id,
>  	struct audmapp_chan *auchan = to_chan(schan);
>  	u32 chcr;
>  	dma_addr_t dst;
> +	int ret;
>  
> -	audmapp_get_config(auchan, slave_id, &chcr, &dst);
> +	ret = audmapp_get_config(auchan, slave_id, &chcr, &dst);
> +	if (ret < 0)
> +		return ret;
>  
>  	if (try)
>  		return 0;
> -- 
> 1.7.9.5
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] dma: rcar-audmapp: Fix for no corresponding slave ID
  2014-08-21  0:53 [PATCH] dma: rcar-audmapp: Fix for no corresponding slave ID Kuninori Morimoto
  2014-08-22  3:37 ` Simon Horman
@ 2014-08-22  4:32 ` Kuninori Morimoto
  1 sibling, 0 replies; 3+ messages in thread
From: Kuninori Morimoto @ 2014-08-22  4:32 UTC (permalink / raw)
  To: linux-sh


Hi Simon

> > From: Ryo Kataoka <ryo.kataoka.wt@renesas.com>
> > 
> > In case of no corresponding slave ID, the audmapp_set_slave() returns
> > -ENXIO same as sh_dmae_set_slave() of shdmac.c.
> > DMAEngine might return wrong channel without this patch
> 
> Hi Morimoto-san,
> 
> could you please make a note of which commit introduced this problem
> and if is known to manifest at this time?

This issue happens under non-DT style,
and, upstream code doesn't have it.
So, this patch solved hidden bug for upstream.

Best regards
---
Kuninori Morimoto

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-08-22  4:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-21  0:53 [PATCH] dma: rcar-audmapp: Fix for no corresponding slave ID Kuninori Morimoto
2014-08-22  3:37 ` Simon Horman
2014-08-22  4:32 ` Kuninori Morimoto

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox