linux-sh.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Cc: Ulf Hansson <ulf.hansson@linaro.org>, Chris Ball <cjb@laptop.org>,
	Simon <horms@verge.net.au>, Linux-SH <linux-sh@vger.kernel.org>,
	linux-mmc <linux-mmc@vger.kernel.org>
Subject: Re: [PATCH 2/9] mmc: tmio: tmio_mmc_host has .dma
Date: Wed, 07 Jan 2015 09:23:49 +0000	[thread overview]
Message-ID: <2017134.He5GnynN45@wuerfel> (raw)
In-Reply-To: <87fvbnpblr.wl%kuninori.morimoto.gx@renesas.com>

On Wednesday 07 January 2015 02:28:43 Kuninori Morimoto wrote:
> 
> Hi Arnd
> 
> Thank you for your DMAEngine fixup patch.
> I tried this patch, and have comment.

Thanks for looking at the changes

> >  
> > -	sdev = to_shdma_dev(schan->dma_chan.device);
> > -	ret = sdev->ops->set_slave(schan, match, 0, true);
> > +	ret = sdev->ops->set_slave(schan, schan->real_slave_id, 0, true);
> > +	schan->real_slave_id = slave_id;
> >  	if (ret < 0)
> >  		return false;
> 
> Here, your patch is
> 
> 	ret = sdev->ops->set_slave(schan, schan->real_slave_id, 0, true);
> 	schan->real_slave_id = slave_id;
> 	if (ret < 0)
> 
> But, it doesn't work. Maybe, you want this
> 
> 	schan->real_slave_id = slave_id;
> 	ret = sdev->ops->set_slave(schan, schan->real_slave_id, 0, true);
> 	if (ret < 0)

Right, I broke it in a last-minute change. Originally I had

 	schan->real_slave_id = slave_id;
 	ret = sdev->ops->set_slave(schan, schan->real_slave_id, 0, true);
 	if (ret < 0) {
		schan->real_slave_id = 0;
		return ret;
	}

and then meant to shorten it to

 	ret = sdev->ops->set_slave(schan, slave_id, 0, true);
 	if (ret < 0)
		return ret;
 	schan->real_slave_id = slave_id;

Either of those should be fine, but what I wrote was instead was
completely wrong.

> > diff --git a/drivers/mmc/host/sh_mmcif.c b/drivers/mmc/host/sh_mmcif.c
> > index 7d9d6a321521..df3a537f5a83 100644
> > --- a/drivers/mmc/host/sh_mmcif.c
> > +++ b/drivers/mmc/host/sh_mmcif.c
> > @@ -388,7 +388,7 @@ sh_mmcif_request_dma_one(struct sh_mmcif_host *host,
> >  {
> >  	struct dma_slave_config cfg = { 0, };
> >  	struct dma_chan *chan;
> > -	unsigned int slave_id;
> > +	void *slave_data;
> >  	struct resource *res;
> >  	dma_cap_mask_t mask;
> >  	int ret;
> > @@ -414,8 +414,6 @@ sh_mmcif_request_dma_one(struct sh_mmcif_host *host,
> >  
> >  	res = platform_get_resource(host->pd, IORESOURCE_MEM, 0);
> >  
> > -	/* In the OF case the driver will get the slave ID from the DT */
> > -	cfg.slave_id = slave_id;
> >  	cfg.direction = direction;
> >  
> >  	if (direction = DMA_DEV_TO_MEM) {
> 
> I got error here
> 
> 
> /opt/home/morimoto/linux/drivers/mmc/host/sh_mmcif.c: In function ‘sh_mmcif_request_dma_one’:
> /opt/home/morimoto/linux/drivers/mmc/host/sh_mmcif.c:400:3: error: ‘slave_id’ undeclared (first use in this function)
>    slave_id = direction = DMA_MEM_TO_DEV
>    ^
> /opt/home/morimoto/linux/drivers/mmc/host/sh_mmcif.c:400:3: note: each undeclared identifier is reported only once for each function it appears in
> /opt/home/morimoto/linux/drivers/mmc/host/sh_mmcif.c:391:8: warning: unused variable ‘slave_data’ [-Wunused-variable]
>   void *slave_data;
>         ^
> 
> Maybe you are missing this
> 
>         if (pdata)
> -               slave_id = direction = DMA_MEM_TO_DEV
> -                        ? pdata->slave_id_tx : pdata->slave_id_rx;
> +               slave_data = direction = DMA_MEM_TO_DEV
> +                       ? (void *)pdata->slave_id_tx : (void *)pdata->slave_id_rx;
>         else
> -               slave_id = 0;
> +               slave_data = 0;
>  
>         chan = dma_request_slave_channel_compat(mask, shdma_chan_filter,
> -                               (void *)(unsigned long)slave_id, &host->pd->dev,
> +                               slave_data, &host->pd->dev,
>                                 direction = DMA_MEM_TO_DEV ? "tx" : "rx");
>  
>         dev_dbg(&host->pd->dev, "%s: %s: got channel %p\n", __func__,
> 
> 
> sh_mobile_sdhi DMA works if I fixuped above

Either that or undo the change to the type. I originally planned to change the
sh_mmcif_plat_data to use a void* type already, but then didn't do that because
it conflicts with your other patch, and I failed to revert my earlier change
correctly.

	Arnd

  reply	other threads:[~2015-01-07  9:23 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-05  7:01 [PATCH 0/9]: mmc: tmio header cleanup Kuninori Morimoto
2015-01-05  7:02 ` [PATCH 1/9] mmc: tmio: add tmio_mmc_host_alloc/free() Kuninori Morimoto
2015-01-05  8:35   ` Geert Uytterhoeven
2015-01-05  8:39     ` Kuninori Morimoto
2015-01-05  7:02 ` [PATCH 2/9] mmc: tmio: tmio_mmc_host has .dma Kuninori Morimoto
2015-01-05  8:43   ` Arnd Bergmann
2015-01-05  9:35     ` Kuninori Morimoto
2015-01-05 21:33       ` Arnd Bergmann
2015-01-06  0:20         ` Kuninori Morimoto
2015-01-06 13:24           ` Arnd Bergmann
2015-01-07  1:45             ` Kuninori Morimoto
2015-01-06  2:38         ` Kuninori Morimoto
2015-01-06 13:19           ` Arnd Bergmann
2015-01-07  2:56             ` Kuninori Morimoto
2015-01-07  2:28         ` Kuninori Morimoto
2015-01-07  9:23           ` Arnd Bergmann [this message]
2015-01-07  3:01         ` Kuninori Morimoto
2015-01-07  9:15           ` Arnd Bergmann
2015-01-08  1:57             ` Kuninori Morimoto
2015-01-08  7:30               ` Kuninori Morimoto
2015-01-08 13:09                 ` Arnd Bergmann
2015-01-09  9:44                   ` Kuninori Morimoto
2015-01-12  9:05                     ` Ulf Hansson
2015-01-05  7:02 ` [PATCH 3/9] mmc: tmio: tmio_mmc_host has .write16_hook Kuninori Morimoto
2015-01-05  7:03 ` [PATCH 4/9] mmc: tmio: tmio_mmc_host has .clk_enable Kuninori Morimoto
2015-01-05  7:03 ` [PATCH 5/9] mmc: tmio: tmio_mmc_host has .clk_disable Kuninori Morimoto
2015-01-05  7:03 ` [PATCH 6/9] mmc: tmio: tmio_mmc_host has .multi_io_quirk Kuninori Morimoto
2015-01-05  7:03 ` [PATCH 7/9] mmc: tmio: tmio_mmc_host has .bus_shift Kuninori Morimoto
2015-01-05  7:03 ` [PATCH 8/9] mmc: sh_mobile_sdhi: remove .init/.cleanup Kuninori Morimoto
2015-01-05  9:02   ` Geert Uytterhoeven
2015-01-05  9:15     ` Kuninori Morimoto
2015-01-05  7:04 ` [PATCH 9/9] mmc: sh_mobile_sdhi: remove sh_mobile_sdhi_info Kuninori Morimoto

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=2017134.He5GnynN45@wuerfel \
    --to=arnd@arndb.de \
    --cc=cjb@laptop.org \
    --cc=horms@verge.net.au \
    --cc=kuninori.morimoto.gx@renesas.com \
    --cc=linux-mmc@vger.kernel.org \
    --cc=linux-sh@vger.kernel.org \
    --cc=ulf.hansson@linaro.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;
as well as URLs for NNTP newsgroup(s).