Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp682760imm; Fri, 11 May 2018 04:54:05 -0700 (PDT) X-Google-Smtp-Source: AB8JxZq6TGMFOjXr5TuBdHLyo5ck11idPbPP3RS/wLYqpHKRyvc1X1g36GTwyLDaNWY+Xkp/ECNp X-Received: by 2002:a62:d605:: with SMTP id r5-v6mr5297638pfg.8.1526039644975; Fri, 11 May 2018 04:54:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526039644; cv=none; d=google.com; s=arc-20160816; b=H2quDR/qMuJZs6zFLsf4dhEJFIj+N+P8y3QDVucUqNXnPZNYbPhUvobvc0h6g8i25E VjI+Bz8FoAeu41cLjl+VJNwp/5NenbNGzzo5cnU2TxqLEzpW2V59FJUQ1fa2cMxVBWF4 RAUMn5jO6sAyntd+9u2nK8U4g94AoUIq+0s3YsrzrmQEj9NpPv7M4hRlzuSAgiWD5sjg ZdcwEABK6Szn1ptzwoxQKImzd6Qi/ZMhpz7KLQ/w18XswXg9q+5zatRf+V0iGeEwy9lc qjwhhlVxqrBfofJfzc/vO+WjQCPiAAJ1LC1eJQjAAddk7aFw9PwGilxYaUDmPA6QbNnF dzrw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=S2WO4JHredU/xVdOf7nLebGIquXmv+pdBd+AC3uarq8=; b=Qm0galrtcPvY+3dalnf558FuQX5XdtHFd+1/bd1ZCeSbCdU0eQjSB5RaxKnmOCeARe PV09sK43Tzf5FgNggBvL5arMZ22F6kDzEV0T0fz123xQpuCLQAtZiybgNuZpNl+rNREI akp+kyp3oGuF62DaYPft+iiomTtuAomRUsabRDM7YzFjPeYur95fDXGgoN/sAMJISqNt 89dq+cArl/qmmlmWN0yvlZLH3PmaZkUzmrol1m1bqlKdES49IaQ0NQvi52+/HfHIpFsp Z7vdqF4hc6QCIEfJrBWtCI8jk4upoEbfbDCwZNOAHt1f+eDdGMo6guN7EKgnqzJQIQLC p4Tg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=eqrKCZ6+; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j84-v6si3112624pfk.203.2018.05.11.04.53.51; Fri, 11 May 2018 04:54:04 -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=@kernel.org header.s=default header.b=eqrKCZ6+; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753017AbeEKLxM (ORCPT + 99 others); Fri, 11 May 2018 07:53:12 -0400 Received: from mail.kernel.org ([198.145.29.99]:45564 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752578AbeEKLxK (ORCPT ); Fri, 11 May 2018 07:53:10 -0400 Received: from localhost (unknown [106.201.104.21]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 9689A21746; Fri, 11 May 2018 11:53:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1526039590; bh=WOlISs496bLInMaAa+q3R5kuWudLzic8sSUr1bP/JsM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=eqrKCZ6+WZSvXxf14zZJRNaGEl2Us4EPh3aMjO7NzVgBSTzfmltjYiNZZZx9s2fgq xTSbdU7anFCB+/1zHy7F101IueOZFhY7REkoF1lJjax1DnJljCH0ZZzItD36JIZmB7 ruso9AiDeSCRccVMo7y9QMWiCEw5Dc8J4s5S3D+o= Date: Fri, 11 May 2018 17:23:06 +0530 From: Vinod Koul To: Baolin Wang Cc: Dan Williams , Eric Long , Mark Brown , Lars-Peter Clausen , dmaengine@vger.kernel.org, LKML Subject: Re: [PATCH v2 2/2] dmaengine: sprd: Add Spreadtrum DMA configuration Message-ID: <20180511115306.GC30118@vkoul-mobl> References: <67447aabb8e4e051ff39b814a0e169e6a91bb66e.1525863923.git.baolin.wang@linaro.org> <20180511112225.GA30118@vkoul-mobl> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11-05-18, 19:44, Baolin Wang wrote: > Hi Vinod, > > On 11 May 2018 at 19:22, Vinod Koul wrote: > > On 09-05-18, 19:12, Baolin Wang wrote: > > > >> +/* > >> + * struct sprd_dma_config - DMA configuration structure > >> + * @cfg: dma slave channel runtime config > >> + * @src_addr: the source physical address > >> + * @dst_addr: the destination physical address > >> + * @block_len: specify one block transfer length > >> + * @transcation_len: specify one transcation transfer length > >> + * @src_step: source transfer step > >> + * @dst_step: destination transfer step > >> + * @wrap_ptr: wrap pointer address, once the transfer address reaches the > >> + * 'wrap_ptr', the next transfer address will jump to the 'wrap_to' address. > >> + * @wrap_to: wrap jump to address > >> + * @req_mode: specify the DMA request mode > >> + * @int_mode: specify the DMA interrupt type > >> + */ > >> +struct sprd_dma_config { > >> + struct dma_slave_config cfg; > >> + phys_addr_t src_addr; > >> + phys_addr_t dst_addr; > > > > these are already in cfg so why duplicate, same for few more here. > > We save them in 'struct sprd_dma_config' as one parameter for > sprd_dma_config(), otherwise we need add 2 more parameters (src and > dst) for sprd_dma_config(). I am not sure I follow... I meant you can use sprd_dma_config.cfg->src_addr/dst_addr and remove src_addr & dst_addr in the sprd_dma_config. It duplicate.. Same for few more params... > >> + if (!is_slave_direction(dir) || sglen > 1) > >> + return NULL; > >> + > >> + sdesc = kzalloc(sizeof(*sdesc), GFP_NOWAIT); > >> + if (!sdesc) > >> + return NULL; > >> + > >> + for_each_sg(sgl, sg, sglen, i) { > >> + if (dir == DMA_MEM_TO_DEV) { > >> + slave_cfg->src_addr = sg_dma_address(sg); > >> + slave_cfg->dst_addr = slave_cfg->cfg.dst_addr; > >> + slave_cfg->src_step = > >> + sprd_dma_get_step(slave_cfg->cfg.src_addr_width); > >> + slave_cfg->dst_step = SPRD_DMA_NONE_STEP; > >> + } else { > >> + slave_cfg->src_addr = slave_cfg->cfg.src_addr; > >> + slave_cfg->dst_addr = sg_dma_address(sg); > >> + slave_cfg->src_step = SPRD_DMA_NONE_STEP; > >> + slave_cfg->dst_step = > >> + sprd_dma_get_step(slave_cfg->cfg.dst_addr_width); > > > > use a helper for filling this and passing right values for each case? > > We need pass many values to this helper, but will try. Thanks. I think 5 and that may help to look it better :) -- ~Vinod