From patchwork Mon Oct 24 11:30:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9134 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp457281wru; Mon, 24 Oct 2022 06:35:43 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5jXTrVsv9brZySV0xiK/jYX7mXe7PcBTl3uSd5VhCquDwJ+njrN+jZBZDnx5Rufp3GyQw0 X-Received: by 2002:a05:6a00:16c4:b0:535:890:d52 with SMTP id l4-20020a056a0016c400b0053508900d52mr33839360pfc.9.1666618543554; Mon, 24 Oct 2022 06:35:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618543; cv=none; d=google.com; s=arc-20160816; b=h/CormG/4omp63guZMAl6+RuqBYuJfdtzBjWtkhnZFhi3SSO8rN89/kuVain5MKTXp 8peQfopZyrhk2NPiC2+5TuSnKX3wAPY7tMWjLYD0JQvAgaZ/FYqXbxBYa0eDyAyFzYji Ogsyzk0WYLCuGZw8mJ906dQIVq4AJ90DDAQycbpEeoNQb6DjENkkEJwRLh1ZJl+cBVvv 4Up7Z7AhLr7V5aKczdUH6NVDerZ9xhezAUW+mbt0swv/44lJNHV9f5EQgs8w5fi6Wqzz 1NtTqZBrgw+cBpQBMj91TPt7Fe11jlEGADJNFCLwZQCZ6jNIGb3ylVwzp0S0SEqOuCf8 giMA== 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=631Vk2O11PEwIGMf53oD2xyW7ox/QRqrZZomycy6nPw=; b=KeuU700hg5r7U9IbMXm7gabjedFhpF44UtI/7RXJxJuqJMhdmlalZBWchKOi7lWY5p 5dO2ujGQTrcZoR1pNDX5N9cCUTDLxZorRGHCKD3GI1CBERh6ZneyVAa++C3Pum1nTzgn 1o6vmix0h8tEGc8zSmL/n0NdXJyb9ePeejXfFJjkxzwbYglbWDZPSttgOz9ehbDtv9TW feUr/TCAAephyk02ds1atpgLZIH7CM+slDLFuwUAtbGpUJfLGpLU8N9eS47BxgYG9kkM j5CXbMVEf1Lr578YRlJm6UlsEmraVadbjFNPNfw7T9rtDgHX9laocAt27Zn78aNSvV6q gV/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=GoPVHuAE; 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 e3-20020a170902744300b001865d57b179si15281466plt.47.2022.10.24.06.35.27; Mon, 24 Oct 2022 06:35:43 -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=GoPVHuAE; 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 S235992AbiJXNS5 (ORCPT + 99 others); Mon, 24 Oct 2022 09:18:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46988 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235935AbiJXNRk (ORCPT ); Mon, 24 Oct 2022 09:17:40 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 37B833B73D; Mon, 24 Oct 2022 05:26:47 -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 dfw.source.kernel.org (Postfix) with ESMTPS id 3208961218; Mon, 24 Oct 2022 12:26:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 46E59C433D7; Mon, 24 Oct 2022 12:26:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614389; bh=ZxSQegdatY0a2JgwLpgyobk/Yi+Ena2okixr8pXbOdY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GoPVHuAEEjS+koNNT/nKkh9eMhbXZlxBhOBngyRXnauZqIf4dQQIdFVnb6g2mUGZp QWUVvOIaWaosjyoHlsWdAZNuG8WqdgqolGm9ekcJd50GUU3AHD+LbxaxaOnKmgKw0f 41ekdk61/bedjcuyrro4QaLu0PJuxD6mpqoy+ej0= 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 5.10 242/390] serial: 8250: Fix restoring termios speed after suspend Date: Mon, 24 Oct 2022 13:30:39 +0200 Message-Id: <20221024113033.128175950@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@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?1747576205704473887?= X-GMAIL-MSGID: =?utf-8?q?1747576205704473887?= 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 4a0793e1ba61..ecd2b3d252ec 100644 --- a/drivers/tty/serial/8250/8250_port.c +++ b/drivers/tty/serial/8250/8250_port.c @@ -3289,8 +3289,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(port, baud, &frac);