tty: n_tty: use min3() in copy_from_read_buf()
authorJiri Slaby (SUSE) <jirislaby@kernel.org>
Tue, 19 Sep 2023 08:51:44 +0000 (10:51 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 3 Oct 2023 12:31:15 +0000 (14:31 +0200)
commit72369f2d493d4c0f4f0ed5a66b19c6912c4837ef
treecc319b10ba6fe68220feee01fbb24c1d0c12cf3c
parent1e619477a9c8d6e2ec05a53cda97558fdf9f440e
tty: n_tty: use min3() in copy_from_read_buf()

n is a minimum of:
* available chars in the ring buffer
* available chars in the ring buffer till the end of the ring buffer
* requested number (*nr)

We can use min3() for that instead of two min()s.

Signed-off-by: "Jiri Slaby (SUSE)" <jirislaby@kernel.org>
Link: https://lore.kernel.org/r/20230919085156.1578-4-jirislaby@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/n_tty.c