From: Valentin Caron <valentin.caron@foss.st.com> To: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: Jiri Slaby <jirislaby@kernel.org>, Maxime Coquelin <mcoquelin.stm32@gmail.com>, Alexandre Torgue <alexandre.torgue@foss.st.com>, Gerald Baeza <gerald.baeza@st.com>, Erwan Le Ray <erwan.leray@foss.st.com>, Valentin Caron <valentin.caron@foss.st.com>, <linux-serial@vger.kernel.org>, <linux-stm32@st-md-mailman.stormreply.com>, <linux-arm-kernel@lists.infradead.org>, <linux-kernel@vger.kernel.org> Subject: [PATCH 4/4] serial: stm32: correct loop for dma error handling Date: Tue, 4 Jan 2022 19:24:45 +0100 [thread overview] Message-ID: <20220104182445.4195-5-valentin.caron@foss.st.com> (raw) In-Reply-To: <20220104182445.4195-1-valentin.caron@foss.st.com> In this error handling, "transmit_chars_dma" function will call "transmit_chars_pio" once per characters. But "transmit_chars_pio" will continue to send characters while xmit buffer is not empty. Remove this useless loop, one call is sufficient. Signed-off-by: Valentin Caron <valentin.caron@foss.st.com> --- drivers/tty/serial/stm32-usart.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/tty/serial/stm32-usart.c b/drivers/tty/serial/stm32-usart.c index 788e002688f2..1f89ab0e49ac 100644 --- a/drivers/tty/serial/stm32-usart.c +++ b/drivers/tty/serial/stm32-usart.c @@ -477,7 +477,7 @@ static void stm32_usart_transmit_chars_dma(struct uart_port *port) const struct stm32_usart_offsets *ofs = &stm32port->info->ofs; struct circ_buf *xmit = &port->state->xmit; struct dma_async_tx_descriptor *desc = NULL; - unsigned int count, i; + unsigned int count; if (stm32_usart_tx_dma_started(stm32port)) { if (!stm32_usart_tx_dma_enabled(stm32port)) @@ -542,8 +542,7 @@ static void stm32_usart_transmit_chars_dma(struct uart_port *port) return; fallback_err: - for (i = count; i > 0; i--) - stm32_usart_transmit_chars_pio(port); + stm32_usart_transmit_chars_pio(port); } static void stm32_usart_transmit_chars(struct uart_port *port) -- 2.17.1
WARNING: multiple messages have this Message-ID (diff)
From: Valentin Caron <valentin.caron@foss.st.com> To: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: Jiri Slaby <jirislaby@kernel.org>, Maxime Coquelin <mcoquelin.stm32@gmail.com>, Alexandre Torgue <alexandre.torgue@foss.st.com>, Gerald Baeza <gerald.baeza@st.com>, Erwan Le Ray <erwan.leray@foss.st.com>, Valentin Caron <valentin.caron@foss.st.com>, <linux-serial@vger.kernel.org>, <linux-stm32@st-md-mailman.stormreply.com>, <linux-arm-kernel@lists.infradead.org>, <linux-kernel@vger.kernel.org> Subject: [PATCH 4/4] serial: stm32: correct loop for dma error handling Date: Tue, 4 Jan 2022 19:24:45 +0100 [thread overview] Message-ID: <20220104182445.4195-5-valentin.caron@foss.st.com> (raw) In-Reply-To: <20220104182445.4195-1-valentin.caron@foss.st.com> In this error handling, "transmit_chars_dma" function will call "transmit_chars_pio" once per characters. But "transmit_chars_pio" will continue to send characters while xmit buffer is not empty. Remove this useless loop, one call is sufficient. Signed-off-by: Valentin Caron <valentin.caron@foss.st.com> --- drivers/tty/serial/stm32-usart.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/tty/serial/stm32-usart.c b/drivers/tty/serial/stm32-usart.c index 788e002688f2..1f89ab0e49ac 100644 --- a/drivers/tty/serial/stm32-usart.c +++ b/drivers/tty/serial/stm32-usart.c @@ -477,7 +477,7 @@ static void stm32_usart_transmit_chars_dma(struct uart_port *port) const struct stm32_usart_offsets *ofs = &stm32port->info->ofs; struct circ_buf *xmit = &port->state->xmit; struct dma_async_tx_descriptor *desc = NULL; - unsigned int count, i; + unsigned int count; if (stm32_usart_tx_dma_started(stm32port)) { if (!stm32_usart_tx_dma_enabled(stm32port)) @@ -542,8 +542,7 @@ static void stm32_usart_transmit_chars_dma(struct uart_port *port) return; fallback_err: - for (i = count; i > 0; i--) - stm32_usart_transmit_chars_pio(port); + stm32_usart_transmit_chars_pio(port); } static void stm32_usart_transmit_chars(struct uart_port *port) -- 2.17.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2022-01-04 18:26 UTC|newest] Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-01-04 18:24 [PATCH 0/4] Add improvements for STM32 USART DMA TX Valentin Caron 2022-01-04 18:24 ` Valentin Caron 2022-01-04 18:24 ` [PATCH 1/4] serial: stm32: move tx dma terminate DMA to shutdown Valentin Caron 2022-01-04 18:24 ` Valentin Caron 2022-01-04 18:24 ` [PATCH 2/4] serial: stm32: rework TX DMA state condition Valentin Caron 2022-01-04 18:24 ` Valentin Caron 2022-01-04 18:24 ` [PATCH 3/4] serial: stm32: fix flow control transfer in DMA mode Valentin Caron 2022-01-04 18:24 ` Valentin Caron 2022-01-04 18:24 ` Valentin Caron [this message] 2022-01-04 18:24 ` [PATCH 4/4] serial: stm32: correct loop for dma error handling Valentin Caron
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=20220104182445.4195-5-valentin.caron@foss.st.com \ --to=valentin.caron@foss.st.com \ --cc=alexandre.torgue@foss.st.com \ --cc=erwan.leray@foss.st.com \ --cc=gerald.baeza@st.com \ --cc=gregkh@linuxfoundation.org \ --cc=jirislaby@kernel.org \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-serial@vger.kernel.org \ --cc=linux-stm32@st-md-mailman.stormreply.com \ --cc=mcoquelin.stm32@gmail.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: linkBe 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.