Skip to content

Commit f44f3f8

Browse files
committed
Merge tag 'tty-5.9-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty
Pull tty/serial/fbcon fixes from Greg KH: "Here are some small tty/serial and one more fbcon fix. They include: - serial core locking regression fixes - new device ids for 8250_pci driver - fbcon fix for syzbot found issue All have been in linux-next with no reported issues" * tag 'tty-5.9-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty: fbcon: Fix user font detection test at fbcon_resize(). serial: 8250_pci: Add Realtek 816a and 816b serial: core: fix console port-lock regression serial: core: fix port-lock initialisation
2 parents aac5925 + ec0972a commit f44f3f8

4 files changed

Lines changed: 33 additions & 25 deletions

File tree

drivers/tty/serial/8250/8250_pci.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5566,6 +5566,17 @@ static const struct pci_device_id serial_pci_tbl[] = {
55665566
PCI_ANY_ID, PCI_ANY_ID,
55675567
0, 0, pbn_wch384_4 },
55685568

5569+
/*
5570+
* Realtek RealManage
5571+
*/
5572+
{ PCI_VENDOR_ID_REALTEK, 0x816a,
5573+
PCI_ANY_ID, PCI_ANY_ID,
5574+
0, 0, pbn_b0_1_115200 },
5575+
5576+
{ PCI_VENDOR_ID_REALTEK, 0x816b,
5577+
PCI_ANY_ID, PCI_ANY_ID,
5578+
0, 0, pbn_b0_1_115200 },
5579+
55695580
/* Fintek PCI serial cards */
55705581
{ PCI_DEVICE(0x1c29, 0x1104), .driver_data = pbn_fintek_4 },
55715582
{ PCI_DEVICE(0x1c29, 0x1108), .driver_data = pbn_fintek_8 },

drivers/tty/serial/serial_core.c

Lines changed: 20 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1916,24 +1916,12 @@ static inline bool uart_console_enabled(struct uart_port *port)
19161916
return uart_console(port) && (port->cons->flags & CON_ENABLED);
19171917
}
19181918

1919-
static void __uart_port_spin_lock_init(struct uart_port *port)
1919+
static void uart_port_spin_lock_init(struct uart_port *port)
19201920
{
19211921
spin_lock_init(&port->lock);
19221922
lockdep_set_class(&port->lock, &port_lock_key);
19231923
}
19241924

1925-
/*
1926-
* Ensure that the serial console lock is initialised early.
1927-
* If this port is a console, then the spinlock is already initialised.
1928-
*/
1929-
static inline void uart_port_spin_lock_init(struct uart_port *port)
1930-
{
1931-
if (uart_console(port))
1932-
return;
1933-
1934-
__uart_port_spin_lock_init(port);
1935-
}
1936-
19371925
#if defined(CONFIG_SERIAL_CORE_CONSOLE) || defined(CONFIG_CONSOLE_POLL)
19381926
/**
19391927
* uart_console_write - write a console message to a serial port
@@ -2086,7 +2074,15 @@ uart_set_options(struct uart_port *port, struct console *co,
20862074
struct ktermios termios;
20872075
static struct ktermios dummy;
20882076

2089-
uart_port_spin_lock_init(port);
2077+
/*
2078+
* Ensure that the serial-console lock is initialised early.
2079+
*
2080+
* Note that the console-enabled check is needed because of kgdboc,
2081+
* which can end up calling uart_set_options() for an already enabled
2082+
* console via tty_find_polling_driver() and uart_poll_init().
2083+
*/
2084+
if (!uart_console_enabled(port) && !port->console_reinit)
2085+
uart_port_spin_lock_init(port);
20902086

20912087
memset(&termios, 0, sizeof(struct ktermios));
20922088

@@ -2378,13 +2374,6 @@ uart_configure_port(struct uart_driver *drv, struct uart_state *state,
23782374
/* Power up port for set_mctrl() */
23792375
uart_change_pm(state, UART_PM_STATE_ON);
23802376

2381-
/*
2382-
* If this driver supports console, and it hasn't been
2383-
* successfully registered yet, initialise spin lock for it.
2384-
*/
2385-
if (port->cons && !(port->cons->flags & CON_ENABLED))
2386-
__uart_port_spin_lock_init(port);
2387-
23882377
/*
23892378
* Ensure that the modem control lines are de-activated.
23902379
* keep the DTR setting that is set in uart_set_options()
@@ -2801,10 +2790,12 @@ static ssize_t console_store(struct device *dev,
28012790
if (oldconsole && !newconsole) {
28022791
ret = unregister_console(uport->cons);
28032792
} else if (!oldconsole && newconsole) {
2804-
if (uart_console(uport))
2793+
if (uart_console(uport)) {
2794+
uport->console_reinit = 1;
28052795
register_console(uport->cons);
2806-
else
2796+
} else {
28072797
ret = -ENOENT;
2798+
}
28082799
}
28092800
} else {
28102801
ret = -ENXIO;
@@ -2900,7 +2891,12 @@ int uart_add_one_port(struct uart_driver *drv, struct uart_port *uport)
29002891
goto out;
29012892
}
29022893

2903-
uart_port_spin_lock_init(uport);
2894+
/*
2895+
* If this port is in use as a console then the spinlock is already
2896+
* initialised.
2897+
*/
2898+
if (!uart_console_enabled(uport))
2899+
uart_port_spin_lock_init(uport);
29042900

29052901
if (uport->cons && uport->dev)
29062902
of_console_check(uport->dev->of_node, uport->cons->name, uport->line);

drivers/video/fbdev/core/fbcon.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2018,7 +2018,7 @@ static int fbcon_resize(struct vc_data *vc, unsigned int width,
20182018
struct fb_var_screeninfo var = info->var;
20192019
int x_diff, y_diff, virt_w, virt_h, virt_fw, virt_fh;
20202020

2021-
if (ops->p && ops->p->userfont && FNTSIZE(vc->vc_font.data)) {
2021+
if (p->userfont && FNTSIZE(vc->vc_font.data)) {
20222022
int size;
20232023
int pitch = PITCH(vc->vc_font.width);
20242024

include/linux/serial_core.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,7 @@ struct uart_port {
248248

249249
unsigned char hub6; /* this should be in the 8250 driver */
250250
unsigned char suspended;
251+
unsigned char console_reinit;
251252
const char *name; /* port name */
252253
struct attribute_group *attr_group; /* port specific attributes */
253254
const struct attribute_group **tty_groups; /* all attributes (serial core use only) */

0 commit comments

Comments
 (0)