Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1364125imm; Wed, 26 Sep 2018 16:50:42 -0700 (PDT) X-Google-Smtp-Source: ACcGV615zirRHPlcArp1Fv30g6M8e/lJoYYsAqLTdp3XJvG7YjQa2L/iqMxSilfMTZ091sYXUEJY X-Received: by 2002:a62:9402:: with SMTP id m2-v6mr8323998pfe.3.1538005842548; Wed, 26 Sep 2018 16:50:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538005842; cv=none; d=google.com; s=arc-20160816; b=ZNwr+AuFhn3NABKM3a77SQvxu2fsXFyy6bNoX2WmicnCnmRMTyqK9dNmE2hyVwYgXC uNb68U8XTtoPu31wpAIXe8jXR/38zhl5Io4ANseahzKOF04e6sGI0sQTiQB0O1LfEbKJ LAN8a2V7q9M2xNnW+s6nmPizn9U8Qb6UmkGvMWOG8vSeUV0rRPvcX8QHtQv/E5DVEFhu gygNiHS8wpQZhKShMI209JLuq/Il0j/tF/T9mM9ULOinGgww91KkVRGrMXb6T7cmYiVG LMpkHp7XijlI5lCrtKinHVq9Is3rbUL0k5GoF9LFgAPi3A4Im9InGNBG9RywjL9z5aIq nOcg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature; bh=eI4NpEJhPXXJCZL/jds2N2Ql80zzYvIwriaBpbUy+Bo=; b=fxchpU3Rm7wjQC9lnRO9bjW4XAgls4X9rb6QRnV8TIFKIhyjtOITLn3swUjZdQQRcw TIUaaO1E5U0FNwFIiBLHblXCbSyFs6l1nTKw6Ji22hYGhVq8f2/hSteW6CpANvgneJJU lFzJbSUXCf/tekHWORkJYrXiZGuhkI7Z/elL+BWf5btb3fqQXlt3eudrPkQr66w0XV9D oGa6wD/nUGDkOd9AppeiBN7qpq6i58UoYvPghSnJ3TKMLKbSf/WQ/k+uaSq00GQ+T2v9 gWxDOMGAlS8DK5rkhyBGhr5ZPxBiGPM2Ax22QMKBQ4sLuXAq+uQUuo/r0biAdhgI8ewM 5Keg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MdqY1i1M; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j8-v6si328151pgp.548.2018.09.26.16.50.27; Wed, 26 Sep 2018 16:50:42 -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=@linaro.org header.s=google header.b=MdqY1i1M; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727077AbeI0GFY (ORCPT + 99 others); Thu, 27 Sep 2018 02:05:24 -0400 Received: from mail-it1-f196.google.com ([209.85.166.196]:40550 "EHLO mail-it1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727014AbeI0GFY (ORCPT ); Thu, 27 Sep 2018 02:05:24 -0400 Received: by mail-it1-f196.google.com with SMTP id h23-v6so5327379ita.5 for ; Wed, 26 Sep 2018 16:50:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=eI4NpEJhPXXJCZL/jds2N2Ql80zzYvIwriaBpbUy+Bo=; b=MdqY1i1MQqPeKPNaweWnRdafni8+L9R23hygP8D1KPJPnVm6qVRUaF8YGSmrApFgV0 PqfFlJkiq3FzXXYZVbNsoyXzRngjc+6qS8rYSplDUMDadyATZy6FE9pIvX4elDjtvv/z dTnAix4WL8v+IQZ6hWEd6lxQGza8BtVDZjJFE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=eI4NpEJhPXXJCZL/jds2N2Ql80zzYvIwriaBpbUy+Bo=; b=BmF/OW9IvwVL+aSdmV3VwQCjMzghDHqVPRUwIfGS0hOTZDm1yPlVci+bPkVM4D/XX8 e0+fMT1Fb0/6YCPPMiYCLL6MXkTipM/wWMeaaLSh/U/UfDyPxdpqRu6zLVLU+DFXpJsH H7spYWLB/Yh7k4YcOY+CfWqWl8EbOFV/AvGo1S2WYb4VJccLbhT+FhMwP0xDjmi3QlVm i24PCsYQ0LBKRVwUEIhIG/dLX1P5+5SktXSsq4K0+7gaKrLys8/Kx74Ujpg03RU265Qw xrY6xpDtCflff2/e2w+HZfB8d6gb9N2ZhxmNBAq3ZQXteZ/Kb9cTf5G+5xseX5cNUDfV gBBA== X-Gm-Message-State: ABuFfoiEyPtxxMSnIC+9ivQjIwd48JPQtnjO35glu75/T5f0YE8obbC/ lnoFaU/4mm6YyyA2Ll6x2D008lI7KrG+koCVOicSGA== X-Received: by 2002:a02:6a6f:: with SMTP id m47-v6mr7998648jaf.121.1538005799701; Wed, 26 Sep 2018 16:49:59 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a02:6a18:0:0:0:0:0 with HTTP; Wed, 26 Sep 2018 16:49:19 -0700 (PDT) In-Reply-To: <1537523181-14578-2-git-send-email-ludovic.Barre@st.com> References: <1537523181-14578-1-git-send-email-ludovic.Barre@st.com> <1537523181-14578-2-git-send-email-ludovic.Barre@st.com> From: Ulf Hansson Date: Thu, 27 Sep 2018 01:49:19 +0200 Message-ID: Subject: Re: [PATCH V2 01/27] mmc: mmci: internalize dma map/unmap into mmci dma functions To: Ludovic Barre Cc: Rob Herring , Maxime Coquelin , Alexandre Torgue , Benjamin Gaignard , Gerald Baeza , Loic Pallardy , Linux ARM , Linux Kernel Mailing List , DTML , "linux-mmc@vger.kernel.org" , linux-stm32@st-md-mailman.stormreply.com Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 21 September 2018 at 11:45, Ludovic Barre wrote: > From: Ludovic Barre > > This patch internalizes the management of dma map/unmap into > mmci dma interfaces. This allows to simplify and prepare the next dma > callbacks for mmci host ops. > mmci_dma_unmap was called in mmci_data_irq & mmci_cmd_irq functions > and can be integrated in mmci_dma_data_error. > > Signed-off-by: Ludovic Barre Applied for next, thanks! Kind regards Uffe > --- > drivers/mmc/host/mmci.c | 40 +++++++++++++++++----------------------- > 1 file changed, 17 insertions(+), 23 deletions(-) > > diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c > index 1841d250..bf0bb07 100644 > --- a/drivers/mmc/host/mmci.c > +++ b/drivers/mmc/host/mmci.c > @@ -482,16 +482,6 @@ static inline void mmci_dma_release(struct mmci_host *host) > host->dma_rx_channel = host->dma_tx_channel = NULL; > } > > -static void mmci_dma_data_error(struct mmci_host *host) > -{ > - dev_err(mmc_dev(host->mmc), "error during DMA transfer!\n"); > - dmaengine_terminate_all(host->dma_current); > - host->dma_in_progress = false; > - host->dma_current = NULL; > - host->dma_desc_current = NULL; > - host->data->host_cookie = 0; > -} > - > static void mmci_dma_unmap(struct mmci_host *host, struct mmc_data *data) > { > struct dma_chan *chan; > @@ -505,6 +495,18 @@ static void mmci_dma_unmap(struct mmci_host *host, struct mmc_data *data) > mmc_get_dma_dir(data)); > } > > +static void mmci_dma_data_error(struct mmci_host *host) > +{ > + dev_err(mmc_dev(host->mmc), "error during DMA transfer!\n"); > + dmaengine_terminate_all(host->dma_current); > + host->dma_in_progress = false; > + host->dma_current = NULL; > + host->dma_desc_current = NULL; > + host->data->host_cookie = 0; > + > + mmci_dma_unmap(host, host->data); > +} > + > static void mmci_dma_finalize(struct mmci_host *host, struct mmc_data *data) > { > u32 status; > @@ -528,10 +530,9 @@ static void mmci_dma_finalize(struct mmci_host *host, struct mmc_data *data) > mmci_dma_data_error(host); > if (!data->error) > data->error = -EIO; > - } > - > - if (!data->host_cookie) > + } else if (!data->host_cookie) { > mmci_dma_unmap(host, data); > + } > > /* > * Use of DMA with scatter-gather is impossible. > @@ -742,10 +743,6 @@ static inline void mmci_dma_release(struct mmci_host *host) > { > } > > -static inline void mmci_dma_unmap(struct mmci_host *host, struct mmc_data *data) > -{ > -} > - > static inline void mmci_dma_finalize(struct mmci_host *host, > struct mmc_data *data) > { > @@ -906,10 +903,8 @@ mmci_data_irq(struct mmci_host *host, struct mmc_data *data, > u32 remain, success; > > /* Terminate the DMA transfer */ > - if (dma_inprogress(host)) { > + if (dma_inprogress(host)) > mmci_dma_data_error(host); > - mmci_dma_unmap(host, data); > - } > > /* > * Calculate how far we are into the transfer. Note that > @@ -1055,10 +1050,9 @@ 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)) { > + if (dma_inprogress(host)) > mmci_dma_data_error(host); > - mmci_dma_unmap(host, host->data); > - } > + > mmci_stop_data(host); > } > mmci_request_end(host, host->mrq); > -- > 2.7.4 >