Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp5149669ybb; Tue, 24 Mar 2020 11:48:51 -0700 (PDT) X-Google-Smtp-Source: ADFU+vvgQdz4FG8Xh38d5CG2NkWhPJX7mB4O1GPIhdOP3zpul+3PXnAbrjeBw0kCLtavBSrX5ICM X-Received: by 2002:aca:aa0a:: with SMTP id t10mr4253440oie.38.1585075731554; Tue, 24 Mar 2020 11:48:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585075731; cv=none; d=google.com; s=arc-20160816; b=DkJlpmlfHS2OMEnh3gK9QoAicnGTwdtUYlU6oLVJfHEU3T9jROeBPmACGrBxdwXil6 REqFeJ/xX0sg1nlSlCJUgKRNpUVwcVv5HAKg/4mlg5ELKao7DlHDt9mjIyuNn6mJ1LzB u5oGiCrWj0/8hYBE77sdJrbcd3tE6sdQfqEmtZ/Dql4Pta15+w39sTGXfqKYlO2NKQ5+ LjHjw2zmQtuhIPSdWCwWYwKSpJtWfq7HQ33n/hB9H64ClMpyVv7hQER0ysoUYYNkdRbN aSKjFU0Ng1HGk2e8FmHXywbFIA/wzGQhiwDiiqBHAzspwTEVmF9ikm36zoR23nJyXEDI ICtw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Ohh+i9NSBEkpWOYwm9D4yhAUjRHzH1Owl/vtdP1oVGo=; b=JV0NQ3ju7nKd1OinnKuwj9dHdLrlUObE47jB5eGabGsEudHH7j+GvNkohbSWN9XkRY gPmwdn9p0rRrsOGRlJBMaoAWYoRjHTUqlksxjZAi9Czku1Xuf0NBE/Fn8lURp4lfoFYQ vkHP8SYgybgP6Ph7W7+wnhorr6BzTHrQ6640jPHcV5if5PbRSVhF289G2uUxCmW+Kqo3 I4NHGXxQLmQTVBL16eF1QgUypWB65rhHroA4x2itGRVv28In8xc7AWW90WYEYdn6IHJs 5aqQ65l5EXx5WXK8cJmK6ljq/xo/WsWA8ONJqpibvUB/QjqZmeYYzIHO4q4suWYk7Z38 OcDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@walle.cc header.s=mail2016061301 header.b=lHRgAxrU; 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 e6si10409374oiy.229.2020.03.24.11.48.37; Tue, 24 Mar 2020 11:48:51 -0700 (PDT) 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=@walle.cc header.s=mail2016061301 header.b=lHRgAxrU; 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 S1727772AbgCXSsS (ORCPT + 99 others); Tue, 24 Mar 2020 14:48:18 -0400 Received: from ssl.serverraum.org ([176.9.125.105]:41419 "EHLO ssl.serverraum.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727365AbgCXSsS (ORCPT ); Tue, 24 Mar 2020 14:48:18 -0400 Received: from apollo.fritz.box (unknown [IPv6:2a02:810c:c200:2e91:6257:18ff:fec4:ca34]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by ssl.serverraum.org (Postfix) with ESMTPSA id 93ECF23061; Tue, 24 Mar 2020 19:48:15 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=walle.cc; s=mail2016061301; t=1585075696; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Ohh+i9NSBEkpWOYwm9D4yhAUjRHzH1Owl/vtdP1oVGo=; b=lHRgAxrUdxFEixCr0cBuxWWLhw6haXXklhQXFFXjrK4MTrEx+f5Fk0PeXoygg/Ld3YqARj FylYBW+9tkVWyn4a5s/AIu6KR+wvU11cRr+g+ACP4Bwiz3KjtsvYrqrFtApjkXZjMcFk8I ZDxouIvh5D788PruLo8pbDGTh9z3lzI= From: Michael Walle To: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Jiri Slaby , Greg Kroah-Hartman , Michael Walle , Leonard Crestez Subject: [PATCH 1/3] tty: serial: fsl_lpuart: move dev_info_once() Date: Tue, 24 Mar 2020 19:47:56 +0100 Message-Id: <20200324184758.8204-1-michael@walle.cc> X-Mailer: git-send-email 2.20.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spamd-Bar: ++++ X-Spam-Level: **** X-Rspamd-Server: web X-Spam-Status: No, score=4.90 X-Spam-Score: 4.90 X-Rspamd-Queue-Id: 93ECF23061 X-Spamd-Result: default: False [4.90 / 15.00]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_MISSING_CHARSET(2.50)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; NEURAL_SPAM(0.00)[0.217]; BROKEN_CONTENT_TYPE(1.50)[]; RCPT_COUNT_FIVE(0.00)[6]; DKIM_SIGNED(0.00)[]; MID_CONTAINS_FROM(1.00)[]; RCVD_COUNT_ZERO(0.00)[0]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:31334, ipnet:2a02:810c:8000::/33, country:DE] Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Don't take the spinlock and use dev_info_once(). This may cause a hang because the console takes this spinlock, too. Just print this info after we've released the lock. Fixes: 159381df1442f ("tty: serial: fsl_lpuart: fix DMA operation when using IOMMU") Reported-by: Leonard Crestez Signed-off-by: Michael Walle --- drivers/tty/serial/fsl_lpuart.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/drivers/tty/serial/fsl_lpuart.c b/drivers/tty/serial/fsl_lpuart.c index 9c6a018b1390..960fc2658f19 100644 --- a/drivers/tty/serial/fsl_lpuart.c +++ b/drivers/tty/serial/fsl_lpuart.c @@ -1517,9 +1517,6 @@ static void lpuart_tx_dma_startup(struct lpuart_port *sport) sport->dma_tx_chan = dma_request_chan(sport->port.dev, "tx"); if (IS_ERR(sport->dma_tx_chan)) { - dev_info_once(sport->port.dev, - "DMA tx channel request failed, operating without tx DMA (%ld)\n", - PTR_ERR(sport->dma_tx_chan)); sport->dma_tx_chan = NULL; goto err; } @@ -1551,9 +1548,6 @@ static void lpuart_rx_dma_startup(struct lpuart_port *sport) sport->dma_rx_chan = dma_request_chan(sport->port.dev, "rx"); if (IS_ERR(sport->dma_rx_chan)) { - dev_info_once(sport->port.dev, - "DMA rx channel request failed, operating without rx DMA (%ld)\n", - PTR_ERR(sport->dma_rx_chan)); sport->dma_rx_chan = NULL; goto err; } @@ -1601,6 +1595,13 @@ static int lpuart_startup(struct uart_port *port) spin_unlock_irqrestore(&sport->port.lock, flags); + if (!sport->dma_rx_chan) + dev_info_once(sport->port.dev, + "DMA rx channel request failed, operating without rx DMA\n"); + if (!sport->dma_tx_chan) + dev_info_once(sport->port.dev, + "DMA tx channel request failed, operating without tx DMA\n"); + return 0; } @@ -1653,13 +1654,20 @@ static int lpuart32_startup(struct uart_port *port) lpuart32_setup_watermark_enable(sport); - lpuart_rx_dma_startup(sport); lpuart_tx_dma_startup(sport); lpuart32_configure(sport); spin_unlock_irqrestore(&sport->port.lock, flags); + + if (!sport->dma_rx_chan) + dev_info_once(sport->port.dev, + "DMA rx channel request failed, operating without rx DMA\n"); + if (!sport->dma_tx_chan) + dev_info_once(sport->port.dev, + "DMA tx channel request failed, operating without tx DMA\n"); + return 0; } -- 2.20.1