All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Ujfalusi <peter.ujfalusi@ti.com>
To: Vinod <vkoul@kernel.org>
Cc: dan.j.williams@intel.com, dmaengine@vger.kernel.org,
	grygorii.strashko@ti.com
Subject: [RFC,2/5] dmaengine: Add function to request slave channel from a dma_device
Date: Fri, 12 Oct 2018 15:07:49 +0300	[thread overview]
Message-ID: <2cafdbd7-6057-487a-2c11-5d6620135e2c@ti.com> (raw)

On 2018-10-09 14:22, Peter Ujfalusi wrote:
> 
> 
> On 2018-10-09 13:49, Vinod wrote:
>> On 24-09-18, 16:00, Peter Ujfalusi wrote:
>>> dma_get_any_slave_channel() would skip using the filter function, which
>>> in some cases needed to be executed before the alloc_chan_resources
>>> callback to make sure that all parameters are provided for the slave
>>> channel.
>>
>> Another request API, i though you had solved that last time around :(
> 
> Yes, I thought so, but this time it is different.
> I want to drop this patch myself also, but I need to figure out a way to
> do what the dmadev_get_slave_channel() allows me to do.
> 
> In path 4, udma_of_xlate() and the udma_dma_filter_fn()
> 
> It might be possible that I look up a free udma_chan, do the setup via
> the filter_fn() and finally call the dma_get_slave_channel().
> Might work fine, but I wanted to avoid to implement my own find free
> channel code when we have it already in DMAengine core.

It is going to be racy against parallel channel requests, but

>>> diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
>>> index 16c9d021988a..32010c6ae13a 100644
>>> --- a/include/linux/dmaengine.h
>>> +++ b/include/linux/dmaengine.h
>>> @@ -1542,6 +1542,8 @@ void dma_async_device_unregister(struct dma_device *device);
>>>  void dma_run_dependencies(struct dma_async_tx_descriptor *tx);
>>>  struct dma_chan *dma_get_slave_channel(struct dma_chan *chan);
>>>  struct dma_chan *dma_get_any_slave_channel(struct dma_device *device);
>>> +struct dma_chan *dmadev_get_slave_channel(struct dma_device *device,
>>> +					  dma_filter_fn fn, void *fn_param);

-struct dma_chan *dma_get_any_slave_channel(struct dma_device *device);
+struct dma_chan *dmadev_get_slave_channel(struct dma_device *device,
 				dma_filter_fn fn, void *fn_param);
+#define dma_get_any_slave_channel(device)\
	 dmadev_get_slave_channel(device, NULL, NULL)

Should cut down on duplicated code at least.


>>>  #define dma_request_channel(mask, x, y) __dma_request_channel(&(mask), x, y)
>>>  #define dma_request_slave_channel_compat(mask, x, y, dev, name) \
>>>  	__dma_request_slave_channel_compat(&(mask), x, y, dev, name)
>>> -- 
>>> Peter
>>>
>>> Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
>>> Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
>>
> 
> - Péter
> 
> Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
> Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
> 

- Péter

Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

             reply	other threads:[~2018-10-12 12:07 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-12 12:07 Peter Ujfalusi [this message]
  -- strict thread matches above, loose matches on Subject: below --
2018-10-09 11:22 [RFC,2/5] dmaengine: Add function to request slave channel from a dma_device Peter Ujfalusi
2018-10-09 10:49 Vinod Koul
2018-09-24 13:00 Peter Ujfalusi

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=2cafdbd7-6057-487a-2c11-5d6620135e2c@ti.com \
    --to=peter.ujfalusi@ti.com \
    --cc=dan.j.williams@intel.com \
    --cc=dmaengine@vger.kernel.org \
    --cc=grygorii.strashko@ti.com \
    --cc=vkoul@kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.