The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Michael Pratt <mcpratt@pm.me>
To: linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Jiri Slaby <jirislaby@kernel.org>
Cc: "Wander Lairson Costa" <wander@redhat.com>,
	"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
	"Andy Shevchenko" <andriy.shevchenko@linux.intel.com>,
	"Vamshi Gajjela" <vamshigajjela@google.com>,
	"Michael Pratt" <mcpratt@pm.me>
Subject: [PATCH v2 2/3] serial: 8250: Store whether fifo device is enabled
Date: Tue, 16 Apr 2024 18:29:56 +0000	[thread overview]
Message-ID: <20240416182741.22514-3-mcpratt@pm.me> (raw)
In-Reply-To: <20240416182741.22514-1-mcpratt@pm.me>

Currently, there are 7 checks for whether to enable
the internal fifo device of a 8250/16550 type uart.

Instead of checking all 7 values again whenever
we need to know whether we have the fifo device enabled,
store the result as a struct member of uart_8250_port.

This can, for example, lessen the amount
of calculations done during a write operation.

Signed-off-by: Michael Pratt <mcpratt@pm.me>
---
V1 -> V2: new commit

 drivers/tty/serial/8250/8250_port.c | 2 ++
 include/linux/serial_8250.h         | 1 +
 2 files changed, 3 insertions(+)

diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c
index fc9dd5d45295..5b0cfe6bc98c 100644
--- a/drivers/tty/serial/8250/8250_port.c
+++ b/drivers/tty/serial/8250/8250_port.c
@@ -3392,6 +3392,8 @@ void serial8250_console_write(struct uart_8250_port *up, const char *s,
 		 */
 		!(up->port.flags & UPF_CONS_FLOW);
 
+	up->fifo_enable = use_fifo;
+
 	if (likely(use_fifo))
 		serial8250_console_fifo_write(up, s, count);
 	else
diff --git a/include/linux/serial_8250.h b/include/linux/serial_8250.h
index fd59ed2cca53..017429f0e743 100644
--- a/include/linux/serial_8250.h
+++ b/include/linux/serial_8250.h
@@ -127,6 +127,7 @@ struct uart_8250_port {
 	struct list_head	list;		/* ports on this IRQ */
 	u32			capabilities;	/* port capabilities */
 	u16			bugs;		/* port bugs */
+	unsigned int		fifo_enable;	/* fifo enabled if capable */
 	unsigned int		tx_loadsz;	/* transmit fifo load size */
 	unsigned char		acr;
 	unsigned char		fcr;
-- 
2.30.2



  parent reply	other threads:[~2024-04-16 18:30 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-16 18:28 [PATCH v2 0/3] serial: 8250: Set fifo timeout with uart_fifo_timeout() Michael Pratt
2024-04-16 18:29 ` [PATCH v2 1/3] serial: core: Store fifo timeout again Michael Pratt
2024-04-16 18:58   ` Andy Shevchenko
2024-04-16 19:20     ` Michael Pratt
2024-04-17  8:18       ` Ilpo Järvinen
2024-04-17 15:41       ` Wander Lairson Costa
2024-04-17  7:52   ` Ilpo Järvinen
2024-04-16 18:29 ` Michael Pratt [this message]
2024-04-16 18:55   ` [PATCH v2 2/3] serial: 8250: Store whether fifo device is enabled Andy Shevchenko
2024-04-16 19:09     ` Michael Pratt
2024-04-16 19:18       ` Andy Shevchenko
2024-04-16 19:40         ` Michael Pratt
2024-04-16 18:34 ` [PATCH v2 3/3] serial: 8250: Set fifo timeout using uart_fifo_timeout() Michael Pratt
2024-04-16 18:57   ` Andy Shevchenko
2024-04-16 19:15     ` Michael Pratt
2024-04-17  8:13       ` Ilpo Järvinen
2024-04-17  8:00   ` Ilpo Järvinen

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=20240416182741.22514-3-mcpratt@pm.me \
    --to=mcpratt@pm.me \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=jirislaby@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=vamshigajjela@google.com \
    --cc=wander@redhat.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