Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp7546166rwi; Mon, 24 Oct 2022 16:33:23 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7DwMvasUYk1I8voOp42gvA0Z6VthdmcGabhC+NPAhOen8CpkuVdJ12B2I68JSLOe6B+GYj X-Received: by 2002:a17:90b:33d1:b0:212:f02a:e5c7 with SMTP id lk17-20020a17090b33d100b00212f02ae5c7mr14618821pjb.137.1666654403206; Mon, 24 Oct 2022 16:33:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666654403; cv=none; d=google.com; s=arc-20160816; b=V2RtFhrirEJm/zs3c1Dzpv1zC9NkCVV6gc0tw/uTQTurHLl/t9W3PkmD3rLLEWhjyZ GCBKsrdYiQRHZRdXVVrn5XNzRhccrd9S73uX3Fa0LN2bqKNwhQhUUXoHdXv9uU0rEpF8 o1E5Vep9Sz0P8ywFltN9H+elDda/+2M/kBSkLV5KB9b7VX8ZQ058oP6GBrUSjXBVfBtP /vySTMNfeqVVLGJ5T8xpz6at3tgbIi8n2lJLiPJYKHMGQUJqK4Bh7PyIxxNXSTg4F4sp hDbp3alaLGZbClEfeemmbBxuD4Vp2BGh4uP9brVjNpxCAuKpNLB70QhFT5vv7Zk0NJL7 CaKg== 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=HbGEfbwf4zkyG0ThGCxvgiiSD90a4lpRYWeg2YMjk64=; b=ABhw8fm5hqvoMgbkwv0lpoEcJPvg8OCn7FbH1tODYo4JlBlf4iLXcGKf5+L152ou99 ij18aRdDf5tYaD4BEt+/PndjVsEi20OTjS76jkVxQQGmm0x4Sch22hrV4dZuCjUmXY7D XSSirjY8gWnGijEhzz1e8NgCWVbwdBCzIaFLV3CzEtteFGkVN40uKsASZYylnfDqpuCg ubJipVHcz39j4sKIm0PMKeiYWOSABaCUvfgr6BuoDPJ3MRiOsBGJtyftRbmS7L2jmMuW DmGidmbKUXTkDIfZ+h4N2VXIduk+5TMKryTfn2rQgu9bOvK85TsEwVf63ZCoEF0BO5zO MxPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=vOMKbqFb; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r5-20020a170902be0500b00176a2d5ae14si891795pls.363.2022.10.24.16.33.11; Mon, 24 Oct 2022 16:33:23 -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=vOMKbqFb; 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 S230000AbiJXXF5 (ORCPT + 99 others); Mon, 24 Oct 2022 19:05:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54604 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230048AbiJXXFQ (ORCPT ); Mon, 24 Oct 2022 19:05:16 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1D11B13E9D; Mon, 24 Oct 2022 14:26:39 -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 5B0DACE1358; Mon, 24 Oct 2022 11:52:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 54D3EC433C1; Mon, 24 Oct 2022 11:52:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612365; bh=MnQq42w27sr4o4YFrHTKLGct+XKYyfZLsxJq6akJljY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vOMKbqFb3G7Ljj0B3z/cBInHebuJl+/HW/JCTSl30QGLzun4UbRZ7YI8NM1Qtb/Oa mLNWSiae+QfG9UjWaRYoTztUlpANmIj1qIYsqSaDTsDjgEBPwF1x5FiRT1Xo3KAJox 6adjRixMW/qm0xksQCBmCPuuExgTGn3Jy+mJzItg= 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 4.14 140/210] serial: 8250: Fix restoring termios speed after suspend Date: Mon, 24 Oct 2022 13:30:57 +0200 Message-Id: <20221024113001.529290223@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 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 5d614d645e81..def880039b30 100644 --- a/drivers/tty/serial/8250/8250_port.c +++ b/drivers/tty/serial/8250/8250_port.c @@ -3236,8 +3236,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); -- 2.35.1