dmaengine: Add reference counting to dma_device struct
authorLogan Gunthorpe <logang@deltatee.com>
Mon, 16 Dec 2019 19:01:19 +0000 (12:01 -0700)
committerVinod Koul <vkoul@kernel.org>
Tue, 24 Dec 2019 04:48:32 +0000 (10:18 +0530)
commit8ad342a863590b24ce77681b7e081363fb3333f7
tree393b6621b115e7cc07ff47e75ab897f929902654
parent11a0fd2b3baa5e4a97197b9cd990b5d05e69d669
dmaengine: Add reference counting to dma_device struct

Adding a reference count helps drivers to properly implement the unbind
while in use case.

References are taken and put every time a channel is allocated or freed.

Once the final reference is put, the device is removed from the
dma_device_list and a release callback function is called to signal
the driver to free the memory.

Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
Link: https://lore.kernel.org/r/20191216190120.21374-5-logang@deltatee.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
drivers/dma/dmaengine.c
include/linux/dmaengine.h