From patchwork Sun Nov 11 13:45:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Wahren X-Patchwork-Id: 10677629 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 237FB14E2 for ; Sun, 11 Nov 2018 13:46:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 10CAF2A7FC for ; Sun, 11 Nov 2018 13:46:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EE4F12A805; Sun, 11 Nov 2018 13:46:29 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9A5FB2A7FC for ; Sun, 11 Nov 2018 13:46:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728154AbeKKXfG (ORCPT ); Sun, 11 Nov 2018 18:35:06 -0500 Received: from mout.kundenserver.de ([212.227.126.134]:41049 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728118AbeKKXfF (ORCPT ); Sun, 11 Nov 2018 18:35:05 -0500 Received: from localhost.localdomain ([37.4.249.153]) by mrelayeu.kundenserver.de (mreue012 [212.227.15.167]) with ESMTPSA (Nemesis) id 1MTw02-1fw1TO0NOs-00R0I3; Sun, 11 Nov 2018 14:46:08 +0100 From: Stefan Wahren To: Eric Anholt , Florian Fainelli , Ulf Hansson Cc: Phil Elwell , Michal Suchanek , linux-rpi-kernel@lists.infradead.org, linux-mmc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Stefan Wahren Subject: [PATCH 6/7] mmc: bcm2835: Refactor dma_map_sg handling Date: Sun, 11 Nov 2018 14:45:29 +0100 Message-Id: <1541943930-23873-7-git-send-email-stefan.wahren@i2se.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1541943930-23873-1-git-send-email-stefan.wahren@i2se.com> References: <1541943930-23873-1-git-send-email-stefan.wahren@i2se.com> X-Provags-ID: V03:K1:d3Tlag//fzN+r6VUXOfa/hYFl1CzjBhy4W+IJDTV99QGOCq9sMk +Qy2CwxBqWlL+khwA1mlX7upfhWqoNz1KRlqVlahzayY7b+C1hgpM8U47o7e86it2OAZDHu 4ixUwjsT2ApeKwTWodi88mSst/FERzHGCyzZ3c+5K2TvyTVaj7jhcdWoPEANdL5OPi0O0Nn i52hXDv6C5xn4i6/6/qnw== X-UI-Out-Filterresults: notjunk:1;V01:K0:90h34Am4Il4=:w3fhkSkiyYcV5tdMFDL652 pvAbOsIsX2+t7VG0KbHvis4eVv9RV4UX423+yKEz/BxwCG/liqf3utL2ZN0g8ATdEIPpJJYjI spX6YKPtGPo79GH8f13sneR0v3qhDQRXMmK7ql3hGIxeRdzQyxGzwx/fz6Nn5xfdTYD5miKaY xK5OUsuViw+i6PXXZjhqpbSF7S+8kJ02/LUf6P9NNey21J5Xm60lQpkovIEGC5up0oUpqpU46 DGwn+EGc5nU8sdF49fNSKN99+50rhuN2ztZBrYLB+XUxzem5M2JIlQbC9sCJw4oRYhGdBLCsN lbwzYaewDCTOXmC1jk9MczYAkK534H1Hzh90U987Y/fDyeTbHDb5PXWwOuYer9yaKPZwY286f elYd7eMal3oWNyJLRQ9GdL7Ay6JHPRgobndprOCVxwL/34GyVJSmtio4iCo0q1aH+vn3w/n7+ 3Ua9XtBuCrfM7cf66e1ohKvoE+2HAjuiSog7IBmpV2/IQPHusZLWMyl13nysUSav29NM61SmN D7nt5y7mJFOB3WziLwFHxxqCOAlk0+6gMGbz7LYqdy7yNS+cgi/euWNgqRrjvJGdjWj5u8aCb B6X21EvGLcrCA23tNzx7lp6eiBVeD/M8GEdOcEwtSM0OEg7ojpxVx6nhtCW0L8sI4oxgGRXOj uobE5+rEAwmtot+uZnthEHSfuTNZRc7HtB8JgNxR4g2IkXb8rHQlClLSKC7WD6oenskLP3BJt fab8gHURQTes6cekUZzWEjhOkKLMxj3rA78GLzYkbPE+rNC2IkSXW4ZTlC0Sh477d1F3DCh/m lesq6tm9XfL8wMuBfr/wDrsu5gANQ== Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP There are two variables len within bcm2835_prepare_dma. So rename the result of dma_map_sg to sg_len. While we are at this add a bail out to simplify the following change. Signed-off-by: Stefan Wahren --- drivers/mmc/host/bcm2835.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/drivers/mmc/host/bcm2835.c b/drivers/mmc/host/bcm2835.c index 2c7589f..c42bdaa 100644 --- a/drivers/mmc/host/bcm2835.c +++ b/drivers/mmc/host/bcm2835.c @@ -464,7 +464,7 @@ static void bcm2835_transfer_pio(struct bcm2835_host *host) static void bcm2835_prepare_dma(struct bcm2835_host *host, struct mmc_data *data) { - int len, dir_data, dir_slave; + int sg_len, dir_data, dir_slave; struct dma_async_tx_descriptor *desc = NULL; struct dma_chan *dma_chan; @@ -510,15 +510,13 @@ void bcm2835_prepare_dma(struct bcm2835_host *host, struct mmc_data *data) &host->dma_cfg_rx : &host->dma_cfg_tx); - len = dma_map_sg(dma_chan->device->dev, data->sg, data->sg_len, - dir_data); + sg_len = dma_map_sg(dma_chan->device->dev, data->sg, data->sg_len, + dir_data); + if (!sg_len) + return; - if (len > 0) { - desc = dmaengine_prep_slave_sg(dma_chan, data->sg, - len, dir_slave, - DMA_PREP_INTERRUPT | - DMA_CTRL_ACK); - } + desc = dmaengine_prep_slave_sg(dma_chan, data->sg, sg_len, dir_slave, + DMA_PREP_INTERRUPT | DMA_CTRL_ACK); if (desc) { desc->callback = bcm2835_dma_complete;