From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 06C5EC19F28 for ; Wed, 3 Aug 2022 08:16:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235245AbiHCIQe (ORCPT ); Wed, 3 Aug 2022 04:16:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57084 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237388AbiHCIQX (ORCPT ); Wed, 3 Aug 2022 04:16:23 -0400 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9CF3A65C1 for ; Wed, 3 Aug 2022 01:16:21 -0700 (PDT) Received: from ptz.office.stw.pengutronix.de ([2a0a:edc0:0:900:1d::77] helo=[127.0.0.1]) by metis.ext.pengutronix.de with esmtp (Exim 4.92) (envelope-from ) id 1oJ9Xy-0000MF-BC; Wed, 03 Aug 2022 10:16:06 +0200 Message-ID: Date: Wed, 3 Aug 2022 10:16:03 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.0 From: Ahmad Fatoum Subject: Re: [PATCH] tty: serial: imx: initialize peripheral_config/peripheral_size for sdma config To: Sherry Sun , 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 References: <20220803065737.14752-1-sherry.sun@nxp.com> Content-Language: en-US In-Reply-To: <20220803065737.14752-1-sherry.sun@nxp.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-SA-Exim-Connect-IP: 2a0a:edc0:0:900:1d::77 X-SA-Exim-Mail-From: a.fatoum@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > --- > 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 |