From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DE66EC33CAF for ; Thu, 16 Jan 2020 18:22:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B96A020684 for ; Thu, 16 Jan 2020 18:22:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579198965; bh=AQ8ic89c7+1mEdQVK2dagDthUfeUVWLZ6nusFWJq5o8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=rubVvTxGpcHG0omSaOUAJsUwNJz5jEZLAYX3DZsoPjV0AVYQ/eiDXye2E7/225snv Esez1xmw4bfK1S45I8K+QUoz1iUy3MWa58YtEsfrEndzR22+qn2P8c4WJF+fXLVMql 5YBKZsRnxhOL9b5Q9vHnmqxyyv5GSE5DIALRUEcI= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2392540AbgAPSW2 (ORCPT ); Thu, 16 Jan 2020 13:22:28 -0500 Received: from mail.kernel.org ([198.145.29.99]:37408 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404061AbgAPR1b (ORCPT ); Thu, 16 Jan 2020 12:27:31 -0500 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 14275246BE; Thu, 16 Jan 2020 17:27:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579195651; bh=AQ8ic89c7+1mEdQVK2dagDthUfeUVWLZ6nusFWJq5o8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mU8xIU+akZ0Oaqlycf+PT2yzNsvAR383C2t+Y0ou8P17POVSeOydGk7KAdhsyiW1/ gJc4yCrVJXqKkm1gf4srMq+b/YMnhDZSEiR1yzY3ZjUs8dr1YejcNJivzFTQ5sUKGJ SSYGhT83zJ/HPMsRNKg1a+mui0nRtBJNUYHygT1Y= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Erwan Le Ray , Greg Kroah-Hartman , Sasha Levin , linux-serial@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org Subject: [PATCH AUTOSEL 4.14 213/371] serial: stm32: fix transmit_chars when tx is stopped Date: Thu, 16 Jan 2020 12:21:25 -0500 Message-Id: <20200116172403.18149-156-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200116172403.18149-1-sashal@kernel.org> References: <20200116172403.18149-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-serial-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org From: Erwan Le Ray [ Upstream commit b83b957c91f68e53f0dc596e129e8305761f2a32 ] Disables the tx irq when the transmission is ended and updates stop_tx conditions for code cleanup. Fixes: 48a6092fb41f ("serial: stm32-usart: Add STM32 USART Driver") Signed-off-by: Erwan Le Ray Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/tty/serial/stm32-usart.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/drivers/tty/serial/stm32-usart.c b/drivers/tty/serial/stm32-usart.c index c43590077372..a1e31913bcf9 100644 --- a/drivers/tty/serial/stm32-usart.c +++ b/drivers/tty/serial/stm32-usart.c @@ -310,13 +310,8 @@ static void stm32_transmit_chars(struct uart_port *port) return; } - if (uart_tx_stopped(port)) { - stm32_stop_tx(port); - return; - } - - if (uart_circ_empty(xmit)) { - stm32_stop_tx(port); + if (uart_circ_empty(xmit) || uart_tx_stopped(port)) { + stm32_clr_bits(port, ofs->cr1, USART_CR1_TXEIE); return; } @@ -329,7 +324,7 @@ static void stm32_transmit_chars(struct uart_port *port) uart_write_wakeup(port); if (uart_circ_empty(xmit)) - stm32_stop_tx(port); + stm32_clr_bits(port, ofs->cr1, USART_CR1_TXEIE); } static irqreturn_t stm32_interrupt(int irq, void *ptr) -- 2.20.1