Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp4500559yba; Mon, 29 Apr 2019 22:32:16 -0700 (PDT) X-Google-Smtp-Source: APXvYqzT8kqyb7OQirxFaD2LUhNY7+7mL/3FvJ0c/fXTCtLm9Zc/IbS8ALmpn23k66/PI5jihs8i X-Received: by 2002:a63:d016:: with SMTP id z22mr10203284pgf.116.1556602335934; Mon, 29 Apr 2019 22:32:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556602335; cv=none; d=google.com; s=arc-20160816; b=joN68VotNVIDLEV6KL2Cc9Qe6x1DVhfdWERKSKfaXDsT/Whgw++3SzMdKH4W1XHYB8 aTvbW45L31lQcKAY4k5KVenQ5g4Eh1ZgrhnB5vPfIXHYrav00IXcJF9XVomLhyBcji1N PAxTzIKGJotzbCPRqONctTI+W0Ysfwp8ht111jmCy7ESP9FaVxfK51ZVHAWqz2iuU/Ag wNTAaCPePSkBlPA70IiYVR+93ekvAHkxInanqHfGqZqjTMjez7QW+KFho+rAXbkwKLO7 zM3TBPfpu1/3VUgyvZat44e5qgq1tFU7YQenY3pcDBfTCbtiBdGus9xFjSSEAnmy8Oe2 cSSg== 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 :in-reply-to:references:mime-version:dkim-signature; bh=aRCavcxLPADLPpht8Z6on0LEjWfPk/EUgU06FZDzQBs=; b=M2qHs/9gRk2KF7+1AzKuQBQsY5z0mCBoncjXimWIrdwrina74aSmrKMLKyNtQkOs4g 4DkZAJYSpGN489wAbUJJZGwvsJUtM+JVokttDXv36B/KEDoVn6u0DOlN0Mp9QWvHdJQ2 DH5qTTf44mK96JMsh97K5fv47imAgETgodX+mAqBK6tyY2JBBTMF4PIhmNS0nhpLt0Qo tsGVqrZdGkx/0Gp0hR+dg5GrxZmuHZfzWQLasosW96MKYZRrOS4avcdIH5g3UIl75Zzc FxtXtqi+Ln8x41pVXgEvoO+W1Vbj7azcCKmf6nmSQdnu/1Z0erekATFxXtUxcbeSw/HJ hF4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dkPagJ0e; 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 s19si10970882pgj.235.2019.04.29.22.32.00; Mon, 29 Apr 2019 22:32:15 -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=dkPagJ0e; 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 S1726324AbfD3Fa6 (ORCPT + 99 others); Tue, 30 Apr 2019 01:30:58 -0400 Received: from mail-ot1-f65.google.com ([209.85.210.65]:37383 "EHLO mail-ot1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726308AbfD3Fa5 (ORCPT ); Tue, 30 Apr 2019 01:30:57 -0400 Received: by mail-ot1-f65.google.com with SMTP id r20so9692892otg.4 for ; Mon, 29 Apr 2019 22:30:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=aRCavcxLPADLPpht8Z6on0LEjWfPk/EUgU06FZDzQBs=; b=dkPagJ0eXYSA35T2kaZcmUZXB2OILKj0nMSYyBST4s2xfakoz85Omi7wWR1V27rKqH F8ZjntDv2PEYDd5G71kInVhcH+Sasi8brcqjOSI1puC5I+xu4nE5of/YwxdxOHbY1cWO C2u2VcCEessMML8+c3A2YJ/mndkHPDai8p6c/w2DDpqipF/Ck73ivkZwOhKwG59PxMl1 /IeZZycjferMWsS5sXZ5Eofl3ab6/TjgMvCTg1IzSYuOvzxbbppBp1kS5QZgkZsMH6FK wIo8m4/2Ha8dlyIBzDDqjcx3xhGQYwO2ftpBY72oKexg3Oc6G0nlfGEb32cy33w7pSkr GKKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=aRCavcxLPADLPpht8Z6on0LEjWfPk/EUgU06FZDzQBs=; b=VKf+3OdGWqaBikwQjgPUe3QGNbbFS6d3DmLdbFFXzvQlBpfOlrmJUSYmrUf9usygjV LLqlQ2xplzjOtc3s1FA/9g7OqDt2hPzHnHElxqhgwn190UE+k0fc0avPHtmT63VGTJuH QGB31hXR+wdzO3YZ1osjs/l7oBdGoARMrJa+4lhqqt3EXQB2YUwB2gb1rITwr9A6uHMx cdj/CAsBb84uNKZkUHLqyDV6kqjwZHo4SVqA7OiW4txAPpBZVt7DwvTHja60/fOFxmHJ XSC8NWkDGoTF61TRO13GQXHCymc/ugAh5ISRfwCSE1mC5RE1tCeLfhizvw8k7QlVIELq wwgw== X-Gm-Message-State: APjAAAVYlpovIq3IyKvJn/t8Rv6UxBM5wGDKNyYNoOHd0fmi64uj2yYf I0zohC09n9ypOBc3X+DgcQEHnkQjrLRsQPRFwCALKA== X-Received: by 2002:a9d:7ad9:: with SMTP id m25mr41338446otn.75.1556602256776; Mon, 29 Apr 2019 22:30:56 -0700 (PDT) MIME-Version: 1.0 References: <20190429115723.GK3845@vkoul-mobl.Dlink> <20190429140537.GN3845@vkoul-mobl.Dlink> In-Reply-To: <20190429140537.GN3845@vkoul-mobl.Dlink> From: Baolin Wang Date: Tue, 30 Apr 2019 13:30:45 +0800 Message-ID: Subject: Re: [PATCH 4/7] dmaengine: sprd: Add device validation to support multiple controllers To: Vinod Koul Cc: Dan Williams , eric.long@unisoc.com, Orson Zhai , Chunyan Zhang , Mark Brown , dmaengine@vger.kernel.org, LKML 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 Mon, 29 Apr 2019 at 22:05, Vinod Koul wrote: > > On 29-04-19, 20:20, Baolin Wang wrote: > > On Mon, 29 Apr 2019 at 19:57, Vinod Koul wrote: > > > > > > On 15-04-19, 20:14, Baolin Wang wrote: > > > > From: Eric Long > > > > > > > > Since we can support multiple DMA engine controllers, we should add > > > > device validation in filter function to check if the correct controller > > > > to be requested. > > > > > > > > Signed-off-by: Eric Long > > > > Signed-off-by: Baolin Wang > > > > --- > > > > drivers/dma/sprd-dma.c | 5 +++++ > > > > 1 file changed, 5 insertions(+) > > > > > > > > diff --git a/drivers/dma/sprd-dma.c b/drivers/dma/sprd-dma.c > > > > index 0f92e60..9f99d4b 100644 > > > > --- a/drivers/dma/sprd-dma.c > > > > +++ b/drivers/dma/sprd-dma.c > > > > @@ -1020,8 +1020,13 @@ static void sprd_dma_free_desc(struct virt_dma_desc *vd) > > > > static bool sprd_dma_filter_fn(struct dma_chan *chan, void *param) > > > > { > > > > struct sprd_dma_chn *schan = to_sprd_dma_chan(chan); > > > > + struct of_phandle_args *dma_spec = > > > > + container_of(param, struct of_phandle_args, args[0]); > > > > u32 slave_id = *(u32 *)param; > > > > > > > > + if (chan->device->dev->of_node != dma_spec->np) > > > > > > Are you not using of_dma_find_controller() that does this, so this would > > > be useless! > > > > Yes, we can use of_dma_find_controller(), but that will be a little > > complicated than current solution. Since we need introduce one > > structure to save the node to validate in the filter function like > > below, which seems make things complicated. But if you still like to > > use of_dma_find_controller(), I can change to use it in next version. > > Sorry I should have clarified more.. > > of_dma_find_controller() is called by xlate, so you already run this > check, so why use this :) The of_dma_find_controller() can save the requested device node into dma_spec, and in the of_dma_simple_xlate() function, it will call dma_request_channel() to request one channel, but it did not validate the device node to find the corresponding dma device in dma_request_channel(). So we should in our filter function to validate the device node with the device node specified by the dma_spec. Hope I make things clear. -- Baolin Wang Best Regards