]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob
13e17922c6747015f37dd75f11bff09f0325131f
[thirdparty/kernel/stable-queue.git] /
1 From linux@rasmusvillemoes.dk Thu Jan 12 13:40:41 2023
2 From: Rasmus Villemoes <linux@rasmusvillemoes.dk>
3 Date: Thu, 22 Dec 2022 12:44:14 +0100
4 Subject: serial: fixup backport of "serial: Deassert Transmit Enable on probe in driver-specific way"
5 To: "Greg Kroah-Hartman" <gregkh@linuxfoundation.org>, "Jiri Slaby" <jirislaby@kernel.org>, "Lukas Wunner" <lukas@wunner.de>, "Dominique Martinet" <dominique.martinet@atmark-techno.com>, "Daisuke Mizobuchi" <mizo@atmark-techno.com>, "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
6 Cc: linux-serial@vger.kernel.org, stable@vger.kernel.org, Rasmus Villemoes <linux@rasmusvillemoes.dk>
7 Message-ID: <20221222114414.1886632-1-linux@rasmusvillemoes.dk>
8
9 From: Rasmus Villemoes <linux@rasmusvillemoes.dk>
10
11 When 7c7f9bc986e6 ("serial: Deassert Transmit Enable on probe in
12 driver-specific way") got backported to 5.15.y, there known as
13 b079d3775237, some hunks were accidentally left out.
14
15 In fsl_lpuart.c, this amounts to uart_remove_one_port() being called
16 in an error path despite uart_add_one_port() not having been called.
17
18 In serial_core.c, it is possible that the omission in
19 uart_suspend_port() is harmless, but the backport did have the
20 corresponding hunk in uart_resume_port(), it runs counter to the
21 original commit's intention of
22
23 Skip any invocation of ->set_mctrl() if RS485 is enabled.
24
25 and it's certainly better to be aligned with upstream.
26
27 Fixes: b079d3775237 ("serial: Deassert Transmit Enable on probe in driver-specific way")
28 Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
29 Reviewed-by: Dominique MARTINET <dominique.martinet@atmark-techno.com>
30 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
31 ---
32 drivers/tty/serial/fsl_lpuart.c | 2 +-
33 drivers/tty/serial/serial_core.c | 3 ++-
34 2 files changed, 3 insertions(+), 2 deletions(-)
35
36 --- a/drivers/tty/serial/fsl_lpuart.c
37 +++ b/drivers/tty/serial/fsl_lpuart.c
38 @@ -2784,9 +2784,9 @@ static int lpuart_probe(struct platform_
39 return 0;
40
41 failed_irq_request:
42 -failed_get_rs485:
43 uart_remove_one_port(&lpuart_reg, &sport->port);
44 failed_attach_port:
45 +failed_get_rs485:
46 failed_reset:
47 lpuart_disable_clks(sport);
48 return ret;
49 --- a/drivers/tty/serial/serial_core.c
50 +++ b/drivers/tty/serial/serial_core.c
51 @@ -2225,7 +2225,8 @@ int uart_suspend_port(struct uart_driver
52
53 spin_lock_irq(&uport->lock);
54 ops->stop_tx(uport);
55 - ops->set_mctrl(uport, 0);
56 + if (!(uport->rs485.flags & SER_RS485_ENABLED))
57 + ops->set_mctrl(uport, 0);
58 ops->stop_rx(uport);
59 spin_unlock_irq(&uport->lock);
60