* [PATCH v2 00/11] tty: random fixes and cleanups
@ 2024-08-08 10:35 Jiri Slaby (SUSE)
2024-08-08 10:35 ` [PATCH v2 04/11] xhci: dbgtty: remove kfifo_out() wrapper Jiri Slaby (SUSE)
2024-08-08 10:35 ` [PATCH v2 05/11] xhci: dbgtty: use kfifo from tty_port struct Jiri Slaby (SUSE)
0 siblings, 2 replies; 3+ messages in thread
From: Jiri Slaby (SUSE) @ 2024-08-08 10:35 UTC (permalink / raw)
To: gregkh
Cc: linux-serial, linux-kernel, Jiri Slaby (SUSE), Andreas Koensgen,
Andy Shevchenko, David S. Miller, Douglas Anderson, Eric Dumazet,
Ilpo Järvinen, Jakub Kicinski, Jeremy Kerr, linux-hams,
Matt Johnston, netdev, Paolo Abeni, Peter Hurley, linux-usb,
Mathias Nyman
Hi,
this is a series of locally accumulated patches over past months.
The series:
* makes mctp and 6pack use u8s,
* cleans up 6pack a bit,
* fixes two coverity reports,
* uses guard() to make some of the tty function easier to follow.
Cc: Andreas Koensgen <ajk@comnets.uni-bremen.de>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Douglas Anderson <dianders@chromium.org>
Cc: Eric Dumazet <edumazet@google.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Jeremy Kerr <jk@codeconstruct.com.au>
Cc: linux-hams@vger.kernel.org
Cc: Matt Johnston <matt@codeconstruct.com.au>
Cc: netdev@vger.kernel.org
Cc: Paolo Abeni <pabeni@redhat.com>
Cc: Peter Hurley <peter@hurleysoftware.com>
Cc: linux-usb@vger.kernel.org
Cc: Mathias Nyman <mathias.nyman@intel.com>
[v2]
* fixed "serial: use guards for simple mutex locks"
* added also previously missed xhci dbgtty patches
Jiri Slaby (SUSE) (11):
serial: use guards for simple mutex locks
mxser: remove stale comment
mxser: remove doubled sets of close times
xhci: dbgtty: remove kfifo_out() wrapper
xhci: dbgtty: use kfifo from tty_port struct
mctp: serial: propagage new tty types
6pack: remove sixpack::rbuff
6pack: drop sixpack::mtu
6pack: drop sixpack::buffsize
6pack: remove global strings
6pack: propagage new tty types
drivers/net/hamradio/6pack.c | 60 ++++++----------
drivers/net/mctp/mctp-serial.c | 23 ++++---
drivers/tty/mxser.c | 5 --
drivers/tty/serial/serial_core.c | 113 +++++++++++++------------------
drivers/usb/host/xhci-dbgcap.h | 1 -
drivers/usb/host/xhci-dbgtty.c | 30 +++-----
6 files changed, 88 insertions(+), 144 deletions(-)
--
2.46.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH v2 04/11] xhci: dbgtty: remove kfifo_out() wrapper
2024-08-08 10:35 [PATCH v2 00/11] tty: random fixes and cleanups Jiri Slaby (SUSE)
@ 2024-08-08 10:35 ` Jiri Slaby (SUSE)
2024-08-08 10:35 ` [PATCH v2 05/11] xhci: dbgtty: use kfifo from tty_port struct Jiri Slaby (SUSE)
1 sibling, 0 replies; 3+ messages in thread
From: Jiri Slaby (SUSE) @ 2024-08-08 10:35 UTC (permalink / raw)
To: gregkh
Cc: linux-serial, linux-kernel, Jiri Slaby (SUSE), Mathias Nyman,
linux-usb
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
---
drivers/usb/host/xhci-dbgtty.c | 15 +--------------
1 file changed, 1 insertion(+), 14 deletions(-)
diff --git a/drivers/usb/host/xhci-dbgtty.c b/drivers/usb/host/xhci-dbgtty.c
index b74e98e94393..64ea96494997 100644
--- a/drivers/usb/host/xhci-dbgtty.c
+++ b/drivers/usb/host/xhci-dbgtty.c
@@ -24,19 +24,6 @@ static inline struct dbc_port *dbc_to_port(struct xhci_dbc *dbc)
return dbc->priv;
}
-static unsigned int
-dbc_send_packet(struct dbc_port *port, char *packet, unsigned int size)
-{
- unsigned int len;
-
- len = kfifo_len(&port->write_fifo);
- if (len < size)
- size = len;
- if (size != 0)
- size = kfifo_out(&port->write_fifo, packet, size);
- return size;
-}
-
static int dbc_start_tx(struct dbc_port *port)
__releases(&port->port_lock)
__acquires(&port->port_lock)
@@ -49,7 +36,7 @@ static int dbc_start_tx(struct dbc_port *port)
while (!list_empty(pool)) {
req = list_entry(pool->next, struct dbc_request, list_pool);
- len = dbc_send_packet(port, req->buf, DBC_MAX_PACKET);
+ len = kfifo_out(&port->write_fifo, req->buf, DBC_MAX_PACKET);
if (len == 0)
break;
do_tty_wake = true;
--
2.46.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH v2 05/11] xhci: dbgtty: use kfifo from tty_port struct
2024-08-08 10:35 [PATCH v2 00/11] tty: random fixes and cleanups Jiri Slaby (SUSE)
2024-08-08 10:35 ` [PATCH v2 04/11] xhci: dbgtty: remove kfifo_out() wrapper Jiri Slaby (SUSE)
@ 2024-08-08 10:35 ` Jiri Slaby (SUSE)
1 sibling, 0 replies; 3+ messages in thread
From: Jiri Slaby (SUSE) @ 2024-08-08 10:35 UTC (permalink / raw)
To: gregkh
Cc: linux-serial, linux-kernel, Jiri Slaby (SUSE), Mathias Nyman,
linux-usb
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
---
drivers/usb/host/xhci-dbgcap.h | 1 -
drivers/usb/host/xhci-dbgtty.c | 17 +++++++++--------
2 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/drivers/usb/host/xhci-dbgcap.h b/drivers/usb/host/xhci-dbgcap.h
index 0118c6288a3c..eab59d921e22 100644
--- a/drivers/usb/host/xhci-dbgcap.h
+++ b/drivers/usb/host/xhci-dbgcap.h
@@ -110,7 +110,6 @@ struct dbc_port {
struct tasklet_struct push;
struct list_head write_pool;
- struct kfifo write_fifo;
bool registered;
};
diff --git a/drivers/usb/host/xhci-dbgtty.c b/drivers/usb/host/xhci-dbgtty.c
index 64ea96494997..881f5a7e6e0e 100644
--- a/drivers/usb/host/xhci-dbgtty.c
+++ b/drivers/usb/host/xhci-dbgtty.c
@@ -36,7 +36,7 @@ static int dbc_start_tx(struct dbc_port *port)
while (!list_empty(pool)) {
req = list_entry(pool->next, struct dbc_request, list_pool);
- len = kfifo_out(&port->write_fifo, req->buf, DBC_MAX_PACKET);
+ len = kfifo_out(&port->port.xmit_fifo, req->buf, DBC_MAX_PACKET);
if (len == 0)
break;
do_tty_wake = true;
@@ -203,7 +203,7 @@ static ssize_t dbc_tty_write(struct tty_struct *tty, const u8 *buf,
spin_lock_irqsave(&port->port_lock, flags);
if (count)
- count = kfifo_in(&port->write_fifo, buf, count);
+ count = kfifo_in(&port->port.xmit_fifo, buf, count);
dbc_start_tx(port);
spin_unlock_irqrestore(&port->port_lock, flags);
@@ -217,7 +217,7 @@ static int dbc_tty_put_char(struct tty_struct *tty, u8 ch)
int status;
spin_lock_irqsave(&port->port_lock, flags);
- status = kfifo_put(&port->write_fifo, ch);
+ status = kfifo_put(&port->port.xmit_fifo, ch);
spin_unlock_irqrestore(&port->port_lock, flags);
return status;
@@ -240,7 +240,7 @@ static unsigned int dbc_tty_write_room(struct tty_struct *tty)
unsigned int room;
spin_lock_irqsave(&port->port_lock, flags);
- room = kfifo_avail(&port->write_fifo);
+ room = kfifo_avail(&port->port.xmit_fifo);
spin_unlock_irqrestore(&port->port_lock, flags);
return room;
@@ -253,7 +253,7 @@ static unsigned int dbc_tty_chars_in_buffer(struct tty_struct *tty)
unsigned int chars;
spin_lock_irqsave(&port->port_lock, flags);
- chars = kfifo_len(&port->write_fifo);
+ chars = kfifo_len(&port->port.xmit_fifo);
spin_unlock_irqrestore(&port->port_lock, flags);
return chars;
@@ -411,7 +411,8 @@ static int xhci_dbc_tty_register_device(struct xhci_dbc *dbc)
goto err_idr;
}
- ret = kfifo_alloc(&port->write_fifo, DBC_WRITE_BUF_SIZE, GFP_KERNEL);
+ ret = kfifo_alloc(&port->port.xmit_fifo, DBC_WRITE_BUF_SIZE,
+ GFP_KERNEL);
if (ret)
goto err_exit_port;
@@ -440,7 +441,7 @@ static int xhci_dbc_tty_register_device(struct xhci_dbc *dbc)
xhci_dbc_free_requests(&port->read_pool);
xhci_dbc_free_requests(&port->write_pool);
err_free_fifo:
- kfifo_free(&port->write_fifo);
+ kfifo_free(&port->port.xmit_fifo);
err_exit_port:
idr_remove(&dbc_tty_minors, port->minor);
err_idr:
@@ -465,7 +466,7 @@ static void xhci_dbc_tty_unregister_device(struct xhci_dbc *dbc)
idr_remove(&dbc_tty_minors, port->minor);
mutex_unlock(&dbc_tty_minors_lock);
- kfifo_free(&port->write_fifo);
+ kfifo_free(&port->port.xmit_fifo);
xhci_dbc_free_requests(&port->read_pool);
xhci_dbc_free_requests(&port->read_queue);
xhci_dbc_free_requests(&port->write_pool);
--
2.46.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-08-08 10:36 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-08 10:35 [PATCH v2 00/11] tty: random fixes and cleanups Jiri Slaby (SUSE)
2024-08-08 10:35 ` [PATCH v2 04/11] xhci: dbgtty: remove kfifo_out() wrapper Jiri Slaby (SUSE)
2024-08-08 10:35 ` [PATCH v2 05/11] xhci: dbgtty: use kfifo from tty_port struct Jiri Slaby (SUSE)
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).