mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: Sherry Sun <sherry.sun@nxp.com>,
	gregkh@linuxfoundation.org, jirislaby@kernel.org,
	shawnguo@kernel.org, s.hauer@pengutronix.de,
	kernel@pengutronix.de, festevam@gmail.com
Cc: linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org,
	linux-imx@nxp.com
Subject: Re: [PATCH] tty: serial: imx: initialize peripheral_config/peripheral_size for sdma config
Date: Wed, 3 Aug 2022 10:16:03 +0200	[thread overview]
Message-ID: <d4838245-030c-39b4-df4b-17b3b4c73a5b@pengutronix.de> (raw)
In-Reply-To: <20220803065737.14752-1-sherry.sun@nxp.com>

Hello Sherry,

On 03.08.22 08:57, Sherry Sun wrote:
> Since commit 824a0a02cd74 ("dmaengine: imx-sdma: Add multi fifo support")
> adds the use of dma_slave_config->peripheral_config/peripheral_size to
> sdma driver, the client drivers like uart need to initialize the
> peripheral_config/peripheral_size for sdma, otherwise, the random value
> of local variable slave_config may cause unexpected peripheral_config
> and make sdma mess up.
> 

If this a fix, please add a Fixes: tag. I am not sure it is though,
see below.

> Signed-off-by: Sherry Sun <sherry.sun@nxp.com>
> ---
>  drivers/tty/serial/imx.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
> index 522445a8f666..bb8c2a712e94 100644
> --- a/drivers/tty/serial/imx.c
> +++ b/drivers/tty/serial/imx.c
> @@ -1320,6 +1320,8 @@ static int imx_uart_dma_init(struct imx_port *sport)

This function starts with 

struct dma_slave_config slave_config = {};

>  	slave_config.src_addr_width = DMA_SLAVE_BUSWIDTH_1_BYTE;
>  	/* one byte less than the watermark level to enable the aging timer */
>  	slave_config.src_maxburst = RXTL_DMA - 1;
> +	slave_config.peripheral_config = NULL;
> +	slave_config.peripheral_size = 0;

So these are already zero-initialized.

>  	ret = dmaengine_slave_config(sport->dma_chan_rx, &slave_config);
>  	if (ret) {
>  		dev_err(dev, "error in RX dma configuration.\n");
> @@ -1346,6 +1348,8 @@ static int imx_uart_dma_init(struct imx_port *sport)
>  	slave_config.dst_addr = sport->port.mapbase + URTX0;
>  	slave_config.dst_addr_width = DMA_SLAVE_BUSWIDTH_1_BYTE;
>  	slave_config.dst_maxburst = TXTL_DMA;
> +	slave_config.peripheral_config = NULL;
> +	slave_config.peripheral_size = 0;

Not sure if this is required. If preceding dmaengine_slave_config()
indeed makes clearing necessary, you should note that in the commit
message.

Cheers,
Ahmad

>  	ret = dmaengine_slave_config(sport->dma_chan_tx, &slave_config);
>  	if (ret) {
>  		dev_err(dev, "error in TX dma configuration.");


-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

  reply	other threads:[~2022-08-03  8:16 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-03  6:57 Sherry Sun
2022-08-03  8:16 ` Ahmad Fatoum [this message]
2022-08-03  9:15   ` Sherry Sun
2022-08-03  9:22     ` gregkh
2022-08-03  9:30       ` Sherry Sun
2022-08-03  9:40     ` Uwe Kleine-König
2022-08-03  9:51       ` Sherry Sun

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=d4838245-030c-39b4-df4b-17b3b4c73a5b@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=festevam@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jirislaby@kernel.org \
    --cc=kernel@pengutronix.de \
    --cc=linux-imx@nxp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=s.hauer@pengutronix.de \
    --cc=shawnguo@kernel.org \
    --cc=sherry.sun@nxp.com \
    /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®