From patchwork Mon Oct 24 11:31:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8455 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp402510wru; Mon, 24 Oct 2022 04:50:11 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5IVyXQxaAeQo78S/HhNf2B1tpVaSjwdQK7wyqcbMGmzrwOwHh2VL3Im12DXPkxQYSadYwP X-Received: by 2002:a63:4e66:0:b0:456:b3a7:7a80 with SMTP id o38-20020a634e66000000b00456b3a77a80mr27350262pgl.467.1666612210786; Mon, 24 Oct 2022 04:50:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666612210; cv=none; d=google.com; s=arc-20160816; b=GGySjcS9IsNegN9scFrpOZEIk9NEDT14uoYcD5tG3zGgFrdjqx/dODvlqiG6K5VUXs LNbM4xCrg1Bq7bXmwaCrFWLqIcUDB2Sezu9HMGSZBqaTzPnnOuiAqp0HmPw1BpYDfj77 amtG4FEdqSOZ+PmnftPlZj3zvx2zhwFjNKOnM53OvSei5sqQsde4xxYv5lrmUs/ZKw5B njIqEL7FluSeh7ou67XbkMykm/i5jni+M35qURCuAmsCP/S9tFy3DDVYuVzrt5AuB47P RYjPuswy1KvH9CiPP7PgZFuCq9jg3vqF8u27CwJTLM/EZFjUmNNccGsj9JXwyXD/OgO2 izFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=TYdLUnfCji5c02z+fBA5sBo555RNA8HXEQNBKAznWiE=; b=KUK0NroHu5Hk7enSdnWTLDTDEOv1jEArFcQk9KhUZgMGLCwaKT9NXdO72HWp4sfRVg h8d0FaGkWFxKRaHbCfVFi8ZLRPUFeqnF1oXdGJlREOlmyhDNAwGbXFRI78z9D1RSA14L oF1vihVWfWnjQ0U7qpgPII8mh8D/JVYpu4uVoena5b8w0OA4Td59tj8Dlm95kMvSGVxz /pqmHg2h0FcW4GeL5szrzqCbjKXYcQQcRxsgGvNEZGRGQBQQObOkpjFT3rezTnE/LphN AewZ20qJPLFkJLX7ilDDcbnWu/bWyPfDQvadyTLysq9qYILpSmDYbH7KZikPsOSm+zL6 KPeQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=qbsmyALE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ob15-20020a17090b390f00b00205b268cd58si10103146pjb.181.2022.10.24.04.49.56; Mon, 24 Oct 2022 04:50:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=qbsmyALE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231793AbiJXLsw (ORCPT + 99 others); Mon, 24 Oct 2022 07:48:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43296 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231261AbiJXLrx (ORCPT ); Mon, 24 Oct 2022 07:47:53 -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 6EB2B1706B; Mon, 24 Oct 2022 04:43:13 -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 5A666B81145; Mon, 24 Oct 2022 11:43:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B0A5CC433D6; Mon, 24 Oct 2022 11:43:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611789; bh=SjBV13h7OzJpyXQwlSZnCR0qpzsc4VJNxnMghl2pOgU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qbsmyALEywJ1ky/zCVBXmgW/s3o/tvb4pQ1dI3EfWevsZmB5ql0XRIPn9XnNmGDaE nsLOsaKmWpZ0s3Dtn0Wq5D4Und+Bo1Hazyo6B9e+7GmP5COv2usnt1P7fkJw4FoAlK Pixu90uqza/p81fQ8W4T9uQrTf6mCdro6xgWxlCk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?utf-8?q?Pali_Roh=C3=A1r?= , Sasha Levin Subject: [PATCH 4.9 110/159] serial: 8250: Fix restoring termios speed after suspend Date: Mon, 24 Oct 2022 13:31:04 +0200 Message-Id: <20221024112953.469428340@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747569565619860078?= X-GMAIL-MSGID: =?utf-8?q?1747569565619860078?= From: Pali Rohár [ 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 suspend") Signed-off-by: Pali Rohár 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 d337a6d02282..b461cf2cc2ca 100644 --- a/drivers/tty/serial/8250/8250_port.c +++ b/drivers/tty/serial/8250/8250_port.c @@ -3146,8 +3146,13 @@ static void serial8250_console_restore(struct uart_8250_port *up) unsigned int baud, quot, frac = 0; termios.c_cflag = port->cons->cflag; - if (port->state->port.tty && termios.c_cflag == 0) + termios.c_ispeed = port->cons->ispeed; + termios.c_ospeed = port->cons->ospeed; + if (port->state->port.tty && termios.c_cflag == 0) { termios.c_cflag = port->state->port.tty->termios.c_cflag; + termios.c_ispeed = port->state->port.tty->termios.c_ispeed; + termios.c_ospeed = port->state->port.tty->termios.c_ospeed; + } baud = serial8250_get_baud_rate(port, &termios, NULL); quot = serial8250_get_divisor(up, baud, &frac);