DMA Engine development
 help / color / mirror / Atom feed
* dmaengine: dma_request_chan_by_mask() to handle deferred probing
@ 2018-07-25 12:34 Vinod Koul
  0 siblings, 0 replies; 2+ messages in thread
From: Vinod Koul @ 2018-07-25 12:34 UTC (permalink / raw)
  To: Peter Ujfalusi; +Cc: dan.j.williams, dmaengine, linux-kernel

On 18-07-18, 12:29, Peter Ujfalusi wrote:
> If there are no DMA devices registered yet, return with EPROBE_DEFER
> similarly to the case when requesting a slave channel.

Applied, thanks

^ permalink raw reply	[flat|nested] 2+ messages in thread
* dmaengine: dma_request_chan_by_mask() to handle deferred probing
@ 2018-07-18  9:29 Peter Ujfalusi
  0 siblings, 0 replies; 2+ messages in thread
From: Peter Ujfalusi @ 2018-07-18  9:29 UTC (permalink / raw)
  To: vkoul, dan.j.williams; +Cc: dmaengine, linux-kernel

If there are no DMA devices registered yet, return with EPROBE_DEFER
similarly to the case when requesting a slave channel.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
---
 drivers/dma/dmaengine.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/dma/dmaengine.c b/drivers/dma/dmaengine.c
index d8fc7b58e506..f62e59e1a264 100644
--- a/drivers/dma/dmaengine.c
+++ b/drivers/dma/dmaengine.c
@@ -768,8 +768,14 @@ struct dma_chan *dma_request_chan_by_mask(const dma_cap_mask_t *mask)
 		return ERR_PTR(-ENODEV);
 
 	chan = __dma_request_channel(mask, NULL, NULL);
-	if (!chan)
-		chan = ERR_PTR(-ENODEV);
+	if (!chan) {
+		mutex_lock(&dma_list_mutex);
+		if (list_empty(&dma_device_list))
+			chan = ERR_PTR(-EPROBE_DEFER);
+		else
+			chan = ERR_PTR(-ENODEV);
+		mutex_unlock(&dma_list_mutex);
+	}
 
 	return chan;
 }

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-07-25 12:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-07-25 12:34 dmaengine: dma_request_chan_by_mask() to handle deferred probing Vinod Koul
  -- strict thread matches above, loose matches on Subject: below --
2018-07-18  9:29 Peter Ujfalusi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox