serial: 8250: Make uart_match_port() a 8250 specific function

The 8250 driver conglomerate is the only user of uart_match_port() and
in fact it already is 8250 specific as it uses hub6_match_port() which
is defined in drivers/tty/serial/8250/8250_hub6.c unless the dummy
implementation is in use.

Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com>
Link: https://patch.msgid.link/be86d77ed317b0e77249c9a2f4d68780c1f60f90.1786697789.git.u.kleine-koenig@baylibre.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Uwe Kleine-König (The Capable Hub) 2026-08-14 11:19:29 +02:00 committed by Greg Kroah-Hartman
parent 32ba8093a8
commit a0ffa28e87
4 changed files with 27 additions and 31 deletions

View File

@ -70,7 +70,7 @@ Other functions
.. kernel-doc:: drivers/tty/serial/serial_core.c
:identifiers: uart_update_timeout uart_get_baud_rate uart_get_divisor
uart_match_port uart_write_wakeup uart_register_driver
uart_write_wakeup uart_register_driver
uart_unregister_driver uart_suspend_port uart_resume_port
uart_add_one_port uart_remove_one_port uart_console_write
uart_parse_earlycon uart_parse_options uart_set_options

View File

@ -673,6 +673,31 @@ EXPORT_SYMBOL(serial8250_resume_port);
*/
static DEFINE_MUTEX(serial_mutex);
/**
* serial8250_match_port - are the two ports equivalent?
* @port1: first port
* @port2: second port
*
* This utility function can be used to determine whether two uart_port
* structures describe the same port.
*/
static bool serial8250_match_port(const struct uart_port *port1,
const struct uart_port *port2)
{
if (port1->iotype != port2->iotype)
return false;
else if (port1->iotype == UPIO_PORT)
return port1->iobase == port2->iobase;
else if (port1->iotype == UPIO_HUB6)
return hub6_match_port(port1, port2);
else if (uart_iotype_mmio(port1->iotype))
return port1->mapbase == port2->mapbase;
else if (port1->iotype == UPIO_BUS)
return true;
else
return false;
}
static struct uart_8250_port *serial8250_find_match_or_unused(const struct uart_port *port)
{
int i;
@ -681,7 +706,7 @@ static struct uart_8250_port *serial8250_find_match_or_unused(const struct uart_
* First, find a port entry which matches.
*/
for (i = 0; i < nr_uarts; i++)
if (uart_match_port(&serial8250_ports[i].port, port))
if (serial8250_match_port(&serial8250_ports[i].port, port))
return &serial8250_ports[i];
/* try line number first if still available */

View File

@ -33,7 +33,6 @@
#include <linux/uaccess.h>
#include "serial_base.h"
#include "8250/8250.h" /* For hub6_match_port() */
/*
* This is used to lock changes in serial line configuration.
@ -3237,32 +3236,6 @@ static void serial_core_remove_one_port(struct uart_driver *drv,
state->uart_port = NULL;
}
/**
* uart_match_port - are the two ports equivalent?
* @port1: first port
* @port2: second port
*
* This utility function can be used to determine whether two uart_port
* structures describe the same port.
*/
bool uart_match_port(const struct uart_port *port1,
const struct uart_port *port2)
{
if (port1->iotype != port2->iotype)
return false;
else if (port1->iotype == UPIO_PORT)
return port1->iobase == port2->iobase;
else if (port1->iotype == UPIO_HUB6)
return hub6_match_port(port1, port2);
else if (uart_iotype_mmio(port1->iotype))
return port1->mapbase == port2->mapbase;
else if (port1->iotype == UPIO_BUS)
return true;
else
return false;
}
EXPORT_SYMBOL(uart_match_port);
static struct serial_ctrl_device *
serial_core_get_ctrl_dev(struct serial_port_device *port_dev)
{

View File

@ -1140,8 +1140,6 @@ int uart_add_one_port(struct uart_driver *reg, struct uart_port *port);
void uart_remove_one_port(struct uart_driver *reg, struct uart_port *port);
int uart_read_port_properties(struct uart_port *port);
int uart_read_and_validate_port_properties(struct uart_port *port);
bool uart_match_port(const struct uart_port *port1,
const struct uart_port *port2);
/*
* Power Management