From: Tapio Reijonen <tapio.reijonen@vaisala.com>
To: Hugo Villeneuve <hugo@hugovil.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Jiri Slaby <jirislaby@kernel.org>,
linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org,
Hugo Villeneuve <hvilleneuve@dimonoff.com>,
Tapio Reijonen <tapio.reijonen@kolumbus.fi>
Subject: Re: [PATCH v5 4/8] serial: max310x: wait for TX to drain before powering down in shutdown
Date: Sun, 4 Oct 2026 13:56:42 +0300 [thread overview]
Message-ID: <9fc04933-a0ad-4642-a697-323ade121616@vaisala.com> (raw)
In-Reply-To: <20261002110127.cb172b3f28d20aa5330990c4@hugovil.com>
Hi Hugo,
On 10/2/26 18:01, Hugo Villeneuve wrote:
> I meant only these two lines:
> to_max310x_port(port)->one_char_duration_us =
> DIV_ROUND_UP(USEC_PER_SEC * frame_bits, baud);
Understood - but as of v6 even those cannot move below the call: the
helper can arm the after-send hold itself (the mid-transfer takeover
fix), and that hold is computed from the character time, so it must be
current before the call. I will extend the comment above the pair so
it says why both values are cached first.
> Its unfortunate that you trimmed some parts of the original email so
> we
> no longer see the relevant code...
>
> But maybe you should reword/improve your comments then?
Fair point on both counts. v6 will state the reason in the comment
itself: the tty layer's wait-until-sent is bounded by closing_wait,
which can be configured to none, and hangup reaches shutdown() with no
wait at all, so shutdown() cannot assume the FIFO is empty.
> So at 115200, this could mean 128 reads each ~90-100 us?
>
> Could using the interrupt to detect tx empty could improve
> efficiency and reduce load on I2C/SPI bus?
Yes, 128 reads is the worst case - but they are spread over the ~11 ms
the remaining data itself needs at that rate, only on the close/hangup
path, and the loop stops at the first empty read. I did consider the
interrupt: shutdown() is also the path that quiesces the port's
interrupt handling, so waiting on TXEMPTY there needs a completion
ordered against the teardown interlocks, and TXEMPTY fires when the
FIFO empties - one character before the transmitter is idle - so the
final one-character wait remains either way. The bounded poll keeps
the teardown path simple; the bus it loads belongs to a port being
closed.
Tapio
next prev parent reply other threads:[~2026-10-04 10:56 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-29 9:37 [PATCH v5 0/8] serial: max310x: RS485 delay and RTS fixes, software-timed delays Tapio Reijonen
2026-09-29 9:37 ` [PATCH v5 1/8] serial: max310x: don't clobber the TX break bit in set_termios Tapio Reijonen
2026-09-29 13:40 ` Hugo Villeneuve
2026-10-02 7:25 ` Tapio Reijonen
2026-10-02 15:03 ` Hugo Villeneuve
2026-10-04 10:45 ` Tapio Reijonen
2026-09-29 9:37 ` [PATCH v5 2/8] serial: max310x: assert the transceiver during a break Tapio Reijonen
2026-09-29 9:37 ` [PATCH v5 3/8] serial: max310x: convert RS485 delays from milliseconds to bit-times Tapio Reijonen
2026-09-29 13:54 ` Hugo Villeneuve
2026-10-01 19:11 ` Hugo Villeneuve
2026-10-02 7:27 ` Tapio Reijonen
2026-09-29 9:37 ` [PATCH v5 4/8] serial: max310x: wait for TX to drain before powering down in shutdown Tapio Reijonen
2026-10-01 20:00 ` Hugo Villeneuve
2026-10-02 7:28 ` Tapio Reijonen
2026-10-02 15:01 ` Hugo Villeneuve
2026-10-04 10:56 ` Tapio Reijonen [this message]
2026-09-29 9:37 ` [PATCH v5 5/8] serial: max310x: support active-low RTS on the hardware path Tapio Reijonen
2026-09-29 9:38 ` [PATCH v5 6/8] serial: max310x: schedule tx_work directly from the IRQ handler Tapio Reijonen
2026-09-29 9:38 ` [PATCH v5 7/8] serial: max310x: drive RTS in software when hardware delays are too short Tapio Reijonen
2026-09-29 9:38 ` [PATCH v5 8/8] serial: max310x: don't transmit while an RS485 reconfigure is pending Tapio Reijonen
2026-10-01 8:35 ` [PATCH v5 0/8] serial: max310x: RS485 delay and RTS fixes, software-timed delays Greg Kroah-Hartman
2026-10-01 9:10 ` Tapio Reijonen
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=9fc04933-a0ad-4642-a697-323ade121616@vaisala.com \
--to=tapio.reijonen@vaisala.com \
--cc=gregkh@linuxfoundation.org \
--cc=hugo@hugovil.com \
--cc=hvilleneuve@dimonoff.com \
--cc=jirislaby@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=tapio.reijonen@kolumbus.fi \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®