Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

dmaengine: of_dma: Add devm_of_dma_controller_register()

Add a managed API, devm_of_dma_controller_register(), to simplify DMA
engine controller registration by automatically handling resource
cleanup.

Signed-off-by: Frank Li <Frank.Li@nxp.com>
Link: https://patch.msgid.link/20260225-mxsdma-module-v3-1-8f798b13baa6@nxp.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>

authored by

Frank Li and committed by
Vinod Koul
3a005126 65ca1121

+29
+29
include/linux/of_dma.h
··· 38 38 void *data); 39 39 extern void of_dma_controller_free(struct device_node *np); 40 40 41 + static void __of_dma_controller_free(void *np) 42 + { 43 + of_dma_controller_free(np); 44 + } 45 + 46 + static inline int 47 + devm_of_dma_controller_register(struct device *dev, struct device_node *np, 48 + struct dma_chan *(*of_dma_xlate) 49 + (struct of_phandle_args *, struct of_dma *), 50 + void *data) 51 + { 52 + int ret; 53 + 54 + ret = of_dma_controller_register(np, of_dma_xlate, data); 55 + if (ret) 56 + return ret; 57 + 58 + return devm_add_action_or_reset(dev, __of_dma_controller_free, np); 59 + } 60 + 41 61 extern int of_dma_router_register(struct device_node *np, 42 62 void *(*of_dma_route_allocate) 43 63 (struct of_phandle_args *, struct of_dma *), ··· 82 62 83 63 static inline void of_dma_controller_free(struct device_node *np) 84 64 { 65 + } 66 + 67 + static inline int 68 + devm_of_dma_controller_register(struct device *dev, struct device_node *np, 69 + struct dma_chan *(*of_dma_xlate) 70 + (struct of_phandle_args *, struct of_dma *), 71 + void *data) 72 + { 73 + return -ENODEV; 85 74 } 86 75 87 76 static inline int of_dma_router_register(struct device_node *np,