Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp2705947pxv; Sun, 11 Jul 2021 23:18:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzBc3QMIrciKrnzDoCMBoSKUClD4pP5f/n+rzuHXID2u+M2tcPxJscQo7fpEH5ppzmQ7AoH X-Received: by 2002:a05:6e02:5ad:: with SMTP id k13mr165103ils.284.1626070727452; Sun, 11 Jul 2021 23:18:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626070727; cv=none; d=google.com; s=arc-20160816; b=mJBZNRi8BXnBSzzaN0OV/hOwN1kX+DbiDtihYIQjy56PFLd+yxjcBQ32y0HTQCN0ml oCQHXvLO+Rm+Lenz5C9OVCLAq9QuAaYB93BMMCbuX9ao4cwIRHLUdT5uXJgeaEFpuROS QSOPdPPg+X4K7RWOtC43zym58x+bm28PLkOpIVd6CRQr6z2P6CMNtlLKStGgAGGsPjc2 NDQ0i+d7tgdWFWvN1dcEFAWLfd1p2/pZrBQygDsqArg6LiqGBegkNUpK2hFeXf0RNVrl 04JlbygsdqV+O8JH6tCj81Cd3TZAeN8iSzRUGqgKFnTBjOIv3HAtAIZyEdabk9xPP7ab 2vkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=e1zoV4EZ7lJpGrFfQTpqq0KAGFWu1Dl+xauUs9atDZg=; b=u3KCk3z6vQa3DzHf7CXST13XAUoBEyVpksrqyArFncYozOSycuP85/jz/nNX+Vrzvl 4XPuLbrnSF7wC0MzN4VANcbkXBs9/nteGaKSvd7JCM3wHwU07FQ3yA0NQUkNYrcPcQ5x 67/tVo6q4U6a5ZSlMASE1kUzwujDAleYOGosBihKdU70xoReIcqfVIiYPVhXuq13G6dl ib15KDarAOCh72SARtsIa1PayygPRRwMhES2nJnIVNvmRQZOpXIfsXDm1y9Qwz4vAtE8 aJKUMboFFIgp8PHg4nEqEDRzLxxCUT0exEtnQNNivF1+t4x+Elos1LqIdMqnRD70GLMw +MZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Fbom3IPZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x1si12781109jan.58.2021.07.11.23.18.36; Sun, 11 Jul 2021 23:18:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Fbom3IPZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233357AbhGLGTY (ORCPT + 99 others); Mon, 12 Jul 2021 02:19:24 -0400 Received: from mail.kernel.org ([198.145.29.99]:37710 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233817AbhGLGTC (ORCPT ); Mon, 12 Jul 2021 02:19:02 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id C783B610E6; Mon, 12 Jul 2021 06:16:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626070574; bh=ynYfoDlUb7M8ytx8991juFSHoDtobq7SQBQ/S5RtNgM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Fbom3IPZ6ptEStRq31GdY0pP0+pMcyQ880MrkR5jbUwxV9s9+lhaUAPH5db1lZ458 ZUWPZnsvexeOCYL4yvR5U02nygm1wy7+iOPw1/K4ZesOnaL3BlZtEYONJQX6XgPVYg wr9T31GTDA6INPaXMOHo8q2W3LZkA7LfUSxoresw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yoshihiro Shimoda Subject: [PATCH 5.4 048/348] serial: sh-sci: Stop dmaengine transfer in sci_stop_tx() Date: Mon, 12 Jul 2021 08:07:12 +0200 Message-Id: <20210712060707.985777823@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210712060659.886176320@linuxfoundation.org> References: <20210712060659.886176320@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Yoshihiro Shimoda commit 08a84410a04f05c7c1b8e833f552416d8eb9f6fe upstream. Stop dmaengine transfer in sci_stop_tx(). Otherwise, the following message is possible output when system enters suspend and while transferring data, because clearing TIE bit in SCSCR is not able to stop any dmaengine transfer. sh-sci e6550000.serial: ttySC1: Unable to drain transmitter Note that this driver has already used some #ifdef in the .c file so that this patch also uses #ifdef to fix the issue. Otherwise, build errors happens if the CONFIG_SERIAL_SH_SCI_DMA is disabled. Fixes: 73a19e4c0301 ("serial: sh-sci: Add DMA support.") Cc: # v4.9+ Signed-off-by: Yoshihiro Shimoda Link: https://lore.kernel.org/r/20210610110806.277932-1-yoshihiro.shimoda.uh@renesas.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Greg Kroah-Hartman --- drivers/tty/serial/sh-sci.c | 8 ++++++++ 1 file changed, 8 insertions(+) --- a/drivers/tty/serial/sh-sci.c +++ b/drivers/tty/serial/sh-sci.c @@ -613,6 +613,14 @@ static void sci_stop_tx(struct uart_port ctrl &= ~SCSCR_TIE; serial_port_out(port, SCSCR, ctrl); + +#ifdef CONFIG_SERIAL_SH_SCI_DMA + if (to_sci_port(port)->chan_tx && + !dma_submit_error(to_sci_port(port)->cookie_tx)) { + dmaengine_terminate_async(to_sci_port(port)->chan_tx); + to_sci_port(port)->cookie_tx = -EINVAL; + } +#endif } static void sci_start_rx(struct uart_port *port)