Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp4632321yba; Tue, 30 Apr 2019 01:32:27 -0700 (PDT) X-Google-Smtp-Source: APXvYqzh/xOHPCzNZMBlw4vf2sG4Z3Il4WBe1KGA5+WO2XmS89iJ7Rqmrnw270pCf3lXJBfaCAoI X-Received: by 2002:a63:541d:: with SMTP id i29mr35866476pgb.174.1556613146941; Tue, 30 Apr 2019 01:32:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556613146; cv=none; d=google.com; s=arc-20160816; b=BU1I0fEmDDn/PPQtiokZfRlV/G2ddTVDiksoxLO8TOTSDkkgVEBpsx9bvTRLV84awz xxwBIpYmXWQ0TUZl4LHn5T7KehqjtZ/zd2I0uN6eTHJUdhJSd3wCpoW9trWBX/cZGxf+ blgbQdiQOuQl0iWlCFWnsLAi8J0VYP6U/y7H996di7nf0tSGJ1TcWxhV3MmkoUtTjoWL AZzdELJrvjbg91GQqwhln39GaLHz7SLVdmlBAN9d23p+1Dd63BH39/9It/USBx7bLUH5 zS67jCeDg3H7wCwmDymUfA2KLKaEF8hFtNgQKAGUHoYEokIYBxYdchg0Be+Qa4CRP7eT W1bw== 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; bh=SYyxeZ6lAlpNgYh1Sful1lUANoPHgYDON5NkNt56Zfo=; b=TmENk3iXrN0XpNvoDSttBf4sErHyrm26qRJqAhNn+YZ/F00Dj/+JJ5io9VHWt2MCcb seKIyRDlXV5q6Wgrvx8Xx53qktm3xcThROre3FvjJ6FZe+fre/MvxRZfPOusJv5/fGPJ b/SYvFrV6M/Z2p7AVniM+OeuhaRZayHRINilyHN15hzyx57dO641qg6x3qh1csLMCu1X D5FFsl1xFIWLS3SUvh+srWhqzPTnLGGZ0XicmIVNdSj0ezi09svhWJc7KB5UTJ5Fpkf1 6einFaGOLbZATVQ3T6h3jJNG82huASxQJkF2/MeoajMp4n/DGnt192PQg5t3xOsPRmca UkdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=a19ABJwB; 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 o68si4413700pfo.98.2019.04.30.01.32.11; Tue, 30 Apr 2019 01:32:26 -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=a19ABJwB; 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 S1726437AbfD3IaF (ORCPT + 99 others); Tue, 30 Apr 2019 04:30:05 -0400 Received: from mail.kernel.org ([198.145.29.99]:53528 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725769AbfD3IaE (ORCPT ); Tue, 30 Apr 2019 04:30:04 -0400 Received: from localhost (unknown [171.76.113.243]) (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 DA0212080C; Tue, 30 Apr 2019 08:30:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1556613003; bh=L44o5mnTaulGd8/A/x404M3tsCXjrGsZL4cOq+2J79A=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=a19ABJwBx7uM7bDncmxkYDjL+4cW9Ip/BQrprS8FSfQXXRboeP3bVIE7U/mJ7wvQH LSOn92WOL65zOTtCmoez8V+TLqEfF7jttCeJsLxHHQ4H94Vy5XrzNSf5NV4yuwfyAA bcyUr4NhvaYKPTR0QXQWeLm61SIpN7FfUmFvhlw4= Date: Tue, 30 Apr 2019 13:59:54 +0530 From: Vinod Koul To: Baolin Wang Cc: Dan Williams , eric.long@unisoc.com, Orson Zhai , Chunyan Zhang , Mark Brown , dmaengine@vger.kernel.org, LKML Subject: Re: [PATCH 4/7] dmaengine: sprd: Add device validation to support multiple controllers Message-ID: <20190430082954.GQ3845@vkoul-mobl.Dlink> References: <20190429115723.GK3845@vkoul-mobl.Dlink> <20190429140537.GN3845@vkoul-mobl.Dlink> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.11.3 (2019-02-01) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 30-04-19, 13:30, Baolin Wang wrote: > 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. But dma_request_channel() calls of_dma_request_slave_channel() which invokes of_dma_find_controller() why is it broken for you if that is the case.. -- ~Vinod