[PATCH v1 12/19] hid-ft260: uart: use kfifo_avail for fifo write room check

From: Michael Zaidman
Date: Sat Feb 10 2024 - 16:56:31 EST


Replace uart fifo write room calculation with the kfifo_avail kernel API.

Signed-off-by: Michael Zaidman <michael.zaidman@xxxxxxxxx>
---
drivers/hid/hid-ft260.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/hid/hid-ft260.c b/drivers/hid/hid-ft260.c
index f8d4bf7e6c4f..3d1a9ec88cb9 100644
--- a/drivers/hid/hid-ft260.c
+++ b/drivers/hid/hid-ft260.c
@@ -1264,7 +1264,7 @@ static unsigned int ft260_uart_write_room(struct tty_struct *tty)
{
struct ft260_device *port = tty->driver_data;

- return FIFO_SIZE - kfifo_len(&port->xmit_fifo);
+ return kfifo_avail(&port->xmit_fifo);
}

static unsigned int ft260_uart_chars_in_buffer(struct tty_struct *tty)
--
2.40.1