All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christian Marangi <ansuelsmth@gmail.com>
To: "Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"Jiri Slaby" <jirislaby@kernel.org>,
	"Rob Herring" <robh@kernel.org>,
	"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
	"Conor Dooley" <conor+dt@kernel.org>,
	"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
	"Christian Marangi" <ansuelsmth@gmail.com>,
	"Andy Shevchenko" <andriy.shevchenko@linux.intel.com>,
	"Benjamin Larsson" <benjamin.larsson@genexis.eu>,
	"John Ogness" <john.ogness@linutronix.de>,
	"Marco Felsch" <m.felsch@pengutronix.de>,
	"Gerhard Engleder" <eg@keba.com>,
	"Jiaxun Yang" <jiaxun.yang@flygoat.com>,
	"Randy Dunlap" <rdunlap@infradead.org>,
	"Binbin Zhou" <zhoubinbin@loongson.cn>,
	"Rong Zhang" <rongrong@oss.cipunited.com>,
	"Lukas Wunner" <lukas@wunner.de>,
	"Lubomir Rintel" <lkundrak@v3.sk>,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-serial@vger.kernel.org
Subject: [PATCH 2/4] serial: 8250: export serial8250_get_baud_rate()
Date: Thu,  9 Jul 2026 22:56:50 +0200	[thread overview]
Message-ID: <20260709205656.319531-3-ansuelsmth@gmail.com> (raw)
In-Reply-To: <20260709205656.319531-1-ansuelsmth@gmail.com>

Some driver might need to access the current baud rate to correctly
configure it.

Export the serial8250_get_baud_rate() function to limit code duplication.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
---
 drivers/tty/serial/8250/8250_port.c | 7 ++++---
 include/linux/serial_8250.h         | 4 ++++
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c
index 630deb7dd344..033d8fb8bb23 100644
--- a/drivers/tty/serial/8250/8250_port.c
+++ b/drivers/tty/serial/8250/8250_port.c
@@ -2560,9 +2560,9 @@ static void serial8250_set_divisor(struct uart_port *port, unsigned int baud,
 		serial8250_do_set_divisor(port, baud, quot);
 }
 
-static unsigned int serial8250_get_baud_rate(struct uart_port *port,
-					     struct ktermios *termios,
-					     const struct ktermios *old)
+unsigned int serial8250_get_baud_rate(struct uart_port *port,
+				      struct ktermios *termios,
+				      const struct ktermios *old)
 {
 	unsigned int tolerance = port->uartclk / 100;
 	unsigned int min;
@@ -2589,6 +2589,7 @@ static unsigned int serial8250_get_baud_rate(struct uart_port *port,
 	 */
 	return uart_get_baud_rate(port, termios, old, min, max);
 }
+EXPORT_SYMBOL_GPL(serial8250_get_baud_rate);
 
 /*
  * Note in order to avoid the tty port mutex deadlock don't use the next method
diff --git a/include/linux/serial_8250.h b/include/linux/serial_8250.h
index a95b2d143d24..8d26fa2008b6 100644
--- a/include/linux/serial_8250.h
+++ b/include/linux/serial_8250.h
@@ -208,6 +208,10 @@ void serial8250_console_write(struct uart_8250_port *up, const char *s,
 int serial8250_console_setup(struct uart_port *port, char *options, bool probe);
 int serial8250_console_exit(struct uart_port *port);
 
+unsigned int serial8250_get_baud_rate(struct uart_port *port,
+				      struct ktermios *termios,
+				      const struct ktermios *old);
+
 void serial8250_set_isa_configurator(void (*v)(int port, struct uart_port *up,
 					       u32 *capabilities));
 
-- 
2.53.0


  parent reply	other threads:[~2026-07-09 20:57 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-09 20:56 [PATCH 0/4] serial: 8250: Add AN7581 UART support Christian Marangi
2026-07-09 20:56 ` [PATCH 1/4] dt-bindings: serial: 8250: Add Airoha compatibles Christian Marangi
2026-07-10 16:43   ` Conor Dooley
2026-07-09 20:56 ` Christian Marangi [this message]
2026-07-09 21:35   ` [PATCH 2/4] serial: 8250: export serial8250_get_baud_rate() Andy Shevchenko
2026-07-09 21:39     ` Christian Marangi
2026-07-10  8:20       ` Andy Shevchenko
2026-07-10  8:49         ` Christian Marangi
2026-07-10  9:14           ` Andy Shevchenko
2026-07-10  8:19   ` Ilpo Järvinen
2026-07-09 20:56 ` [PATCH 3/4] serial: 8250: map UAPI port type to internal enum Christian Marangi
2026-07-09 21:18   ` sashiko-bot
2026-07-09 21:37   ` Andy Shevchenko
2026-07-09 21:46     ` Christian Marangi
2026-07-10 10:09       ` Andy Shevchenko
2026-07-09 20:56 ` [PATCH 4/4] serial: 8250: Add Airoha SoC UART and HSUART support Christian Marangi
2026-07-09 21:19   ` sashiko-bot
2026-07-10  7:13   ` Jiri Slaby
2026-07-14 14:55     ` Benjamin Larsson

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=20260709205656.319531-3-ansuelsmth@gmail.com \
    --to=ansuelsmth@gmail.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=benjamin.larsson@genexis.eu \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=eg@keba.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=jiaxun.yang@flygoat.com \
    --cc=jirislaby@kernel.org \
    --cc=john.ogness@linutronix.de \
    --cc=krzk+dt@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=lkundrak@v3.sk \
    --cc=lukas@wunner.de \
    --cc=m.felsch@pengutronix.de \
    --cc=rdunlap@infradead.org \
    --cc=robh@kernel.org \
    --cc=rongrong@oss.cipunited.com \
    --cc=zhoubinbin@loongson.cn \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.