public inbox for linux-tegra@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 5/5] serial: tegra: Remove custom frame size calculation
       [not found] <20220830084925.5608-1-ilpo.jarvinen@linux.intel.com>
@ 2022-08-30  8:49 ` Ilpo Järvinen
  2022-09-15 12:33   ` Thierry Reding
  0 siblings, 1 reply; 2+ messages in thread
From: Ilpo Järvinen @ 2022-08-30  8:49 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby, linux-serial, Andy Shevchenko,
	Laxman Dewangan, Thierry Reding, Jonathan Hunter, linux-tegra,
	linux-kernel
  Cc: Ilpo Järvinen, Andy Shevchenko

The number of bits can be calculated using tty_get_frame_size(), no
need for the driver to do it on its own.

Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
---
 drivers/tty/serial/serial-tegra.c | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/drivers/tty/serial/serial-tegra.c b/drivers/tty/serial/serial-tegra.c
index ad4f3567ff90..5a56bd20abcd 100644
--- a/drivers/tty/serial/serial-tegra.c
+++ b/drivers/tty/serial/serial-tegra.c
@@ -1278,7 +1278,6 @@ static void tegra_uart_set_termios(struct uart_port *u,
 	unsigned long flags;
 	unsigned int lcr;
 	unsigned char char_bits;
-	int symb_bit = 1;
 	struct clk *parent_clk = clk_get_parent(tup->uart_clk);
 	unsigned long parent_clk_rate = clk_get_rate(parent_clk);
 	int max_divider = (tup->cdata->support_clk_src_div) ? 0x7FFF : 0xFFFF;
@@ -1305,7 +1304,6 @@ static void tegra_uart_set_termios(struct uart_port *u,
 	termios->c_cflag &= ~CMSPAR;
 
 	if ((termios->c_cflag & PARENB) == PARENB) {
-		symb_bit++;
 		if (termios->c_cflag & PARODD) {
 			lcr |= UART_LCR_PARITY;
 			lcr &= ~UART_LCR_EPAR;
@@ -1318,22 +1316,18 @@ static void tegra_uart_set_termios(struct uart_port *u,
 	}
 
 	char_bits = tty_get_char_size(termios->c_cflag);
-	symb_bit += char_bits;
 	lcr &= ~UART_LCR_WLEN8;
 	lcr |= UART_LCR_WLEN(char_bits);
 
 	/* Stop bits */
-	if (termios->c_cflag & CSTOPB) {
+	if (termios->c_cflag & CSTOPB)
 		lcr |= UART_LCR_STOP;
-		symb_bit += 2;
-	} else {
+	else
 		lcr &= ~UART_LCR_STOP;
-		symb_bit++;
-	}
 
 	tegra_uart_write(tup, lcr, UART_LCR);
 	tup->lcr_shadow = lcr;
-	tup->symb_bit = symb_bit;
+	tup->symb_bit = tty_get_frame_size(termios->c_cflag);
 
 	/* Baud rate. */
 	baud = uart_get_baud_rate(u, termios, oldtermios,
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2 5/5] serial: tegra: Remove custom frame size calculation
  2022-08-30  8:49 ` [PATCH v2 5/5] serial: tegra: Remove custom frame size calculation Ilpo Järvinen
@ 2022-09-15 12:33   ` Thierry Reding
  0 siblings, 0 replies; 2+ messages in thread
From: Thierry Reding @ 2022-09-15 12:33 UTC (permalink / raw)
  To: Ilpo Järvinen
  Cc: Greg Kroah-Hartman, Jiri Slaby, linux-serial, Andy Shevchenko,
	Laxman Dewangan, Jonathan Hunter, linux-tegra, linux-kernel,
	Andy Shevchenko

[-- Attachment #1: Type: text/plain, Size: 488 bytes --]

On Tue, Aug 30, 2022 at 11:49:25AM +0300, Ilpo Järvinen wrote:
> The number of bits can be calculated using tty_get_frame_size(), no
> need for the driver to do it on its own.
> 
> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
> ---
>  drivers/tty/serial/serial-tegra.c | 12 +++---------
>  1 file changed, 3 insertions(+), 9 deletions(-)

Looks fine:

Acked-by: Thierry Reding <treding@nvidia.com>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-09-15 12:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20220830084925.5608-1-ilpo.jarvinen@linux.intel.com>
2022-08-30  8:49 ` [PATCH v2 5/5] serial: tegra: Remove custom frame size calculation Ilpo Järvinen
2022-09-15 12:33   ` Thierry Reding

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox