From: Peter Ujfalusi Date: Wed, 18 Jul 2018 09:29:57 +0000 (+0300) Subject: dmaengine: dma_request_chan_by_mask() to handle deferred probing X-Git-Tag: v4.19-rc1~95^2~13 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ec8ca8e3b4809bf603814a8834bfd3891e1ccf74;p=thirdparty%2Fkernel%2Flinux.git dmaengine: dma_request_chan_by_mask() to handle deferred probing 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 Signed-off-by: Vinod Koul --- diff --git a/drivers/dma/dmaengine.c b/drivers/dma/dmaengine.c index 84ac38dbdb65c..504420f213ff7 100644 --- a/drivers/dma/dmaengine.c +++ b/drivers/dma/dmaengine.c @@ -770,8 +770,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; }