lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 18 Mar 2020 15:26:37 +0100
From:   Heiko Stuebner <heiko@...ech.de>
To:     gregkh@...uxfoundation.org
Cc:     jslaby@...e.com, andriy.shevchenko@...ux.intel.com,
        matwey.kornilov@...il.com, linux-serial@...r.kernel.org,
        linux-kernel@...r.kernel.org, heiko@...ech.de,
        Heiko Stuebner <heiko.stuebner@...obroma-systems.com>
Subject: [PATCH 4/7] serial: 8250: Start rs485 after registering port if rs485 is enabled in probe

From: Heiko Stuebner <heiko.stuebner@...obroma-systems.com>

Before registering a port 8250 drivers may read devicetree information
regarding rs485 emulation, but starting the em485 emulation at that point
would only keep the em485 structure in the template uart port.

Also at that point before the port is registered possible gpios for
rts/dtr are not acquired yet as well.

So simply check after acquiring the port if the rs485-enable flag is set
and start the config callback in that case.

Signed-off-by: Heiko Stuebner <heiko.stuebner@...obroma-systems.com>
---
 drivers/tty/serial/8250/8250_core.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/tty/serial/8250/8250_core.c b/drivers/tty/serial/8250/8250_core.c
index e682390ce0de..beab1c22b34d 100644
--- a/drivers/tty/serial/8250/8250_core.c
+++ b/drivers/tty/serial/8250/8250_core.c
@@ -1068,6 +1068,15 @@ int serial8250_register_8250_port(struct uart_8250_port *up)
 		if (up->dl_write)
 			uart->dl_write = up->dl_write;
 
+		if (uart->port.rs485_config &&
+		    (uart->port.rs485.flags & SER_RS485_ENABLED)) {
+			dev_dbg(uart->port.dev, "starting in rs485 mode\n");
+			ret = uart->port.rs485_config(&uart->port,
+						      &uart->port.rs485);
+			if (ret < 0)
+				goto out_unlock;
+		}
+
 		if (uart->port.type != PORT_8250_CIR) {
 			if (serial8250_isa_config != NULL)
 				serial8250_isa_config(0, &uart->port,
-- 
2.24.1

Powered by blists - more mailing lists