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 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0F471C4345F for ; Thu, 2 May 2024 09:14:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:References :In-Reply-To:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=oXuozhONH5uK0yNreLQImXCZuZuZ0ZsXqRTA/s9LT0I=; b=FMB2HhguMtFgDK mVnD/Yn5YOo8jGDmjGwztCq7raJo0JqPZ4+8+9qwYvg8uh+ECl/sOdxBoV2FsaBAKpcCO/ZE+swlT lYhZySDXSO1mB6ciiTsNJ8TDLWXGZbItTgEmlkp5pAa4OHLMvIJcBlJcGtfFTj4lDtBUjcxTDREru PLkdsr5XeDlkURL2KH3dcynbvNeZh/jJ2Qu+dTLeDcee5Un6q8TBxhV3te+sIp9pVf9o2MDQ2JpSI OViBOL3sOS6ZeRFyOcA3gpoQjtVQC+b7yYEAXH2ytTq/1BS55ywZ/hydHZyufyCe+DBY4wXC8SzAO dXyxiamahRorzlz++ryg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s2SWU-0000000C6wi-3Jwo; Thu, 02 May 2024 09:14:38 +0000 Received: from www530.your-server.de ([188.40.30.78]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s2SWR-0000000C6vL-2GBv for linux-arm-kernel@lists.infradead.org; Thu, 02 May 2024 09:14:37 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=geanix.com; s=default2211; h=Content-Type:MIME-Version:Message-ID:Date:References: In-Reply-To:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID; bh=/NoG3XHUWmdniOQeHszLWB0bpcAI3VvsLE8CKkJdHFk=; b=LkfbHs/kiemciZ+KBclNVjo+5i owEwK121ksZa5gsrjbj+gmNjRh9unNi3UKTF5YTfhpNvWuqnRpdOHMBzOZzaNWX+Ah90WZ03lTsxI djRFv661Sm9QpE7pzz8PcEr++Zu//MugKgZtgrg+09lyvCcHE+2Mle32eBrLCBUWXwr8ZjgNiN1fc 5Yt2BbgYY1skbfgtsRUB5WoOHSSkDAmNtD1q2rnhmVJP9VoFdO1IEhHF81WGDY2gRIN1gAtizuSXA UcadbFoxtBJ35l32msLOTCok72N7n+XzOfEQWx23SkiN4As2dRzrycPcqdlyPmXXSKrlSEY8k6qMs ihfcVQfg==; Received: from sslproxy02.your-server.de ([78.47.166.47]) by www530.your-server.de with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1s2SWJ-000KDR-JC; Thu, 02 May 2024 11:14:27 +0200 Received: from [185.17.218.86] (helo=localhost) by sslproxy02.your-server.de with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1s2SWI-0003XL-2e; Thu, 02 May 2024 11:14:26 +0200 From: Esben Haabendal To: Greg Kroah-Hartman Cc: Marc Kleine-Budde , Sergey Organov , Jiri Slaby , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH v3] serial: imx: Introduce timeout when waiting on transmitter empty In-Reply-To: <919647898c337a46604edcabaf13d42d80c0915d.1712837613.git.esben@geanix.com> (Esben Haabendal's message of "Thu, 11 Apr 2024 14:19:23 +0200") References: <919647898c337a46604edcabaf13d42d80c0915d.1712837613.git.esben@geanix.com> Date: Thu, 02 May 2024 11:14:26 +0200 Message-ID: <87sez060el.fsf@geanix.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 X-Authenticated-Sender: esben@geanix.com X-Virus-Scanned: Clear (ClamAV 0.103.10/27263/Thu May 2 10:23:13 2024) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240502_021435_901368_19E7CA73 X-CRM114-Status: GOOD ( 18.92 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Esben Haabendal writes: > By waiting at most 1 second for USR2_TXDC to be set, we avoid a potential > deadlock. > > In case of the timeout, there is not much we can do, so we simply ignore > the transmitter state and optimistically try to continue. > > Signed-off-by: Esben Haabendal > Acked-by: Marc Kleine-Budde > --- > > v2: > - Fixed commit message typo > - Remove reference to patch series it originated from. This is a > stand-alone patch > > v3: > - Moved this version information into the correct patch section Anything more needed in order to get this merged? /Esben > > drivers/tty/serial/imx.c | 7 ++++--- > 1 file changed, 4 insertions(+), 3 deletions(-) > > diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c > index e14813250616..09c1678ddfd4 100644 > --- a/drivers/tty/serial/imx.c > +++ b/drivers/tty/serial/imx.c > @@ -26,6 +26,7 @@ > #include > #include > #include > +#include > #include > > #include > @@ -2010,7 +2011,7 @@ imx_uart_console_write(struct console *co, const char *s, unsigned int count) > struct imx_port *sport = imx_uart_ports[co->index]; > struct imx_port_ucrs old_ucr; > unsigned long flags; > - unsigned int ucr1; > + unsigned int ucr1, usr2; > int locked = 1; > > if (sport->port.sysrq) > @@ -2041,8 +2042,8 @@ imx_uart_console_write(struct console *co, const char *s, unsigned int count) > * Finally, wait for transmitter to become empty > * and restore UCR1/2/3 > */ > - while (!(imx_uart_readl(sport, USR2) & USR2_TXDC)); > - > + read_poll_timeout_atomic(imx_uart_readl, usr2, usr2 & USR2_TXDC, > + 0, USEC_PER_SEC, false, sport, USR2); > imx_uart_ucrs_restore(sport, &old_ucr); > > if (locked) _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel