Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp466504ybl; Tue, 28 Jan 2020 06:24:53 -0800 (PST) X-Google-Smtp-Source: APXvYqweEB7UiD+hy7ePnTYKuU1WMJc6+1Ka73zyJ8kX1BOOs+gN5D/AjjgXQ/VJx06TfwUX38Uy X-Received: by 2002:a9d:2647:: with SMTP id a65mr3826313otb.101.1580221493562; Tue, 28 Jan 2020 06:24:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580221493; cv=none; d=google.com; s=arc-20160816; b=zk1hawV0U+n76+tnHjxq1VyBnNgxLNRPvdnCg7MdAuhwvpisIQiyG345FqZFzwE6ei VnI2gDlEY9AlsAKAVFVWFRwKlNXdid4B3WRt2B7WWMrM+5565Ue0nY5xUGbk0abyFxu3 U3y6pu/AhPYec/ia4NNB/JcdjD+vGdD7QY2N1OYAJOsG3ja85f5+s0IoFwVQhTu1uGNg Laj+47UfvTridrpeV0oQ82M0bihw3D4OamJSMxO36r7ly8jndxoe9kwmFx7TTX7YGAK/ hLsJGyT+7iPyPG7+hMKnxB5oEaRtXsrCgRnRY8qOMmOeNm8mhmh4i/FLAjAZI4fwQreX KqOw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=L2o7eCkL8RL9EPS+fFc7vkiByJfjydS/tTu2kZXpLwE=; b=ln1Zlg0hp8k9JP2jzDwwaL+qXriyBa4ILXtMD3rEXg9BIZHrusuSGBocOZcID6FkCs IWWr5gAr/I3Y2pdTwvlwTyEGhJjrP+0Q170cfjhfwEPEMpsO7Ra96v267I1ovIRJMR7J tyrtTC+VUBUY2e3XYe1KHUtITaVMh+aX7pewkRh8aNEKSWlIbDkT++a+BeFgXJM4XqUV ACoB0Uv1Sc+F2vz5hjX0ilHzfZgjL6U3O7CB9NCDe/Hl7JupWNjhpKlUP52FVNykE1VL I0aDxYdcKKj5+esK3BglWlym8nHkBNS/PzeYtyTEkCQba2JC3yYfYUyLZzpRKJTAzgcn dxOQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=zaBjQ0Tg; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r22si8484822otn.192.2020.01.28.06.24.41; Tue, 28 Jan 2020 06:24:53 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=zaBjQ0Tg; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731703AbgA1OWr (ORCPT + 99 others); Tue, 28 Jan 2020 09:22:47 -0500 Received: from mail.kernel.org ([198.145.29.99]:48556 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731667AbgA1OWl (ORCPT ); Tue, 28 Jan 2020 09:22:41 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 82CA124686; Tue, 28 Jan 2020 14:22:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1580221361; bh=W7xtTQ/Seu3GcN/vKIk0ij30T6WGNN3v6s4L10ALXG0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zaBjQ0TgjnS/DwB0gdZ+zKvJQunwsCZBsXlMCpA3tA87Z2l/6f6FgR88YLF1Yg6tr 6+DLHUjyGx4V+UQO7TL9gzvK+SfKcXJ07TMl+UYbpC0iISk2i9Z6VXpR+O9daoHQj9 9inJO09e8unmFeB87OQhKgU7NhJGRR7fzCyFofJo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Erwan Le Ray , Sasha Levin Subject: [PATCH 4.9 147/271] serial: stm32: fix transmit_chars when tx is stopped Date: Tue, 28 Jan 2020 15:04:56 +0100 Message-Id: <20200128135903.499231268@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200128135852.449088278@linuxfoundation.org> References: <20200128135852.449088278@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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 033856287ca21..ea8b591dd46f4 100644 --- a/drivers/tty/serial/stm32-usart.c +++ b/drivers/tty/serial/stm32-usart.c @@ -293,13 +293,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; } @@ -312,7 +307,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