From patchwork Wed Oct 19 08:30:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 5287 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp281174wrs; Wed, 19 Oct 2022 05:01:43 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7QUuE6mf2ChZul9XNp+c4p2wCNqsjoasKaR6CxPImrK9OhR3SEBsEjDCKBCCbqvT8Yvtqj X-Received: by 2002:a17:907:1623:b0:78d:9e8b:171d with SMTP id hb35-20020a170907162300b0078d9e8b171dmr6382204ejc.309.1666180893604; Wed, 19 Oct 2022 05:01:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666180893; cv=none; d=google.com; s=arc-20160816; b=ov66pu/8o/PjiadXVjGQn5IzTh+SAEtk6JB+FSgak2l0A3B8/TODhnEBgTXC28SxV7 tmVq59Cm9wuIUOV0CvjsgZKqo5qrNnFrSiP5Z+Oqdf6lDyUNxgH5+vx+BVFWWbKTx+Y5 xk9c0d6WVAKeDkBh2Z3UkWd26uA0HFuLAVcwNf8Hit1vsGNfhLCmOKlqJPiGLsEpkMeF +t+jl6144CRoHmeCUp/zjSmkYkSUSC+5aVbCnX4VIOkDd2bct5Nfd5I+0f8uyzWhQXRl 7f5833RaHUtgc6yTJSMtra1IR6VNv6X7Rpo7UcThErAAorvMUV7DyEDV4K/ccozsCUEv 2Kwg== 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=MfzIupuU4f7gxKCpHvYWZjw5mhygAi+AJtqHNo1yPvA=; b=wXjPrI3dzcC7kvzQy8EIC2M6SX+0rs/XTOo1pED73qi0bMl6PzjErEuEgOpYXlxZPj asUcNfFAtVqHUs+tucAqHG3TCN2otalxthpfUZwLwhXrmkGkaPbzzEsnbdkQRXhMXvEZ RJejzFwqBJZ4Pys3BgzUVxuQIEzkOri4aYAEMBtluSqUQl6qmJQ9uzLENPq8wwoE0dQg RKcTAPAadYwkENIgrYk4SaZ20eefww4vG2YY3qhwxNL38sL17bSeB7q0jmqu17PDNho3 2ggwpTAqi8adUgEXK0mlKklFMvg587ygNIdy78jhmB+uz+BKJKgIX1vpUGE9eVjlGuNQ pRnQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xNokawkH; 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 gq2-20020a170906e24200b0078dc5b2b6c4si11824847ejb.666.2022.10.19.05.01.06; Wed, 19 Oct 2022 05:01:33 -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=xNokawkH; 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 S232095AbiJSL4M (ORCPT + 99 others); Wed, 19 Oct 2022 07:56:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44506 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232657AbiJSLyy (ORCPT ); Wed, 19 Oct 2022 07:54:54 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C25AE4E85B; Wed, 19 Oct 2022 04:33:56 -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 sin.source.kernel.org (Postfix) with ESMTPS id 0926DCE2176; Wed, 19 Oct 2022 09:04:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 073A5C433C1; Wed, 19 Oct 2022 09:04:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170296; bh=09iG3FKJdgaGX8LMpwgPlfxosKODNCDDfn7JVVuezq0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xNokawkHd8mjdtaK0RAY3tXYkTNUMJqTorjEWhGbssmUNRuhI6aLpu2P/YkVbIQ5t 0dZhgj1g2c0VzEjXrbRYjbtAnpVPHRQGVCEq4vp/fKhxpNP8tAR1F7W8nAF5UZ8tQn GfovQf4gw1C6ojulSzUPQC9yjkzdZ6p18eDJBKjI= 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 6.0 564/862] serial: 8250: Fix restoring termios speed after suspend Date: Wed, 19 Oct 2022 10:30:51 +0200 Message-Id: <20221019083314.914687345@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 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?1747117296457605891?= X-GMAIL-MSGID: =?utf-8?q?1747117296457605891?= 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 ec7dca43619f..2030a92ac66e 100644 --- a/drivers/tty/serial/8250/8250_port.c +++ b/drivers/tty/serial/8250/8250_port.c @@ -3319,8 +3319,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);