From patchwork Wed Apr 5 11:15:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukasz Majczak X-Patchwork-Id: 670982 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 855EEC76188 for ; Wed, 5 Apr 2023 11:19:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237801AbjDELTU (ORCPT ); Wed, 5 Apr 2023 07:19:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58280 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237740AbjDELTT (ORCPT ); Wed, 5 Apr 2023 07:19:19 -0400 Received: from mail-lj1-x235.google.com (mail-lj1-x235.google.com [IPv6:2a00:1450:4864:20::235]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7FFDF4EF2 for ; Wed, 5 Apr 2023 04:19:17 -0700 (PDT) Received: by mail-lj1-x235.google.com with SMTP id y7so4492984ljp.2 for ; Wed, 05 Apr 2023 04:19:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf.com; s=google; t=1680693556; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=uSFYI7j66ps5gPOzhCvfrqWJlEEBkt6nqqDRdGGPNWs=; b=ZRZYDZjb9UaQoM5xipqVaih2q2qQxdW+75scFDNwTkOWzj5AOn/6IzMeL95eQ6fD92 MkEaGbjNZ1YZsGZgx0jehxkuD9ObaD1WH4q9rcsJA17e6eA4juTKVmZEaVFvAZOGWh9O 4nWR7jh6GAsWilAbgoNRIqTh9bsfb5I5WrjvDHBgrHtK99x4spl9oE54ZLSh8f7aELbK loF2pv7z6hUBQotlHBb1avnuuW+nyLkj4hR0H1Sm3s9PQ2RCyO/vZ664fJrauutfDV7v n+dcjt2LdkUu1GTIyAhgVurBo8wP7+icLnOtF1o8bjlJTY0C6wRlwpCYEHAB7ACL01QX mqfQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680693556; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=uSFYI7j66ps5gPOzhCvfrqWJlEEBkt6nqqDRdGGPNWs=; b=v2saUz7Dwnh2yxwmk9YbkSio+CJQYhypVanJYcnMU37Xu2OCoGHdHXCjlHEMvoH1FY 4U4tBxqJUCcKzp5+nNe8Vsw2kr1cvW/WYVFG/0A53k9jb6I6SaF/L47vuxZNVYWE6DNq Q0FqJUl6Eseg8y2N3KeV3FPlfnTJx/JTaOSb29vAUlVVrBWlgsSOuNrvnkA1jPfVspp+ FFpSUpyjwah0Mw7xGLVDIT7Mddw8g5/OUw8wR8x5BKDXljWLWzriY+NxZfvOdGzB2ujC JsR57UKqap1n3zLQoj4FBSHHVV0zKXuiv6/bHCsV6UFRzbVMk2TB0PtdgHIPFeRiTcmZ ZlDw== X-Gm-Message-State: AAQBX9evjtqVsNguOzPQH8bg5DKz6ZC/N/YAfmgnu122/AFnd6U283ez 9NjmPuTXyCNER7OEsBn+F7tu71yZWwtUEuwokAU= X-Google-Smtp-Source: AKy350aFzI2aNBR5MfpNTrIYh9Wa208NBwtIuPbYLOClHOuwpmtcl7SA9+n1MxM5vjHoBl3aTedR4w== X-Received: by 2002:a2e:8ed2:0:b0:299:a55a:f66f with SMTP id e18-20020a2e8ed2000000b00299a55af66fmr1471636ljl.22.1680693555793; Wed, 05 Apr 2023 04:19:15 -0700 (PDT) Received: from lmajczak1-l.roam.corp.google.com ([83.142.187.84]) by smtp.gmail.com with ESMTPSA id i19-20020a2e8093000000b0029f3e2efbb9sm2817730ljg.90.2023.04.05.04.19.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Apr 2023 04:19:15 -0700 (PDT) From: Lukasz Majczak To: Greg Kroah-Hartman , Jiri Slaby Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, upstream@semihalf.com, Lukasz Majczak , stable@vger.kernel.org Subject: [PATCH v2 1/2] serial: core: preserve cflags, ispeed and ospeed Date: Wed, 5 Apr 2023 13:15:58 +0200 Message-Id: <20230405111559.110220-2-lma@semihalf.com> X-Mailer: git-send-email 2.40.0.348.gf938b09366-goog In-Reply-To: <20230405111559.110220-1-lma@semihalf.com> References: <20230405111559.110220-1-lma@semihalf.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org Re-enable the console device after suspending, causes its cflags, ispeed and ospeed to be set anew, basing on the values stored in uport->cons. These values are set only once, when parsing console parameters after boot (see uart_set_options()), next after configuring a port in uart_port_startup() these parameters (cflags, ispeed and ospeed) are copied to termios structure and the original one (stored in uport->cons) are cleared, but there is no place in code where those fields are checked against 0. When kernel calls uart_resume_port() and setups console, it copies cflags, ispeed and ospeed values from uart->cons, but those are already cleared. The effect is that the console is broken. This patch address the issue by preserving the cflags, ispeed and ospeed fields in uart->cons during uart_port_startup(). Signed-off-by: Lukasz Majczak Cc: # 4.14+ --- drivers/tty/serial/serial_core.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c index 2bd32c8ece39..394a05c09d87 100644 --- a/drivers/tty/serial/serial_core.c +++ b/drivers/tty/serial/serial_core.c @@ -225,9 +225,6 @@ static int uart_port_startup(struct tty_struct *tty, struct uart_state *state, tty->termios.c_cflag = uport->cons->cflag; tty->termios.c_ispeed = uport->cons->ispeed; tty->termios.c_ospeed = uport->cons->ospeed; - uport->cons->cflag = 0; - uport->cons->ispeed = 0; - uport->cons->ospeed = 0; } /* * Initialise the hardware port settings.