diff --git a/bsp/drivers/uart/sunxi-uart-ng-core.c b/bsp/drivers/uart/sunxi-uart-ng-core.c index 3d48332f2e..34de1a8d10 100644 --- a/bsp/drivers/uart/sunxi-uart-ng-core.c +++ b/bsp/drivers/uart/sunxi-uart-ng-core.c @@ -791,8 +791,10 @@ static void sunxi_uart_set_termios(struct uart_port *port, struct ktermios *term dlh = quot >> 8; SERIAL_DBG(port->dev, "set baudrate %d, quot %d\n", baud, quot); +#if (LINUX_VERSION_CODE <= KERNEL_VERSION(5, 15, 153)) if (uart_console(port)) console_lock(); +#endif spin_lock_irqsave(&port->lock, flags); uart_update_timeout(port, termios->c_cflag, baud); @@ -884,8 +886,10 @@ static void sunxi_uart_set_termios(struct uart_port *port, struct ktermios *term spin_unlock_irqrestore(&port->lock, flags); +#if (LINUX_VERSION_CODE <= KERNEL_VERSION(5, 15, 153)) if (uart_console(port)) console_unlock(); +#endif /* Don't rewrite B0 */ if (tty_termios_baud_rate(termios)) diff --git a/bsp/drivers/uart/sunxi-uart.c b/bsp/drivers/uart/sunxi-uart.c index fcaf36557e..2944784b49 100644 --- a/bsp/drivers/uart/sunxi-uart.c +++ b/bsp/drivers/uart/sunxi-uart.c @@ -1207,8 +1207,10 @@ static void sw_uart_set_termios(struct uart_port *port, struct ktermios *termios dlh = quot >> 8; SERIAL_DBG(port->dev, "set baudrate %d, quot %d\n", baud, quot); +#if (LINUX_VERSION_CODE <= KERNEL_VERSION(5, 15, 153)) if (uart_console(port)) console_lock(); +#endif spin_lock_irqsave(&port->lock, flags); uart_update_timeout(port, termios->c_cflag, baud); @@ -1304,8 +1306,10 @@ static void sw_uart_set_termios(struct uart_port *port, struct ktermios *termios spin_unlock_irqrestore(&port->lock, flags); +#if (LINUX_VERSION_CODE <= KERNEL_VERSION(5, 15, 153)) if (uart_console(port)) console_unlock(); +#endif /* Don't rewrite B0 */ if (tty_termios_baud_rate(termios))