public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Jiri Slaby (SUSE)" <jirislaby@kernel.org>
To: gregkh@linuxfoundation.org
Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org,
	"Jiri Slaby (SUSE)" <jirislaby@kernel.org>,
	Mathias Nyman <mathias.nyman@intel.com>,
	linux-usb@vger.kernel.org
Subject: [PATCH v2 04/11] xhci: dbgtty: remove kfifo_out() wrapper
Date: Thu,  8 Aug 2024 12:35:40 +0200	[thread overview]
Message-ID: <20240808103549.429349-5-jirislaby@kernel.org> (raw)
In-Reply-To: <20240808103549.429349-1-jirislaby@kernel.org>

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


  parent reply	other threads:[~2024-08-08 10:36 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-08 10:35 [PATCH v2 00/11] tty: random fixes and cleanups Jiri Slaby (SUSE)
2024-08-08 10:35 ` [PATCH v2 01/11] serial: use guards for simple mutex locks Jiri Slaby (SUSE)
2024-08-08 10:35 ` [PATCH v2 02/11] mxser: remove stale comment Jiri Slaby (SUSE)
2024-08-08 10:35 ` [PATCH v2 03/11] mxser: remove doubled sets of close times Jiri Slaby (SUSE)
2024-08-08 10:35 ` Jiri Slaby (SUSE) [this message]
2024-08-08 10:35 ` [PATCH v2 05/11] xhci: dbgtty: use kfifo from tty_port struct Jiri Slaby (SUSE)
2024-08-08 10:35 ` [PATCH v2 06/11] mctp: serial: propagage new tty types Jiri Slaby (SUSE)
2024-08-08 10:35 ` [PATCH v2 07/11] 6pack: remove sixpack::rbuff Jiri Slaby (SUSE)
2024-08-08 10:35 ` [PATCH v2 08/11] 6pack: drop sixpack::mtu Jiri Slaby (SUSE)
2024-08-08 10:35 ` [PATCH v2 09/11] 6pack: drop sixpack::buffsize Jiri Slaby (SUSE)
2024-08-08 10:35 ` [PATCH v2 10/11] 6pack: remove global strings Jiri Slaby (SUSE)
2024-08-08 10:35 ` [PATCH v2 11/11] 6pack: propagage new tty types Jiri Slaby (SUSE)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240808103549.429349-5-jirislaby@kernel.org \
    --to=jirislaby@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=mathias.nyman@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox