* [PATCH 1/5] remoteproc: da8xx: Use devm_of_reserved_mem_device_init()
2026-09-02 19:33 [PATCH 0/5] remoteproc: Use devm_of_reserved_mem_device_init() Mukesh Ojha
@ 2026-09-02 19:33 ` Mukesh Ojha
2026-09-02 19:33 ` [PATCH 2/5] remoteproc: keystone: " Mukesh Ojha
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Mukesh Ojha @ 2026-09-02 19:33 UTC (permalink / raw)
To: Bjorn Andersson, Mathieu Poirier, Matthias Brugger,
AngeloGioacchino Del Regno
Cc: linux-remoteproc, linux-kernel, linux-arm-kernel, linux-mediatek,
Mukesh Ojha
Replace the hand-rolled da8xx_rproc_mem_release() devres action with
devm_of_reserved_mem_device_init(), which handles the cleanup
automatically. This removes both the wrapper function and the
devm_add_action_or_reset() call.
Signed-off-by: Mukesh Ojha <mukesh.ojha@oss.qualcomm.com>
---
drivers/remoteproc/da8xx_remoteproc.c | 10 +---------
1 file changed, 1 insertion(+), 9 deletions(-)
diff --git a/drivers/remoteproc/da8xx_remoteproc.c b/drivers/remoteproc/da8xx_remoteproc.c
index 006fa7b56727..f75a01f9104b 100644
--- a/drivers/remoteproc/da8xx_remoteproc.c
+++ b/drivers/remoteproc/da8xx_remoteproc.c
@@ -230,13 +230,6 @@ static int da8xx_rproc_get_internal_memories(struct platform_device *pdev,
return 0;
}
-static void da8xx_rproc_mem_release(void *data)
-{
- struct device *dev = data;
-
- of_reserved_mem_device_release(dev);
-}
-
static int da8xx_rproc_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
@@ -267,10 +260,9 @@ static int da8xx_rproc_probe(struct platform_device *pdev)
"unable to get reset control\n");
if (dev->of_node) {
- ret = of_reserved_mem_device_init(dev);
+ ret = devm_of_reserved_mem_device_init(dev);
if (ret)
return dev_err_probe(dev, ret, "device does not have specific CMA pool\n");
- devm_add_action_or_reset(&pdev->dev, da8xx_rproc_mem_release, &pdev->dev);
}
ret = da8xx_rproc_get_internal_memories(pdev, drproc);
--
2.55.0
^ permalink raw reply related [flat|nested] 6+ messages in thread* [PATCH 2/5] remoteproc: keystone: Use devm_of_reserved_mem_device_init()
2026-09-02 19:33 [PATCH 0/5] remoteproc: Use devm_of_reserved_mem_device_init() Mukesh Ojha
2026-09-02 19:33 ` [PATCH 1/5] remoteproc: da8xx: " Mukesh Ojha
@ 2026-09-02 19:33 ` Mukesh Ojha
2026-09-02 19:33 ` [PATCH 3/5] remoteproc: omap: " Mukesh Ojha
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Mukesh Ojha @ 2026-09-02 19:33 UTC (permalink / raw)
To: Bjorn Andersson, Mathieu Poirier, Matthias Brugger,
AngeloGioacchino Del Regno
Cc: linux-remoteproc, linux-kernel, linux-arm-kernel, linux-mediatek,
Mukesh Ojha
Replace the hand-rolled keystone_rproc_mem_release() devres action with
devm_of_reserved_mem_device_init(), which handles the cleanup
automatically. This removes both the wrapper function and the
devm_add_action_or_reset() call.
Signed-off-by: Mukesh Ojha <mukesh.ojha@oss.qualcomm.com>
---
drivers/remoteproc/keystone_remoteproc.c | 16 ++--------------
1 file changed, 2 insertions(+), 14 deletions(-)
diff --git a/drivers/remoteproc/keystone_remoteproc.c b/drivers/remoteproc/keystone_remoteproc.c
index 407d6034f748..d390f56b4994 100644
--- a/drivers/remoteproc/keystone_remoteproc.c
+++ b/drivers/remoteproc/keystone_remoteproc.c
@@ -330,13 +330,6 @@ static int keystone_rproc_of_get_dev_syscon(struct platform_device *pdev,
return 0;
}
-static void keystone_rproc_mem_release(void *data)
-{
- struct device *dev = data;
-
- of_reserved_mem_device_release(dev);
-}
-
static void keystone_rproc_pm_runtime_put(void *data)
{
struct device *dev = data;
@@ -426,14 +419,9 @@ static int keystone_rproc_probe(struct platform_device *pdev)
if (ret)
return dev_err_probe(dev, ret, "failed to get gpio for virtio kicks\n");
- ret = of_reserved_mem_device_init(dev);
- if (ret) {
+ ret = devm_of_reserved_mem_device_init(dev);
+ if (ret)
dev_warn(dev, "device does not have specific CMA pool\n");
- } else {
- ret = devm_add_action_or_reset(dev, keystone_rproc_mem_release, dev);
- if (ret)
- return ret;
- }
/* ensure the DSP is in reset before loading firmware */
ret = reset_control_status(ksproc->reset);
--
2.55.0
^ permalink raw reply related [flat|nested] 6+ messages in thread* [PATCH 3/5] remoteproc: omap: Use devm_of_reserved_mem_device_init()
2026-09-02 19:33 [PATCH 0/5] remoteproc: Use devm_of_reserved_mem_device_init() Mukesh Ojha
2026-09-02 19:33 ` [PATCH 1/5] remoteproc: da8xx: " Mukesh Ojha
2026-09-02 19:33 ` [PATCH 2/5] remoteproc: keystone: " Mukesh Ojha
@ 2026-09-02 19:33 ` Mukesh Ojha
2026-09-02 19:33 ` [PATCH 4/5] remoteproc: mtk_scp: " Mukesh Ojha
2026-09-02 19:33 ` [PATCH 5/5] remoteproc: ti_k3: " Mukesh Ojha
4 siblings, 0 replies; 6+ messages in thread
From: Mukesh Ojha @ 2026-09-02 19:33 UTC (permalink / raw)
To: Bjorn Andersson, Mathieu Poirier, Matthias Brugger,
AngeloGioacchino Del Regno
Cc: linux-remoteproc, linux-kernel, linux-arm-kernel, linux-mediatek,
Mukesh Ojha
Replace the hand-rolled omap_rproc_mem_release() devres action with
devm_of_reserved_mem_device_init(), which handles the cleanup
automatically. This removes both the wrapper function and the
devm_add_action_or_reset() call.
Signed-off-by: Mukesh Ojha <mukesh.ojha@oss.qualcomm.com>
---
drivers/remoteproc/omap_remoteproc.c | 13 +------------
1 file changed, 1 insertion(+), 12 deletions(-)
diff --git a/drivers/remoteproc/omap_remoteproc.c b/drivers/remoteproc/omap_remoteproc.c
index 6ed0f28edac9..74262f873d40 100644
--- a/drivers/remoteproc/omap_remoteproc.c
+++ b/drivers/remoteproc/omap_remoteproc.c
@@ -1276,13 +1276,6 @@ static int omap_rproc_of_get_timers(struct platform_device *pdev,
return 0;
}
-static void omap_rproc_mem_release(void *data)
-{
- struct device *dev = data;
-
- of_reserved_mem_device_release(dev);
-}
-
static int omap_rproc_probe(struct platform_device *pdev)
{
struct device_node *np = pdev->dev.of_node;
@@ -1359,15 +1352,11 @@ static int omap_rproc_probe(struct platform_device *pdev)
if (IS_ERR(oproc->fck))
return PTR_ERR(oproc->fck);
- ret = of_reserved_mem_device_init(&pdev->dev);
- if (ret) {
+ if (devm_of_reserved_mem_device_init(&pdev->dev)) {
dev_warn(&pdev->dev, "device does not have specific CMA pool.\n");
dev_warn(&pdev->dev, "Typically this should be provided,\n");
dev_warn(&pdev->dev, "only omit if you know what you are doing.\n");
}
- ret = devm_add_action_or_reset(&pdev->dev, omap_rproc_mem_release, &pdev->dev);
- if (ret)
- return ret;
platform_set_drvdata(pdev, rproc);
--
2.55.0
^ permalink raw reply related [flat|nested] 6+ messages in thread* [PATCH 4/5] remoteproc: mtk_scp: Use devm_of_reserved_mem_device_init()
2026-09-02 19:33 [PATCH 0/5] remoteproc: Use devm_of_reserved_mem_device_init() Mukesh Ojha
` (2 preceding siblings ...)
2026-09-02 19:33 ` [PATCH 3/5] remoteproc: omap: " Mukesh Ojha
@ 2026-09-02 19:33 ` Mukesh Ojha
2026-09-02 19:33 ` [PATCH 5/5] remoteproc: ti_k3: " Mukesh Ojha
4 siblings, 0 replies; 6+ messages in thread
From: Mukesh Ojha @ 2026-09-02 19:33 UTC (permalink / raw)
To: Bjorn Andersson, Mathieu Poirier, Matthias Brugger,
AngeloGioacchino Del Regno
Cc: linux-remoteproc, linux-kernel, linux-arm-kernel, linux-mediatek,
Mukesh Ojha
Switch to devm_of_reserved_mem_device_init() so the reserved memory
region is released automatically when the device is unbound. Remove
the explicit of_reserved_mem_device_release() call from
scp_unmap_memory_region(). The DMA coherent buffer is still freed
explicitly there before devres releases the reserved memory region,
preserving the correct teardown order.
Signed-off-by: Mukesh Ojha <mukesh.ojha@oss.qualcomm.com>
---
drivers/remoteproc/mtk_scp.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/remoteproc/mtk_scp.c b/drivers/remoteproc/mtk_scp.c
index 9751acc2bf83..2a6c286b86a7 100644
--- a/drivers/remoteproc/mtk_scp.c
+++ b/drivers/remoteproc/mtk_scp.c
@@ -1034,7 +1034,7 @@ static int scp_map_memory_region(struct mtk_scp *scp)
int ret;
const struct mtk_scp_sizes_data *scp_sizes;
- ret = of_reserved_mem_device_init(scp->dev);
+ ret = devm_of_reserved_mem_device_init(scp->dev);
/* reserved memory is optional. */
if (ret == -ENODEV) {
@@ -1067,7 +1067,6 @@ static void scp_unmap_memory_region(struct mtk_scp *scp)
dma_free_coherent(scp->dev, scp_sizes->max_dram_size, scp->cpu_addr,
scp->dma_addr);
- of_reserved_mem_device_release(scp->dev);
}
static int scp_register_ipi(struct platform_device *pdev, u32 id,
--
2.55.0
^ permalink raw reply related [flat|nested] 6+ messages in thread* [PATCH 5/5] remoteproc: ti_k3: Use devm_of_reserved_mem_device_init()
2026-09-02 19:33 [PATCH 0/5] remoteproc: Use devm_of_reserved_mem_device_init() Mukesh Ojha
` (3 preceding siblings ...)
2026-09-02 19:33 ` [PATCH 4/5] remoteproc: mtk_scp: " Mukesh Ojha
@ 2026-09-02 19:33 ` Mukesh Ojha
4 siblings, 0 replies; 6+ messages in thread
From: Mukesh Ojha @ 2026-09-02 19:33 UTC (permalink / raw)
To: Bjorn Andersson, Mathieu Poirier, Matthias Brugger,
AngeloGioacchino Del Regno
Cc: linux-remoteproc, linux-kernel, linux-arm-kernel, linux-mediatek,
Mukesh Ojha
Replace the hand-rolled devm wrapper (k3_mem_release +
devm_add_action_or_reset) with the standard
devm_of_reserved_mem_device_init(), letting the device resource
manager handle cleanup automatically. Remove the now-unused k3_mem_release
exported symbol.
Signed-off-by: Mukesh Ojha <mukesh.ojha@oss.qualcomm.com>
---
drivers/remoteproc/ti_k3_common.c | 13 +------------
drivers/remoteproc/ti_k3_common.h | 1 -
2 files changed, 1 insertion(+), 13 deletions(-)
diff --git a/drivers/remoteproc/ti_k3_common.c b/drivers/remoteproc/ti_k3_common.c
index 3cb8ae5d72f6..f08b9e373220 100644
--- a/drivers/remoteproc/ti_k3_common.c
+++ b/drivers/remoteproc/ti_k3_common.c
@@ -458,14 +458,6 @@ int k3_rproc_of_get_memories(struct platform_device *pdev,
}
EXPORT_SYMBOL_GPL(k3_rproc_of_get_memories);
-void k3_mem_release(void *data)
-{
- struct device *dev = data;
-
- of_reserved_mem_device_release(dev);
-}
-EXPORT_SYMBOL_GPL(k3_mem_release);
-
int k3_reserved_mem_init(struct k3_rproc *kproc)
{
struct device *dev = kproc->dev;
@@ -486,14 +478,11 @@ int k3_reserved_mem_init(struct k3_rproc *kproc)
}
/* use reserved memory region 0 for vring DMA allocations */
- ret = of_reserved_mem_device_init_by_idx(dev, np, 0);
+ ret = devm_of_reserved_mem_device_init(dev);
if (ret) {
dev_err(dev, "device cannot initialize DMA pool (%d)\n", ret);
return ret;
}
- ret = devm_add_action_or_reset(dev, k3_mem_release, dev);
- if (ret)
- return ret;
num_rmems--;
kproc->rmem = devm_kcalloc(dev, num_rmems, sizeof(*kproc->rmem), GFP_KERNEL);
diff --git a/drivers/remoteproc/ti_k3_common.h b/drivers/remoteproc/ti_k3_common.h
index aee3c28dbe51..9a58aeb3867c 100644
--- a/drivers/remoteproc/ti_k3_common.h
+++ b/drivers/remoteproc/ti_k3_common.h
@@ -112,7 +112,6 @@ void *k3_rproc_da_to_va(struct rproc *rproc, u64 da, size_t len,
bool *is_iomem);
int k3_rproc_of_get_memories(struct platform_device *pdev,
struct k3_rproc *kproc);
-void k3_mem_release(void *data);
int k3_reserved_mem_init(struct k3_rproc *kproc);
void k3_release_tsp(void *data);
#endif /* REMOTEPROC_TI_K3_COMMON_H */
--
2.55.0
^ permalink raw reply related [flat|nested] 6+ messages in thread