dmaengine.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Peter Ujfalusi <peter.ujfalusi@ti.com>
To: <vkoul@kernel.org>, <robh+dt@kernel.org>, <nm@ti.com>,
	<ssantosh@kernel.org>
Cc: <dan.j.williams@intel.com>, <dmaengine@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>,
	<devicetree@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<grygorii.strashko@ti.com>, <lokeshvutla@ti.com>,
	<t-kristo@ti.com>, <tony@atomide.com>
Subject: [PATCH 07/16] dmaengine: Add function to request slave channel from a dma_device
Date: Mon, 6 May 2019 15:34:47 +0300	[thread overview]
Message-ID: <20190506123456.6777-8-peter.ujfalusi@ti.com> (raw)
In-Reply-To: <20190506123456.6777-1-peter.ujfalusi@ti.com>

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.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
---
 drivers/dma/dmaengine.c   | 7 ++++---
 include/linux/dmaengine.h | 5 ++++-
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/dma/dmaengine.c b/drivers/dma/dmaengine.c
index 8eed5ff0fc01..7ec93be12088 100644
--- a/drivers/dma/dmaengine.c
+++ b/drivers/dma/dmaengine.c
@@ -617,7 +617,8 @@ struct dma_chan *dma_get_slave_channel(struct dma_chan *chan)
 }
 EXPORT_SYMBOL_GPL(dma_get_slave_channel);
 
-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)
 {
 	dma_cap_mask_t mask;
 	struct dma_chan *chan;
@@ -628,13 +629,13 @@ struct dma_chan *dma_get_any_slave_channel(struct dma_device *device)
 	/* lock against __dma_request_channel */
 	mutex_lock(&dma_list_mutex);
 
-	chan = find_candidate(device, &mask, NULL, NULL);
+	chan = find_candidate(device, &mask, fn, fn_param);
 
 	mutex_unlock(&dma_list_mutex);
 
 	return IS_ERR(chan) ? NULL : chan;
 }
-EXPORT_SYMBOL_GPL(dma_get_any_slave_channel);
+EXPORT_SYMBOL_GPL(dmadev_get_slave_channel);
 
 /**
  * __dma_request_channel - try to allocate an exclusive channel
diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
index c1486564a314..4774b66f2064 100644
--- a/include/linux/dmaengine.h
+++ b/include/linux/dmaengine.h
@@ -1541,7 +1541,10 @@ int dmaenginem_async_device_register(struct dma_device *device);
 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);
+#define dma_get_any_slave_channel(device) \
+	dmadev_get_slave_channel(device, NULL, NULL)
 #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


  parent reply	other threads:[~2019-05-06 12:35 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-06 12:34 [PATCH 00/16] dmaengine/soc/firmware: Add Texas Instruments UDMA support Peter Ujfalusi
2019-05-06 12:34 ` [PATCH 01/16] firmware: ti_sci: Add resource management APIs for ringacc, psi-l and udma Peter Ujfalusi
2019-06-06  6:00   ` Lokesh Vutla
2019-06-06 12:04     ` Peter Ujfalusi
2019-06-10  9:18   ` [PATCH v1.1] " Peter Ujfalusi
2019-06-10  9:41     ` Lokesh Vutla
2019-06-11 17:36       ` Tero Kristo
2019-05-06 12:34 ` [PATCH 02/16] bindings: soc: ti: add documentation for k3 ringacc Peter Ujfalusi
2019-06-13 18:09   ` Rob Herring
2019-05-06 12:34 ` [PATCH 03/16] soc: ti: k3: add navss ringacc driver Peter Ujfalusi
2019-05-06 12:34 ` [PATCH 04/16] dmaengine: doc: Add sections for per descriptor metadata support Peter Ujfalusi
2019-05-06 12:34 ` [PATCH 05/16] dmaengine: Add metadata_ops for dma_async_tx_descriptor Peter Ujfalusi
2019-05-06 12:34 ` [PATCH 06/16] dmaengine: Add support for reporting DMA cached data amount Peter Ujfalusi
2019-05-06 12:34 ` Peter Ujfalusi [this message]
2019-05-07  8:37   ` [PATCH 07/16] dmaengine: Add function to request slave channel from a dma_device Peter Ujfalusi
2019-05-06 12:34 ` [PATCH 08/16] dmaengine: ti: Add cppi5 header for UDMA Peter Ujfalusi
2019-05-06 12:34 ` [PATCH 09/16] dt-bindings: dma: ti: Add document for K3 UDMA Peter Ujfalusi
2019-06-13 18:16   ` Rob Herring
2019-06-13 20:33     ` Peter Ujfalusi
2019-06-14 13:20       ` Rob Herring
2019-06-14 13:43         ` Peter Ujfalusi
2019-06-19 14:04           ` Rob Herring
2019-06-20  9:56             ` Peter Ujfalusi
2019-05-06 12:34 ` [PATCH 10/16] dmaengine: ti: New driver for K3 UDMA - split#1: defines, structs, io func Peter Ujfalusi
2019-06-13 18:43   ` Rob Herring
2019-06-13 20:40     ` Peter Ujfalusi
2019-05-06 12:34 ` [PATCH 11/16] dmaengine: ti: New driver for K3 UDMA - split#2: probe/remove, xlate and filter_fn Peter Ujfalusi
2019-05-06 12:34 ` [PATCH 12/16] dmaengine: ti: New driver for K3 UDMA - split#3: alloc/free chan_resources Peter Ujfalusi
2019-05-06 12:34 ` [PATCH 13/16] dmaengine: ti: New driver for K3 UDMA - split#4: dma_device callbacks 1 Peter Ujfalusi
2019-05-06 12:34 ` [PATCH 14/16] dmaengine: ti: New driver for K3 UDMA - split#5: dma_device callbacks 2 Peter Ujfalusi
2019-05-06 12:34 ` [PATCH 15/16] dmaengine: ti: New driver for K3 UDMA - split#6: Kconfig and Makefile Peter Ujfalusi
2019-05-06 12:34 ` [PATCH 16/16] dmaengine: ti: k3-udma: Add glue layer for non DMAengine users 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=20190506123456.6777-8-peter.ujfalusi@ti.com \
    --to=peter.ujfalusi@ti.com \
    --cc=dan.j.williams@intel.com \
    --cc=devicetree@vger.kernel.org \
    --cc=dmaengine@vger.kernel.org \
    --cc=grygorii.strashko@ti.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lokeshvutla@ti.com \
    --cc=nm@ti.com \
    --cc=robh+dt@kernel.org \
    --cc=ssantosh@kernel.org \
    --cc=t-kristo@ti.com \
    --cc=tony@atomide.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 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).