From nobody Fri Dec 19 17:23:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9F4FFECAAA1 for ; Mon, 24 Oct 2022 16:08:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233412AbiJXQIC (ORCPT ); Mon, 24 Oct 2022 12:08:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39248 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233244AbiJXQEY (ORCPT ); Mon, 24 Oct 2022 12:04:24 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 679B217E39; Mon, 24 Oct 2022 07:56:42 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id E1006B819D9; Mon, 24 Oct 2022 12:48:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 409DEC433C1; Mon, 24 Oct 2022 12:48:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666615729; bh=y2SA949lunMC2ZXSes0qkIrPRFGml5ebD16rMhNW00M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=04A8qT0Y7ZBJef/8W7rpi7u9Iunnv0FqMmowJGoEHL60Sf3Gg4h/FyRlzq89ocLPg MTNG0A/KvFQpmpPi7QcItbpkWSSx0yO0AJXDuFx4mUxhTasmhcRWop9xKNF/gYZGn6 yZ04knAwlk/mUKp/ZD7+MkDXNxogqFe1ljmN5+xk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Pali=20Roh=C3=A1r?= , Sasha Levin Subject: [PATCH 5.15 331/530] serial: 8250: Fix restoring termios speed after suspend Date: Mon, 24 Oct 2022 13:31:15 +0200 Message-Id: <20221024113059.995880119@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113044.976326639@linuxfoundation.org> References: <20221024113044.976326639@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Pali Roh=C3=A1r [ Upstream commit 379a33786d489ab81885ff0b3935cfeb36137fea ] Since commit edc6afc54968 ("tty: switch to ktermios and new framework") termios speed is no longer stored only in c_cflag member but also in new additional c_ispeed and c_ospeed members. If BOTHER flag is set in c_cflag then termios speed is stored only in these new members. Since commit 027b57170bf8 ("serial: core: Fix initializing and restoring termios speed") termios speed is available also in struct console. So properly restore also c_ispeed and c_ospeed members after suspend to fix restoring termios speed which is not represented by Bnnn constant. Fixes: 4516d50aabed ("serial: 8250: Use canary to restart console after sus= pend") Signed-off-by: Pali Roh=C3=A1r Link: https://lore.kernel.org/r/20220924104324.4035-1-pali@kernel.org Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/tty/serial/8250/8250_port.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/= 8250_port.c index ee457f5d504f..ec7846223f3a 100644 --- a/drivers/tty/serial/8250/8250_port.c +++ b/drivers/tty/serial/8250/8250_port.c @@ -3318,8 +3318,13 @@ static void serial8250_console_restore(struct uart_8= 250_port *up) unsigned int baud, quot, frac =3D 0; =20 termios.c_cflag =3D port->cons->cflag; - if (port->state->port.tty && termios.c_cflag =3D=3D 0) + termios.c_ispeed =3D port->cons->ispeed; + termios.c_ospeed =3D port->cons->ospeed; + if (port->state->port.tty && termios.c_cflag =3D=3D 0) { termios.c_cflag =3D port->state->port.tty->termios.c_cflag; + termios.c_ispeed =3D port->state->port.tty->termios.c_ispeed; + termios.c_ospeed =3D port->state->port.tty->termios.c_ospeed; + } =20 baud =3D serial8250_get_baud_rate(port, &termios, NULL); quot =3D serial8250_get_divisor(port, baud, &frac); --=20 2.35.1