Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp1864294rwb; Fri, 19 Aug 2022 10:39:19 -0700 (PDT) X-Google-Smtp-Source: AA6agR7kqt/fTb56hZGDtkmt78Qo+GdK9RPiIvAfHSlLRq2vwnMVIOwTBo/ZCcToeB6FewbVvmMB X-Received: by 2002:a17:902:e5c9:b0:16e:f3b6:ddc4 with SMTP id u9-20020a170902e5c900b0016ef3b6ddc4mr8192802plf.30.1660930758834; Fri, 19 Aug 2022 10:39:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660930758; cv=none; d=google.com; s=arc-20160816; b=Y5No0uX2heCOw5uNq8UI8cpfbn4TSc2KtbZA4RfM+bgbnf0VBFJPLIHFYsH/ZAm3Sc nBAoQzmPK8Ggruqm5W1Vv9YKDRdbTAFuOCDbdyNlXcOPfUiRcITg4xghEd8i7gTylD0E CMS1YsIZtUglKge0W2qligAXG8thZ1EE3msj8zxUrV89+5b6R5XWLpJ2cT1ZwUf+sbOf QOqXC+gFaj7V6Kbv9N6MA+LJTAlHs+Px+pLO3lVKCB7kAsyhi+mEg+ZXxpIiMFGZi1ZU bz1ojw1Vrgk7xmm8nYkbkOSq/7x01TYE8CJjN1etdrOt4EJ+hFiEu1o8l7fMRyAaVvn8 LlxA== 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=pjmOLt4VJIGhlriVy89ANY06Tg/W4gUE5bJdfKkV6Xo=; b=nvajLiJGrekn90P0hac4CXsLKqgGr96c0nUKWyUCd6embp9QQ9QrA6h0QwGXmNJQtQ QSaHKgmsbVaKjUGgyfVhPE41deoANMjoCjeVdAqJTmKnt+oY35uU9LeUw5V/TMjuYGxj SZsQCVpN/QRYoq72T46tGxRxNg84szj096ELV5QXdwXxsT1r3BcDPxivzFPxhJv7JVs2 TRBj9r0yAdenyIUMmNCV5AppUPd4ZTMqYJM4Nrta25kfLmGdWOZ4/nznW4Bg3mt4S0vT HfrDnFjK8R5SamPasuXu3EmK8RwG7DiA/2O8ueVg0FPJ0eMY3wJgAao9IqlqFhmn49SP 3SPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=tmdfwbNc; 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 v21-20020a634655000000b0041d9e78e9d8si936299pgk.80.2022.08.19.10.39.07; Fri, 19 Aug 2022 10:39:18 -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=tmdfwbNc; 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 S1353051AbiHSQcz (ORCPT + 99 others); Fri, 19 Aug 2022 12:32:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55554 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352825AbiHSQaB (ORCPT ); Fri, 19 Aug 2022 12:30:01 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C9CC611A2E5; Fri, 19 Aug 2022 09:04:28 -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 022B3B8281C; Fri, 19 Aug 2022 16:04:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3B3CEC433C1; Fri, 19 Aug 2022 16:04:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660925062; bh=TZ2I0orKzVsErbjWyCR70Fk0ZaBl7NXIQBB05th5cEQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tmdfwbNcVscWfQ6jpVpC8v04r9zpEyY+hfuU6eVsA6ZFzK7lG0b+3yDmwvA0zWWps iCwBMeJb9tPBPBH1wEW1odAJXzFG0HyyN2QKkGIFxMx6Dmoy+lgUZcBfSrfO+JeRna BfWaCrr/xcp7f7so/SAF06hr975S6Rc4LFOEj4nI= 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 5.10 371/545] serial: 8250_dw: Store LSR into lsr_saved_flags in dw8250_tx_wait_empty() Date: Fri, 19 Aug 2022 17:42:21 +0200 Message-Id: <20220819153846.014567427@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220819153829.135562864@linuxfoundation.org> References: <20220819153829.135562864@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 49559731bbcf..ace221afeb03 100644 --- a/drivers/tty/serial/8250/8250_dw.c +++ b/drivers/tty/serial/8250/8250_dw.c @@ -124,12 +124,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