Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp5071363imm; Tue, 18 Sep 2018 04:00:27 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYcEhZJJFjxCrahP0UVcIRVX71r5dyzowzPLG+u1jFgVhk4+kLfkwujKsw2kUrauDl+7Trj X-Received: by 2002:a62:4808:: with SMTP id v8-v6mr30538186pfa.89.1537268427070; Tue, 18 Sep 2018 04:00:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537268427; cv=none; d=google.com; s=arc-20160816; b=bKI0t7yTwFTx1u3irfhqnqoY4H2H0o1CuJCH/xCaNTamVsqriPU2jDQrxbWBYvoQUl iIOgj67aHLSbGMRhWl8er/LhJsUcoy6qF+a+s4G7TiUwxWIprTCXmlkRaEGAkfxn13N4 32EeHP0oQg4lq4pLIsjiNRNOZu24XaTCJxitPMT9F6Dgizvuu53qCQHcoIbt/w1TVA+G RcF7gPZiaAU4nX0l19rvA4amE1UkExgfHYvQpu1ih7z2N3jHEP28LxvjEOUtWbfc2jIi NLch6IJWS/lgXeS7+iWMjElPtGNcaWTbEy26XKASJimlf5IpsVHX4RTeZQ3WHt/7pr3s K32g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=eEkRzTLaBbuZc96MBFtDTibVNs420QzwJT8SOtpJEts=; b=KlzpFYvVMbltb2OZnfrIOu1YF68yT0aN5/bZ3fAS56KtC0SMHLDc4Tl2Y8OCJPyEjj kW18zC/f8apHehI1CsSftWCo9ZCL910SXJYk8F6Mg07Pc26zTV+/mDED9KC5CFeN4SFD byAiMNWJWU0s6dBlqVNx+Aagh74lw4m252eWFG4MGm+ES1PtTkQKh3jreu9uM+QVUim/ 1Almh9V/zHJmVMrRanJdKqiINy1oIifTZSJWtCdCAX23IUJYo+5a8f3Uj5F1ba4cQr09 eV5rYwJFrbYqh7ec0H96beJVm7rlwCBzCwQ8bMwv05O/k/3MkcFcFSkAhGGtoLDxOKAB ETeA== ARC-Authentication-Results: i=1; mx.google.com; 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 j3-v6si17941060plt.442.2018.09.18.04.00.12; Tue, 18 Sep 2018 04:00:27 -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; 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 S1729462AbeIRQ2j (ORCPT + 99 others); Tue, 18 Sep 2018 12:28:39 -0400 Received: from mx08-00178001.pphosted.com ([91.207.212.93]:55493 "EHLO mx07-00178001.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726786AbeIRQ2j (ORCPT ); Tue, 18 Sep 2018 12:28:39 -0400 Received: from pps.filterd (m0046661.ppops.net [127.0.0.1]) by mx08-.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id w8IAsLKq004527; Tue, 18 Sep 2018 12:56:12 +0200 Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx08-00178001.pphosted.com with ESMTP id 2mgryf0w53-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Tue, 18 Sep 2018 12:56:12 +0200 Received: from zeta.dmz-eu.st.com (zeta.dmz-eu.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id A0F3F3A; Tue, 18 Sep 2018 10:56:11 +0000 (GMT) Received: from Webmail-eu.st.com (Safex1hubcas21.st.com [10.75.90.44]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 834512A9D; Tue, 18 Sep 2018 10:56:11 +0000 (GMT) Received: from SAFEX1HUBCAS22.st.com (10.75.90.93) by SAFEX1HUBCAS21.st.com (10.75.90.44) with Microsoft SMTP Server (TLS) id 14.3.361.1; Tue, 18 Sep 2018 12:56:11 +0200 Received: from lmecxl0923.lme.st.com (10.48.0.237) by Webmail-ga.st.com (10.75.90.48) with Microsoft SMTP Server (TLS) id 14.3.361.1; Tue, 18 Sep 2018 12:56:10 +0200 From: Ludovic Barre To: Ulf Hansson , Rob Herring CC: Maxime Coquelin , Alexandre Torgue , , Gerald Baeza , Loic Pallardy , , , , , , Ludovic Barre Subject: [PATCH V2 02/27] mmc: mmci: internalize dma_inprogress into mmci dma functions Date: Tue, 18 Sep 2018 12:55:19 +0200 Message-ID: <1537268144-21152-3-git-send-email-ludovic.Barre@st.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1537268144-21152-1-git-send-email-ludovic.Barre@st.com> References: <1537268144-21152-1-git-send-email-ludovic.Barre@st.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.48.0.237] X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-09-18_04:,, signatures=0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ludovic Barre This patch internalizes the dma_inprogress into mmci dma interfaces. This allows to simplify and prepare the next dma callbacks for mmci host ops. __dma_inprogress is called in mmci_dma_data_error and mmci_dma_finalize. Signed-off-by: Ludovic Barre --- drivers/mmc/host/mmci.c | 16 ++++++++++------ drivers/mmc/host/mmci.h | 4 +--- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c index bf0bb07..7d22cb9 100644 --- a/drivers/mmc/host/mmci.c +++ b/drivers/mmc/host/mmci.c @@ -497,6 +497,9 @@ static void mmci_dma_unmap(struct mmci_host *host, struct mmc_data *data) static void mmci_dma_data_error(struct mmci_host *host) { + if (!__dma_inprogress(host)) + return; + dev_err(mmc_dev(host->mmc), "error during DMA transfer!\n"); dmaengine_terminate_all(host->dma_current); host->dma_in_progress = false; @@ -512,6 +515,9 @@ static void mmci_dma_finalize(struct mmci_host *host, struct mmc_data *data) u32 status; int i; + if (!__dma_inprogress(dmae)) + return; + /* Wait up to 1ms for the DMA to complete */ for (i = 0; ; i++) { status = readl(host->base + MMCISTATUS); @@ -903,8 +909,7 @@ mmci_data_irq(struct mmci_host *host, struct mmc_data *data, u32 remain, success; /* Terminate the DMA transfer */ - if (dma_inprogress(host)) - mmci_dma_data_error(host); + mmci_dma_data_error(host); /* * Calculate how far we are into the transfer. Note that @@ -942,8 +947,8 @@ mmci_data_irq(struct mmci_host *host, struct mmc_data *data, dev_err(mmc_dev(host->mmc), "stray MCI_DATABLOCKEND interrupt\n"); if (status & MCI_DATAEND || data->error) { - if (dma_inprogress(host)) - mmci_dma_finalize(host, data); + mmci_dma_finalize(host, data); + mmci_stop_data(host); if (!data->error) @@ -1050,8 +1055,7 @@ mmci_cmd_irq(struct mmci_host *host, struct mmc_command *cmd, if ((!sbc && !cmd->data) || cmd->error) { if (host->data) { /* Terminate the DMA transfer */ - if (dma_inprogress(host)) - mmci_dma_data_error(host); + mmci_dma_data_error(host); mmci_stop_data(host); } diff --git a/drivers/mmc/host/mmci.h b/drivers/mmc/host/mmci.h index 696a066..f1ec066 100644 --- a/drivers/mmc/host/mmci.h +++ b/drivers/mmc/host/mmci.h @@ -332,9 +332,7 @@ struct mmci_host { struct mmci_host_next next_data; bool dma_in_progress; -#define dma_inprogress(host) ((host)->dma_in_progress) -#else -#define dma_inprogress(host) (0) +#define __dma_inprogress(host) ((host)->dma_in_progress) #endif }; -- 2.7.4