Skip to content

Commit 2b21751

Browse files
Jiri Slaby (SUSE)gregkh
authored andcommitted
xhci: dbgtty: remove kfifo_out() wrapper
There is no need to check against kfifo_len() before kfifo_out(). Just ask the latter for data and it tells how much it retrieved. Or returns 0 in case there are no more. Signed-off-by: Jiri Slaby (SUSE) <jirislaby@kernel.org> Cc: Mathias Nyman <mathias.nyman@intel.com> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: linux-usb@vger.kernel.org Link: https://lore.kernel.org/r/20240808103549.429349-5-jirislaby@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent b1ce516 commit 2b21751

1 file changed

Lines changed: 1 addition & 14 deletions

File tree

drivers/usb/host/xhci-dbgtty.c

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -24,19 +24,6 @@ static inline struct dbc_port *dbc_to_port(struct xhci_dbc *dbc)
2424
return dbc->priv;
2525
}
2626

27-
static unsigned int
28-
dbc_send_packet(struct dbc_port *port, char *packet, unsigned int size)
29-
{
30-
unsigned int len;
31-
32-
len = kfifo_len(&port->write_fifo);
33-
if (len < size)
34-
size = len;
35-
if (size != 0)
36-
size = kfifo_out(&port->write_fifo, packet, size);
37-
return size;
38-
}
39-
4027
static int dbc_start_tx(struct dbc_port *port)
4128
__releases(&port->port_lock)
4229
__acquires(&port->port_lock)
@@ -49,7 +36,7 @@ static int dbc_start_tx(struct dbc_port *port)
4936

5037
while (!list_empty(pool)) {
5138
req = list_entry(pool->next, struct dbc_request, list_pool);
52-
len = dbc_send_packet(port, req->buf, DBC_MAX_PACKET);
39+
len = kfifo_out(&port->write_fifo, req->buf, DBC_MAX_PACKET);
5340
if (len == 0)
5441
break;
5542
do_tty_wake = true;

0 commit comments

Comments
 (0)