From patchwork Fri Jan 24 09:29:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 232959 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=-9.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, 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 B62A1C32771 for ; Fri, 24 Jan 2020 11:22:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8DC4220718 for ; Fri, 24 Jan 2020 11:22:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579864936; bh=UFgbHMhDM2XKV3T2FJem1KMeOh7Pql6hpufPWFWgcDs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=YpAczse+ZlwqoQ4RR+5uh8PdMdoPX3VdA4EUTNStcFoIamOLskuQ9WtN4wGuNzf3S 1gE0KC3gYhkDjNZfFBF7hBc+jYvSsQoHbrWyPj7UTOhdIp2YU6u092AW0B+peyGvkS 18+Bsj/nm21mvcECKd/fkkllz3N8Es+x4ABjMIkU= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390804AbgAXLWL (ORCPT ); Fri, 24 Jan 2020 06:22:11 -0500 Received: from mail.kernel.org ([198.145.29.99]:33216 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391172AbgAXLWL (ORCPT ); Fri, 24 Jan 2020 06:22:11 -0500 Received: from localhost (ip-213-127-102-57.ip.prioritytelecom.net [213.127.102.57]) (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 ABF892075D; Fri, 24 Jan 2020 11:22:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579864930; bh=UFgbHMhDM2XKV3T2FJem1KMeOh7Pql6hpufPWFWgcDs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0GZLHAT3LueQJQRdw0GZXkTyKl3ZC368jGhe7UhdkgyZ/vdCVWrLTwq6tUwUv3zRD /phvbRp62ic6ke8nVbMywrK5F97bxop9OnH4cbJpF/ufE42XWpYhGpNJFAc0tnxfXW 4fbfDy9edV+tiD+w3P7GJBW+gm909+fUd4rn8B4c= 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.19 391/639] serial: stm32: fix transmit_chars when tx is stopped Date: Fri, 24 Jan 2020 10:29:21 +0100 Message-Id: <20200124093135.931147394@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200124093047.008739095@linuxfoundation.org> References: <20200124093047.008739095@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@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 0a7953e5ce47a..2e7757d5e5d83 100644 --- a/drivers/tty/serial/stm32-usart.c +++ b/drivers/tty/serial/stm32-usart.c @@ -420,13 +420,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; } @@ -439,7 +434,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)