From patchwork Fri Oct 21 17:35:35 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 9389813 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D3000607D0 for ; Fri, 21 Oct 2016 17:35:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C6AAF29418 for ; Fri, 21 Oct 2016 17:35:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BA8BB2A21D; Fri, 21 Oct 2016 17:35:43 +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=-6.9 required=2.0 tests=BAYES_00,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 3C8F029418 for ; Fri, 21 Oct 2016 17:35:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934096AbcJURfm (ORCPT ); Fri, 21 Oct 2016 13:35:42 -0400 Received: from mga04.intel.com ([192.55.52.120]:26031 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932965AbcJURfm (ORCPT ); Fri, 21 Oct 2016 13:35:42 -0400 Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga104.fm.intel.com with ESMTP; 21 Oct 2016 10:35:41 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,377,1473145200"; d="scan'208";a="1057246622" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 21 Oct 2016 10:35:41 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id CCF4B398; Fri, 21 Oct 2016 20:35:36 +0300 (EEST) From: Andy Shevchenko To: dmaengine@vger.kernel.org, vinod.koul@intel.com Cc: Andy Shevchenko Subject: [PATCH v1 10/10] dmaengine: zynqmp_dma: use sg_nents_for_dma() helper Date: Fri, 21 Oct 2016 20:35:35 +0300 Message-Id: <20161021173535.100245-10-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20161021173535.100245-1-andriy.shevchenko@linux.intel.com> References: <20161021173535.100245-1-andriy.shevchenko@linux.intel.com> Sender: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Instead of open coded variant let's use recently introduced helper. Signed-off-by: Andy Shevchenko --- drivers/dma/xilinx/zynqmp_dma.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/dma/xilinx/zynqmp_dma.c b/drivers/dma/xilinx/zynqmp_dma.c index 6d221e5..3fef044 100644 --- a/drivers/dma/xilinx/zynqmp_dma.c +++ b/drivers/dma/xilinx/zynqmp_dma.c @@ -853,12 +853,9 @@ static struct dma_async_tx_descriptor *zynqmp_dma_prep_sg( void *desc = NULL, *prev = NULL; size_t len, dst_avail, src_avail; dma_addr_t dma_dst, dma_src; - u32 desc_cnt = 0, i; - struct scatterlist *sg; + u32 desc_cnt; - for_each_sg(src_sg, sg, src_sg_len, i) - desc_cnt += DIV_ROUND_UP(sg_dma_len(sg), - ZYNQMP_DMA_MAX_TRANS_LEN); + desc_cnt = sg_nents_for_dma(src_sg, src_sg_len, ZYNQMP_DMA_MAX_TRANS_LEN); spin_lock_bh(&chan->lock); if (desc_cnt > chan->desc_free_cnt) {