dmaengine.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vinod Koul <vkoul@kernel.org>
To: Baolin Wang <baolin.wang@linaro.org>
Cc: Dan Williams <dan.j.williams@intel.com>,
	eric.long@unisoc.com, Orson Zhai <orsonzhai@gmail.com>,
	Chunyan Zhang <zhang.lyra@gmail.com>,
	Mark Brown <broonie@kernel.org>,
	dmaengine@vger.kernel.org, LKML <linux-kernel@vger.kernel.org>
Subject: [4/7] dmaengine: sprd: Add device validation to support multiple controllers
Date: Mon, 29 Apr 2019 19:35:37 +0530	[thread overview]
Message-ID: <20190429140537.GN3845@vkoul-mobl.Dlink> (raw)

On 29-04-19, 20:20, Baolin Wang wrote:
> On Mon, 29 Apr 2019 at 19:57, Vinod Koul <vkoul@kernel.org> wrote:
> >
> > On 15-04-19, 20:14, Baolin Wang wrote:
> > > From: Eric Long <eric.long@unisoc.com>
> > >
> > > 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 <eric.long@unisoc.com>
> > > Signed-off-by: Baolin Wang <baolin.wang@linaro.org>
> > > ---
> > >  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 :)

WARNING: multiple messages have this Message-ID (diff)
From: Vinod Koul <vkoul@kernel.org>
To: Baolin Wang <baolin.wang@linaro.org>
Cc: Dan Williams <dan.j.williams@intel.com>,
	eric.long@unisoc.com, Orson Zhai <orsonzhai@gmail.com>,
	Chunyan Zhang <zhang.lyra@gmail.com>,
	Mark Brown <broonie@kernel.org>,
	dmaengine@vger.kernel.org, LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 4/7] dmaengine: sprd: Add device validation to support multiple controllers
Date: Mon, 29 Apr 2019 19:35:37 +0530	[thread overview]
Message-ID: <20190429140537.GN3845@vkoul-mobl.Dlink> (raw)
Message-ID: <20190429140537.1eh2zHA-EdCnItmmhfCh-G5_cqheud693gWlQZHsCIo@z> (raw)
In-Reply-To: <CAMz4kuLf4wgr4Js3xH1aQVc4c2XK1Oq2TnsUq=NSowQUq5ZN5g@mail.gmail.com>

On 29-04-19, 20:20, Baolin Wang wrote:
> On Mon, 29 Apr 2019 at 19:57, Vinod Koul <vkoul@kernel.org> wrote:
> >
> > On 15-04-19, 20:14, Baolin Wang wrote:
> > > From: Eric Long <eric.long@unisoc.com>
> > >
> > > 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 <eric.long@unisoc.com>
> > > Signed-off-by: Baolin Wang <baolin.wang@linaro.org>
> > > ---
> > >  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 :)

-- 
~Vinod

         reply	other threads:[~2019-04-29 14:05 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-15 12:14 [PATCH 0/7] Fix some bugs and add new feature for Spreadtrum DMA engine Baolin Wang
2019-04-15 12:14 ` [1/7] dmaengine: sprd: Fix the possible crash when getting engine status Baolin Wang
2019-04-15 12:14   ` [PATCH 1/7] " Baolin Wang
2019-04-29 11:35   ` [1/7] " Vinod Koul
2019-04-29 11:35     ` [PATCH 1/7] " Vinod Koul
2019-04-29 11:49     ` [1/7] " Baolin Wang
2019-04-29 11:49       ` [PATCH 1/7] " Baolin Wang
2019-04-29 12:02       ` [1/7] " Vinod Koul
2019-04-29 12:02         ` [PATCH 1/7] " Vinod Koul
2019-04-15 12:14 ` [2/7] dmaengine: sprd: Add validation of current descriptor in irq handler Baolin Wang
2019-04-15 12:14   ` [PATCH 2/7] " Baolin Wang
2019-04-15 12:14 ` [3/7] dmaengine: sprd: Fix the incorrect start for 2-stage destination channels Baolin Wang
2019-04-15 12:14   ` [PATCH 3/7] " Baolin Wang
2019-04-15 12:14 ` [4/7] dmaengine: sprd: Add device validation to support multiple controllers Baolin Wang
2019-04-15 12:14   ` [PATCH 4/7] " Baolin Wang
2019-04-29 11:57   ` [4/7] " Vinod Koul
2019-04-29 11:57     ` [PATCH 4/7] " Vinod Koul
2019-04-29 12:20     ` [4/7] " Baolin Wang
2019-04-29 12:20       ` [PATCH 4/7] " Baolin Wang
2019-04-29 14:05       ` Vinod Koul [this message]
2019-04-29 14:05         ` Vinod Koul
2019-04-30  5:30         ` [4/7] " Baolin Wang
2019-04-30  5:30           ` [PATCH 4/7] " Baolin Wang
2019-04-30  8:29           ` [4/7] " Vinod Koul
2019-04-30  8:29             ` [PATCH 4/7] " Vinod Koul
2019-04-30  8:34             ` [4/7] " Baolin Wang
2019-04-30  8:34               ` [PATCH 4/7] " Baolin Wang
2019-04-30  8:53               ` [4/7] " Baolin Wang
2019-04-30  8:53                 ` [PATCH 4/7] " Baolin Wang
2019-05-02  6:01                 ` [4/7] " Vinod Koul
2019-05-02  6:01                   ` [PATCH 4/7] " Vinod Koul
2019-05-06  4:48                   ` Baolin Wang
2019-04-15 12:14 ` [5/7] dmaengine: sprd: Fix block length overflow Baolin Wang
2019-04-15 12:14   ` [PATCH 5/7] " Baolin Wang
2019-04-15 12:15 ` [6/7] dmaengine: sprd: Fix the right place to configure 2-stage transfer Baolin Wang
2019-04-15 12:15   ` [PATCH 6/7] " Baolin Wang
2019-04-15 12:15 ` [7/7] dmaengine: sprd: Add interrupt support for " Baolin Wang
2019-04-15 12:15   ` [PATCH 7/7] " Baolin Wang
2019-04-29 12:01   ` [7/7] " Vinod Koul
2019-04-29 12:01     ` [PATCH 7/7] " Vinod Koul
2019-04-29 12:11     ` [7/7] " Baolin Wang
2019-04-29 12:11       ` [PATCH 7/7] " Baolin Wang
2019-04-29 14:10       ` [7/7] " Vinod Koul
2019-04-29 14:10         ` [PATCH 7/7] " Vinod Koul
2019-04-30  5:37         ` [7/7] " Baolin Wang
2019-04-30  5:37           ` [PATCH 7/7] " Baolin Wang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190429140537.GN3845@vkoul-mobl.Dlink \
    --to=vkoul@kernel.org \
    --cc=baolin.wang@linaro.org \
    --cc=broonie@kernel.org \
    --cc=dan.j.williams@intel.com \
    --cc=dmaengine@vger.kernel.org \
    --cc=eric.long@unisoc.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=orsonzhai@gmail.com \
    --cc=zhang.lyra@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).