linux-stable/drivers/tty/serial/serial_base.h
Tony Lindgren 04c7f60ca4 serial: core: Fix serial core port id, including multiport devices
We want to fix the serial core port DEVNAME to use a port id of the
hardware specific controller port instance instead of the port->line.

For example, the 8250 driver sets up a number of serial8250 ports
initially that can be inherited by the hardware specific driver. At that
the port->line no longer decribes the port's relation to the serial core
controller instance.

Let's fix the issue by assigning port->port_id for each serial core
controller port instance.

Fixes: 7d695d8376 ("serial: core: Fix serial_base_match() after fixing controller port name")
Tested-by: Guenter Roeck <linux@roeck-us.net>
Reviewed-by: Dhruva Gole <d-gole@ti.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20230811103648.2826-1-tony@atomide.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-08-11 21:19:22 +02:00

47 lines
1.6 KiB
C

/* SPDX-License-Identifier: GPL-2.0+ */
/*
* Serial core related functions, serial port device drivers do not need this.
*
* Copyright (C) 2023 Texas Instruments Incorporated - https://www.ti.com/
* Author: Tony Lindgren <tony@atomide.com>
*/
#define to_serial_base_ctrl_device(d) container_of((d), struct serial_ctrl_device, dev)
#define to_serial_base_port_device(d) container_of((d), struct serial_port_device, dev)
struct uart_driver;
struct uart_port;
struct device_driver;
struct device;
struct serial_ctrl_device {
struct device dev;
struct ida port_ida;
};
struct serial_port_device {
struct device dev;
struct uart_port *port;
};
int serial_base_ctrl_init(void);
void serial_base_ctrl_exit(void);
int serial_base_port_init(void);
void serial_base_port_exit(void);
int serial_base_driver_register(struct device_driver *driver);
void serial_base_driver_unregister(struct device_driver *driver);
struct serial_ctrl_device *serial_base_ctrl_add(struct uart_port *port,
struct device *parent);
struct serial_port_device *serial_base_port_add(struct uart_port *port,
struct serial_ctrl_device *parent);
void serial_base_ctrl_device_remove(struct serial_ctrl_device *ctrl_dev);
void serial_base_port_device_remove(struct serial_port_device *port_dev);
int serial_ctrl_register_port(struct uart_driver *drv, struct uart_port *port);
void serial_ctrl_unregister_port(struct uart_driver *drv, struct uart_port *port);
int serial_core_register_port(struct uart_driver *drv, struct uart_port *port);
void serial_core_unregister_port(struct uart_driver *drv, struct uart_port *port);