Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp3408047rwa; Tue, 23 Aug 2022 04:23:51 -0700 (PDT) X-Google-Smtp-Source: AA6agR7Gxokfpicwe9kp4R+wl0pDyFuJpQ6ph8Fu22+7/W/pL3rUdvlVy49dTLWATF+TamLchofk X-Received: by 2002:aa7:9084:0:b0:535:ed0c:f401 with SMTP id i4-20020aa79084000000b00535ed0cf401mr22697298pfa.48.1661253831196; Tue, 23 Aug 2022 04:23:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661253831; cv=none; d=google.com; s=arc-20160816; b=0LiBvYR7cvBS4eyCvDmtgnH8TF+LjeaOX+xnbs7Bsxm9DIBU5tyKEydUsPOmQqKilY v5TMD+IDlk8I8SkLX5yzItrNz2lKtGlwLvbaG8VWBDFRW6PYlY6kTkkBMorw258eqg4j M3HLuEDy0Mrcp7RUm07iuwCJB/FgKyhere2Yvywk2BGqMumMz+RSICFFY3xh2nP4aySN 7JojyYBXQH1Yb10I3y1rqHO0nKXRmJ0UIFbW2VaRe+Hr56Lx6xYOMAr70d2KvHTUe+vI L1e4caTu/0kK7iF3+/d0qyLbO8wnaGWuRejfkcwejKpltgmpHFGoxi9Lo7bDb12X5w/g 42MA== 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=xGE73d5O6FpsYsdyJLQB9b/Evl9SpNUXuw5Kmfhp7TQ=; b=VnaWOptyRXoLbYbA/o6mwdOLFu12jK1AgT2Df63TP80AvDIu+G9w5ND+YMI47aNauA cgKuLfPaAXVRr+s/LqvBwo2UfuE9uBuzld+OwZAG6S0A0vukh1LkbICf5A2tnFDoSAhL 7v4+h+zx1BGZcZ9fLBhRWuA2LG9CemEym5PGr+SG3gx9yOo1DrJZ6DanUy0p061Z7Hwl QdbpBxld+OOzYvQGvS4WHCY77nVarihcb5DpURFFyRl1WJ9GqAVWmdUh6VOF2y3oKGP2 C7lLHBwfhXYaEP4xmU6w9N+gJ6Qvkghr3xrAovWmUUqeKtzK3TByg7MOox8O7QPuUqOn RoIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=KL6NdvaM; 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 e8-20020a17090301c800b0016ed623a591si16055921plh.1.2022.08.23.04.23.39; Tue, 23 Aug 2022 04:23:51 -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=KL6NdvaM; 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 S1355966AbiHWKqD (ORCPT + 99 others); Tue, 23 Aug 2022 06:46:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46718 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355426AbiHWKiX (ORCPT ); Tue, 23 Aug 2022 06:38:23 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DB3A1A720F; Tue, 23 Aug 2022 02:07:45 -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 ams.source.kernel.org (Postfix) with ESMTPS id 3AFE5B81C65; Tue, 23 Aug 2022 09:07:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A6F92C433C1; Tue, 23 Aug 2022 09:07:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661245663; bh=5Yabsf9P9O//Eym2yywOLLQ57DVHSg+BZbAaS79Jszs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KL6NdvaMjez7UwcLEg3oYA/enpqul4I7Czn6q7dEaa7UbHCW428ZtSNdvRC+MrgZZ tnZPKU3pfHoAzrtg+CFMbH1TpBMjKoHG+qiblr2J0PhrGEaA6+8Drw9xoXsx1/xnwv dnWINX608e0nBx6wV4ArJ8/EwKFmpN0VVpEnNd4w= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andy Shevchenko , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= , Sasha Levin Subject: [PATCH 4.19 150/287] serial: 8250_dw: Store LSR into lsr_saved_flags in dw8250_tx_wait_empty() Date: Tue, 23 Aug 2022 10:25:19 +0200 Message-Id: <20220823080105.646601472@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080100.268827165@linuxfoundation.org> References: <20220823080100.268827165@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.1 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,T_SCC_BODY_TEXT_LINE 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: Ilpo Järvinen [ Upstream commit af14f3007e2dca0d112f10f6717ba43093f74e81 ] Make sure LSR flags are preserved in dw8250_tx_wait_empty(). This function is called from a low-level out function and therefore cannot call serial_lsr_in() as it would lead to infinite recursion. It is borderline if the flags need to be saved here at all since this code relates to writing LCR register which usually implies no important characters should be arriving. Fixes: 914eaf935ec7 ("serial: 8250_dw: Allow TX FIFO to drain before writing to UART_LCR") Reviewed-by: Andy Shevchenko Signed-off-by: Ilpo Järvinen Link: https://lore.kernel.org/r/20220608095431.18376-7-ilpo.jarvinen@linux.intel.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/tty/serial/8250/8250_dw.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/tty/serial/8250/8250_dw.c b/drivers/tty/serial/8250/8250_dw.c index c73d0eddd9b8..cc9d1f416db8 100644 --- a/drivers/tty/serial/8250/8250_dw.c +++ b/drivers/tty/serial/8250/8250_dw.c @@ -140,12 +140,15 @@ static void dw8250_check_lcr(struct uart_port *p, int value) /* Returns once the transmitter is empty or we run out of retries */ static void dw8250_tx_wait_empty(struct uart_port *p) { + struct uart_8250_port *up = up_to_u8250p(p); unsigned int tries = 20000; unsigned int delay_threshold = tries - 1000; unsigned int lsr; while (tries--) { lsr = readb (p->membase + (UART_LSR << p->regshift)); + up->lsr_saved_flags |= lsr & LSR_SAVE_FLAGS; + if (lsr & UART_LSR_TEMT) break; -- 2.35.1