From patchwork Sat Oct 22 07:25:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 7498 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1104886wrr; Sat, 22 Oct 2022 01:33:37 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7yX7AhbwhRTQiXzjIifqzk33EEkQr5iqp2NMxgRdRWBKqK+291/lENi9uKK++tApv86Ssl X-Received: by 2002:a17:90b:4c48:b0:20d:5c55:b8a8 with SMTP id np8-20020a17090b4c4800b0020d5c55b8a8mr27401364pjb.207.1666427617307; Sat, 22 Oct 2022 01:33:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427617; cv=none; d=google.com; s=arc-20160816; b=dzoZJRavoAC3uzZIggrQNKC7a4CDoxAJ3RB0CXSgRf6ihYAY3JyF1qMsvlyfj+B5bc sTSRwo3lt201ySyV4WmbJexLNtV5WOQzbVhrd1c4gBQ/924HeL+WjN1gt7a9HkRky/zn 3qwrUTbhOZ62QdAkCiZ+mYoHISEfpfcKZWdBLBj2jsPL3OuZfazuZjkk72532c+x8bp4 YZ5bbxm+NxarpOQ2qw7mp4rTaLH2YJv/kYQcZT0cTlIrOdaodMK4b0nPs5xc7q7YIwUY sbLffdfVFzWOa1Ks9Wg5jS61RmlmBj3irxRNAHhRQw5juAolT/ypSQOYJncNSObaXF1l XVjQ== 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=5NNOj/ruD0ez3T6+1ORfQ5fkNO9hR3GCk72SnKTzJpI=; b=ofO8R1TeyEnnrWb9CT55t8Zsw7+jppeU2macEMEaUXTW0Nb1BahbuiaMLvPrdVMG8U cPEpYFBzcVLTbpvSA1ZiNOzrWr/UtJWef+7ln5Am/xQ6Z6KwK4MsNfdIraGRLJEWzww2 vGOlJrvP829Fkn5pu0lBWHwcWf5KIcjchuSq0F5+in/8GVOpca1esLea0+fiZmoo3hyC tz2GZFoYSCaRKqpDj9LItdtxaLT/pwRGwiVALyn7A9CfiPMX7D+StOiVOUqkpxRm3PwD C9x1xTz4dzA5zXSJ0wZ3wfjVjthnyE6+C5VGTkaT6qo3vOoVCrzCs89ELQsgYGOoozIh 01Wg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=qiTOlCiq; 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 e12-20020a65678c000000b0045afe1a8821si28145082pgr.128.2022.10.22.01.33.23; Sat, 22 Oct 2022 01:33:37 -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=qiTOlCiq; 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 S233456AbiJVISs (ORCPT + 99 others); Sat, 22 Oct 2022 04:18:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48884 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234088AbiJVIQL (ORCPT ); Sat, 22 Oct 2022 04:16:11 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 88E45D6BA2; Sat, 22 Oct 2022 00:57:03 -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 B7EE360B83; Sat, 22 Oct 2022 07:57:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B2D04C433C1; Sat, 22 Oct 2022 07:56:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425420; bh=Q58M62zF5a2Iq9lsiN01H3o52BFXyQ3Xga6ESOSuWIQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qiTOlCiqmePeZAIIiqkgKsAdKSDUY2kSSMqPikeM04TfGAD5rGSnXvR72CC9MlPWK HQAj4l68jMqmSBaGTE4R3zM/H2+412c8ASuTG98F4+hqPh4wRI9vxiedLPCRK4DGss wAyec5dofYao1T74wLh5wwLma6etsZ5XnnFmdxog= 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.19 455/717] serial: 8250: Fix restoring termios speed after suspend Date: Sat, 22 Oct 2022 09:25:34 +0200 Message-Id: <20221022072518.416287983@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376005468473623?= X-GMAIL-MSGID: =?utf-8?q?1747376005468473623?= 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 d5f9b56fdbab..c66a029882e6 100644 --- a/drivers/tty/serial/8250/8250_port.c +++ b/drivers/tty/serial/8250/8250_port.c @@ -3325,8 +3325,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);