mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2025-01-19 11:16:16 +07:00
dmaengine: Make channel allocation callbacks optional
Nowadays, some drivers don't have anything in there channel allocation callbacks anymore. Remove the BUG_ON if those callbacks aren't implemented, in order to allow drivers to not implement them. Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com> Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Vinod Koul <vinod.koul@intel.com>
This commit is contained in:
parent
d2f4f99db3
commit
c4b54a648e
@ -235,9 +235,11 @@ static int dma_chan_get(struct dma_chan *chan)
|
|||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
|
||||||
/* allocate upon first client reference */
|
/* allocate upon first client reference */
|
||||||
ret = chan->device->device_alloc_chan_resources(chan);
|
if (chan->device->device_alloc_chan_resources) {
|
||||||
if (ret < 0)
|
ret = chan->device->device_alloc_chan_resources(chan);
|
||||||
goto err_out;
|
if (ret < 0)
|
||||||
|
goto err_out;
|
||||||
|
}
|
||||||
|
|
||||||
if (!dma_has_cap(DMA_PRIVATE, chan->device->cap_mask))
|
if (!dma_has_cap(DMA_PRIVATE, chan->device->cap_mask))
|
||||||
balance_ref_count(chan);
|
balance_ref_count(chan);
|
||||||
@ -259,11 +261,15 @@ static int dma_chan_get(struct dma_chan *chan)
|
|||||||
*/
|
*/
|
||||||
static void dma_chan_put(struct dma_chan *chan)
|
static void dma_chan_put(struct dma_chan *chan)
|
||||||
{
|
{
|
||||||
|
/* This channel is not in use, bail out */
|
||||||
if (!chan->client_count)
|
if (!chan->client_count)
|
||||||
return; /* this channel failed alloc_chan_resources */
|
return;
|
||||||
|
|
||||||
chan->client_count--;
|
chan->client_count--;
|
||||||
module_put(dma_chan_to_owner(chan));
|
module_put(dma_chan_to_owner(chan));
|
||||||
if (chan->client_count == 0)
|
|
||||||
|
/* This channel is not in use anymore, free it */
|
||||||
|
if (!chan->client_count && chan->device->device_free_chan_resources)
|
||||||
chan->device->device_free_chan_resources(chan);
|
chan->device->device_free_chan_resources(chan);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -818,8 +824,6 @@ int dma_async_device_register(struct dma_device *device)
|
|||||||
BUG_ON(dma_has_cap(DMA_INTERLEAVE, device->cap_mask) &&
|
BUG_ON(dma_has_cap(DMA_INTERLEAVE, device->cap_mask) &&
|
||||||
!device->device_prep_interleaved_dma);
|
!device->device_prep_interleaved_dma);
|
||||||
|
|
||||||
BUG_ON(!device->device_alloc_chan_resources);
|
|
||||||
BUG_ON(!device->device_free_chan_resources);
|
|
||||||
BUG_ON(!device->device_tx_status);
|
BUG_ON(!device->device_tx_status);
|
||||||
BUG_ON(!device->device_issue_pending);
|
BUG_ON(!device->device_issue_pending);
|
||||||
BUG_ON(!device->dev);
|
BUG_ON(!device->dev);
|
||||||
|
Loading…
Reference in New Issue
Block a user