Skip to content

Commit 866025f

Browse files
Jiri Slaby (SUSE)gregkh
authored andcommitted
xhci: dbgtty: use kfifo from tty_port struct
There is no need to define one in a custom structure. The tty_port one is free to use. 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-6-jirislaby@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 2b21751 commit 866025f

2 files changed

Lines changed: 9 additions & 9 deletions

File tree

drivers/usb/host/xhci-dbgcap.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,6 @@ struct dbc_port {
110110
struct tasklet_struct push;
111111

112112
struct list_head write_pool;
113-
struct kfifo write_fifo;
114113

115114
bool registered;
116115
};

drivers/usb/host/xhci-dbgtty.c

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ static int dbc_start_tx(struct dbc_port *port)
3636

3737
while (!list_empty(pool)) {
3838
req = list_entry(pool->next, struct dbc_request, list_pool);
39-
len = kfifo_out(&port->write_fifo, req->buf, DBC_MAX_PACKET);
39+
len = kfifo_out(&port->port.xmit_fifo, req->buf, DBC_MAX_PACKET);
4040
if (len == 0)
4141
break;
4242
do_tty_wake = true;
@@ -203,7 +203,7 @@ static ssize_t dbc_tty_write(struct tty_struct *tty, const u8 *buf,
203203

204204
spin_lock_irqsave(&port->port_lock, flags);
205205
if (count)
206-
count = kfifo_in(&port->write_fifo, buf, count);
206+
count = kfifo_in(&port->port.xmit_fifo, buf, count);
207207
dbc_start_tx(port);
208208
spin_unlock_irqrestore(&port->port_lock, flags);
209209

@@ -217,7 +217,7 @@ static int dbc_tty_put_char(struct tty_struct *tty, u8 ch)
217217
int status;
218218

219219
spin_lock_irqsave(&port->port_lock, flags);
220-
status = kfifo_put(&port->write_fifo, ch);
220+
status = kfifo_put(&port->port.xmit_fifo, ch);
221221
spin_unlock_irqrestore(&port->port_lock, flags);
222222

223223
return status;
@@ -240,7 +240,7 @@ static unsigned int dbc_tty_write_room(struct tty_struct *tty)
240240
unsigned int room;
241241

242242
spin_lock_irqsave(&port->port_lock, flags);
243-
room = kfifo_avail(&port->write_fifo);
243+
room = kfifo_avail(&port->port.xmit_fifo);
244244
spin_unlock_irqrestore(&port->port_lock, flags);
245245

246246
return room;
@@ -253,7 +253,7 @@ static unsigned int dbc_tty_chars_in_buffer(struct tty_struct *tty)
253253
unsigned int chars;
254254

255255
spin_lock_irqsave(&port->port_lock, flags);
256-
chars = kfifo_len(&port->write_fifo);
256+
chars = kfifo_len(&port->port.xmit_fifo);
257257
spin_unlock_irqrestore(&port->port_lock, flags);
258258

259259
return chars;
@@ -411,7 +411,8 @@ static int xhci_dbc_tty_register_device(struct xhci_dbc *dbc)
411411
goto err_idr;
412412
}
413413

414-
ret = kfifo_alloc(&port->write_fifo, DBC_WRITE_BUF_SIZE, GFP_KERNEL);
414+
ret = kfifo_alloc(&port->port.xmit_fifo, DBC_WRITE_BUF_SIZE,
415+
GFP_KERNEL);
415416
if (ret)
416417
goto err_exit_port;
417418

@@ -440,7 +441,7 @@ static int xhci_dbc_tty_register_device(struct xhci_dbc *dbc)
440441
xhci_dbc_free_requests(&port->read_pool);
441442
xhci_dbc_free_requests(&port->write_pool);
442443
err_free_fifo:
443-
kfifo_free(&port->write_fifo);
444+
kfifo_free(&port->port.xmit_fifo);
444445
err_exit_port:
445446
idr_remove(&dbc_tty_minors, port->minor);
446447
err_idr:
@@ -465,7 +466,7 @@ static void xhci_dbc_tty_unregister_device(struct xhci_dbc *dbc)
465466
idr_remove(&dbc_tty_minors, port->minor);
466467
mutex_unlock(&dbc_tty_minors_lock);
467468

468-
kfifo_free(&port->write_fifo);
469+
kfifo_free(&port->port.xmit_fifo);
469470
xhci_dbc_free_requests(&port->read_pool);
470471
xhci_dbc_free_requests(&port->read_queue);
471472
xhci_dbc_free_requests(&port->write_pool);

0 commit comments

Comments
 (0)