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

From: Greg KH
Date: Sat Oct 21 2023 - 12:15:36 EST


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.

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.

Sound good?

The code portion looks fine to me, thanks for doing this.

greg k-h