All of lore.kernel.org
 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: Mon, 05 Jan 2015 09:43:27 +0100	[thread overview]
Message-ID: <4405974.QQJ6fqAfNe@wuerfel> (raw)
In-Reply-To: <87wq51ogjx.wl%kuninori.morimoto.gx@renesas.com>

On Monday 05 January 2015 07:02:41 Kuninori Morimoto wrote:
> From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> 
> Current .dma is implemented under tmio_mmc_data.
> It goes to tmio_mmc_host by this patch.
> 
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

The patch looks good, just like the rest of the series, but there is
one aspect that I think would make sense to clean up at the same time,
since you are already touching all those lines:

> diff --git a/drivers/mmc/host/tmio_mmc.h b/drivers/mmc/host/tmio_mmc.h
> index 3d02a3c1..4c5eda8 100644
> --- a/drivers/mmc/host/tmio_mmc.h
> +++ b/drivers/mmc/host/tmio_mmc.h
> @@ -40,6 +40,16 @@
>  
>  struct tmio_mmc_data;
>  
> +struct tmio_mmc_dma {
> +	void *chan_priv_tx;
> +	void *chan_priv_rx;
> +	int slave_id_tx;
> +	int slave_id_rx;
> +	int alignment_shift;
> +	dma_addr_t dma_rx_offset;
> +	bool (*filter)(struct dma_chan *chan, void *arg);
> +};

The slave_id/chan_priv values are now passed three times into the
driver, and one should really be enough. I'd suggest removing the
integer fields from both tmio_mmc_dma and tmio_mmc_data (added in
patch 9), and instead pass it as a void* argument only to tmio_mmc_data.

The alignment_shift and dma_rx_offset values seem to always be
the same for all users (at least the remaining ones, possibly there
were others originally), so you could hardcode those in tmio_mmc_dma.c
and remove the tmio_mmc_dma structure entirely.

The filter pointer should always be passed in the same structure
as the 'void *chan_priv' argument that is used when calling it, so
that would go into tmio_mmc_data as well if you add the data there.

Alternatively you could keep the tmio_mmc_dma structure and fill
it from the platform, but then only have the filter and void* arguments
in it.

For some obscure reason, the 'pdata->dma->slave_id_?x' fields currently
get passed into cfg.slave_id, which is something we really want to
get rid of so we can remove the slave_id field from dma_slave_config:
The slave ID is generally considered specific to the channel allocation,
not the configuration, and not all dmaengine drivers can express it
as a single integer, so the concept is obsolete. When you remove
the slave_id_?x fields here, you should also be able to just remove
the cfg.slave_id assignment without any replacement, unless there is
a bug in the dmaengine driver that should be fixed instead.

	Arnd

WARNING: multiple messages have this Message-ID (diff)
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: Mon, 05 Jan 2015 08:43:27 +0000	[thread overview]
Message-ID: <4405974.QQJ6fqAfNe@wuerfel> (raw)
In-Reply-To: <87wq51ogjx.wl%kuninori.morimoto.gx@renesas.com>

On Monday 05 January 2015 07:02:41 Kuninori Morimoto wrote:
> From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> 
> Current .dma is implemented under tmio_mmc_data.
> It goes to tmio_mmc_host by this patch.
> 
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

The patch looks good, just like the rest of the series, but there is
one aspect that I think would make sense to clean up at the same time,
since you are already touching all those lines:

> diff --git a/drivers/mmc/host/tmio_mmc.h b/drivers/mmc/host/tmio_mmc.h
> index 3d02a3c1..4c5eda8 100644
> --- a/drivers/mmc/host/tmio_mmc.h
> +++ b/drivers/mmc/host/tmio_mmc.h
> @@ -40,6 +40,16 @@
>  
>  struct tmio_mmc_data;
>  
> +struct tmio_mmc_dma {
> +	void *chan_priv_tx;
> +	void *chan_priv_rx;
> +	int slave_id_tx;
> +	int slave_id_rx;
> +	int alignment_shift;
> +	dma_addr_t dma_rx_offset;
> +	bool (*filter)(struct dma_chan *chan, void *arg);
> +};

The slave_id/chan_priv values are now passed three times into the
driver, and one should really be enough. I'd suggest removing the
integer fields from both tmio_mmc_dma and tmio_mmc_data (added in
patch 9), and instead pass it as a void* argument only to tmio_mmc_data.

The alignment_shift and dma_rx_offset values seem to always be
the same for all users (at least the remaining ones, possibly there
were others originally), so you could hardcode those in tmio_mmc_dma.c
and remove the tmio_mmc_dma structure entirely.

The filter pointer should always be passed in the same structure
as the 'void *chan_priv' argument that is used when calling it, so
that would go into tmio_mmc_data as well if you add the data there.

Alternatively you could keep the tmio_mmc_dma structure and fill
it from the platform, but then only have the filter and void* arguments
in it.

For some obscure reason, the 'pdata->dma->slave_id_?x' fields currently
get passed into cfg.slave_id, which is something we really want to
get rid of so we can remove the slave_id field from dma_slave_config:
The slave ID is generally considered specific to the channel allocation,
not the configuration, and not all dmaengine drivers can express it
as a single integer, so the concept is obsolete. When you remove
the slave_id_?x fields here, you should also be able to just remove
the cfg.slave_id assignment without any replacement, unless there is
a bug in the dmaengine driver that should be fixed instead.

	Arnd

  reply	other threads:[~2015-01-05  8:43 UTC|newest]

Thread overview: 64+ 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:01 ` Kuninori Morimoto
2015-01-05  7:02 ` [PATCH 1/9] mmc: tmio: add tmio_mmc_host_alloc/free() Kuninori Morimoto
2015-01-05  7:02   ` Kuninori Morimoto
2015-01-05  8:35   ` Geert Uytterhoeven
2015-01-05  8:35     ` Geert Uytterhoeven
2015-01-05  8:39     ` Kuninori Morimoto
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  7:02   ` Kuninori Morimoto
2015-01-05  8:43   ` Arnd Bergmann [this message]
2015-01-05  8:43     ` Arnd Bergmann
2015-01-05  9:35     ` Kuninori Morimoto
2015-01-05  9:35       ` Kuninori Morimoto
2015-01-05 21:33       ` Arnd Bergmann
2015-01-05 21:33         ` Arnd Bergmann
2015-01-06  0:20         ` Kuninori Morimoto
2015-01-06  0:20           ` Kuninori Morimoto
2015-01-06 13:24           ` Arnd Bergmann
2015-01-06 13:24             ` Arnd Bergmann
2015-01-07  1:45             ` Kuninori Morimoto
2015-01-07  1:45               ` Kuninori Morimoto
2015-01-06  2:38         ` Kuninori Morimoto
2015-01-06  2:38           ` Kuninori Morimoto
2015-01-06 13:19           ` Arnd Bergmann
2015-01-06 13:19             ` Arnd Bergmann
2015-01-07  2:56             ` Kuninori Morimoto
2015-01-07  2:56               ` Kuninori Morimoto
2015-01-07  2:28         ` Kuninori Morimoto
2015-01-07  2:28           ` Kuninori Morimoto
2015-01-07  9:23           ` Arnd Bergmann
2015-01-07  9:23             ` Arnd Bergmann
2015-01-07  3:01         ` Kuninori Morimoto
2015-01-07  3:01           ` Kuninori Morimoto
2015-01-07  9:15           ` Arnd Bergmann
2015-01-07  9:15             ` Arnd Bergmann
2015-01-08  1:57             ` Kuninori Morimoto
2015-01-08  1:57               ` Kuninori Morimoto
2015-01-08  7:30               ` Kuninori Morimoto
2015-01-08  7:30                 ` Kuninori Morimoto
2015-01-08 13:09                 ` Arnd Bergmann
2015-01-08 13:09                   ` Arnd Bergmann
2015-01-09  9:44                   ` Kuninori Morimoto
2015-01-09  9:44                     ` Kuninori Morimoto
2015-01-12  9:05                     ` Ulf Hansson
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:02   ` 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   ` 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   ` 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   ` 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   ` Kuninori Morimoto
2015-01-05  7:03 ` [PATCH 8/9] mmc: sh_mobile_sdhi: remove .init/.cleanup Kuninori Morimoto
2015-01-05  7:03   ` Kuninori Morimoto
2015-01-05  9:02   ` Geert Uytterhoeven
2015-01-05  9:02     ` Geert Uytterhoeven
2015-01-05  9:15     ` Kuninori Morimoto
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
2015-01-05  7:04   ` 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=4405974.QQJ6fqAfNe@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.