All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lukas Wunner <lukas@wunner.de>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Jiri Slaby <jslaby@suse.com>,
	"Nicolas Saenz Julienne" <nsaenzjulienne@suse.de>
Cc: "Matwey V. Kornilov" <matwey@sai.msu.ru>,
	Heiko Schocher <hs@denx.de>,
	Giulio Benetti <giulio.benetti@micronovasrl.com>,
	Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>,
	Stefan Wahren <wahrenst@gmx.net>,
	Matthias Brugger <mbrugger@suse.com>,
	Martin Sperl <kernel@martin.sperl.org>,
	linux-serial@vger.kernel.org,
	linux-rpi-kernel@lists.infradead.org
Subject: [PATCH 5/8] serial: 8250: Deduplicate rs485 active_timer assignment
Date: Fri, 28 Feb 2020 14:31:05 +0100	[thread overview]
Message-ID: <bca638405550eaf92f0c6060b553b687f35885e0.1582895077.git.lukas@wunner.de> (raw)
In-Reply-To: <cover.1582895077.git.lukas@wunner.de>

When rs485 transmission over an 8250 port stops, __stop_tx() assigns
active_timer = NULL before calling __stop_tx_rs485().

That function in turn either assigns active_timer = stop_tx_timer and
rearms the timer (in case a delay_rts_after_send needs to be observed)
or directly calls __do_stop_tx_rs485().

Move the assignment active_timer = NULL to __stop_tx_rs485() into the
branch which directly calls __do_stop_tx_rs485(), thereby avoiding a
duplicate assignment and simplifying the code.

Signed-off-by: Lukas Wunner <lukas@wunner.de>
Cc: Matwey V. Kornilov <matwey@sai.msu.ru>
---
 drivers/tty/serial/8250/8250_port.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c
index d281aea061d6..1a71625a0d43 100644
--- a/drivers/tty/serial/8250/8250_port.c
+++ b/drivers/tty/serial/8250/8250_port.c
@@ -1498,6 +1498,7 @@ static void __stop_tx_rs485(struct uart_8250_port *p)
 				   p->port.rs485.delay_rts_after_send);
 	} else {
 		__do_stop_tx_rs485(p);
+		em485->active_timer = NULL;
 	}
 }
 
@@ -1522,8 +1523,6 @@ static inline void __stop_tx(struct uart_8250_port *p)
 		if ((lsr & BOTH_EMPTY) != BOTH_EMPTY)
 			return;
 
-		em485->active_timer = NULL;
-
 		__stop_tx_rs485(p);
 	}
 	__do_stop_tx(p);
-- 
2.24.0


  parent reply	other threads:[~2020-02-28 13:42 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-28 13:31 [PATCH 0/8] rs485 support for Raspberry Pi aux uart Lukas Wunner
2020-02-28 13:31 ` [PATCH 1/8] serial: 8250: Don't touch RTS modem control while in rs485 mode Lukas Wunner
2020-02-28 13:31 ` [PATCH 2/8] serial: 8250: Support rs485 devicetree properties Lukas Wunner
2020-02-28 13:31 ` [PATCH 3/8] serial: 8250: Deduplicate ->rs485_config() callback Lukas Wunner
2020-02-28 13:31 ` [PATCH 4/8] serial: 8250: Sanitize rs485 config harder Lukas Wunner
2020-02-28 13:31 ` Lukas Wunner [this message]
2020-02-28 13:31 ` [PATCH 6/8] serial: 8250: Generalize rs485 software emulation Lukas Wunner
2020-02-28 13:31 ` [PATCH 7/8] serial: 8250_bcm2835aux: Support " Lukas Wunner
2020-02-28 13:31 ` [PATCH 8/8] serial: 8250: Support console on software emulated rs485 ports Lukas Wunner

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=bca638405550eaf92f0c6060b553b687f35885e0.1582895077.git.lukas@wunner.de \
    --to=lukas@wunner.de \
    --cc=giulio.benetti@micronovasrl.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hs@denx.de \
    --cc=jslaby@suse.com \
    --cc=kernel@martin.sperl.org \
    --cc=linux-rpi-kernel@lists.infradead.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=matwey@sai.msu.ru \
    --cc=mbrugger@suse.com \
    --cc=nsaenzjulienne@suse.de \
    --cc=u.kleine-koenig@pengutronix.de \
    --cc=wahrenst@gmx.net \
    /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: link
Be 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.