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

Message ID 20240210215147.77629-13-michael.zaidman@gmail.com
State New
Headers
Series hid-ft260: Fixes for serial driver patch v4 |

Commit Message

Michael Zaidman Feb. 10, 2024, 9:51 p.m. UTC
  Replace uart fifo write room calculation with the kfifo_avail kernel API.

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

Patch

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)