Re: [PATCH v4 2/3] tty: add new helper function tty_get_tiocm

From: Florian Eckert
Date: Sun Oct 22 2023 - 06:25:07 EST



On 2023-10-21 18:15, Greg KH wrote:
On Thu, Oct 19, 2023 at 01:28:08PM +0200, Florian Eckert wrote:
The struct 'tty_struct' has a callback to read the status flags of the tty
if the tty driver provides them. So fare, the data is transferred directly
to userspace with the function 'tty_tiocmget'. This function cannot be
used to evaluate the status line of the tty interface in the ledtrig-tty
trigger. To make this possible, a new function must be added that does
not immediately pass the data on to userspace.

The new function 'tty_get_tiocm' only returns the status register.
This information can then be processed further in the ledtrig-tty
trigger.

Writing changelogs are hard. You are including a lot of information in
here that really doesn't need to be, as you are focusing on your
specific use case, which is fine, but you are creating a generic
function.

Yes, that is absolutely right. I'll try to take that into account next
time, thanks for your advice.

This can be simpler, how about something like this:

There is no in-kernel function to get the status register of a
tty device like the TIOCMGET ioctl returns to userspace. Create
a new function, tty_get_tiocm(), to obtain the status register
that other portions of the kernel can call if they need this
information, and move the existing internal tty_tiocmget()
function to use this interface.

I will replace the commit message with your suggestion in the next round of
the patch series. Thanks!

---
Florian