@@ -496,5 +496,13 @@ 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);
+
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("TI K3 common Remoteproc code");
@@ -107,4 +107,5 @@ 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);
#endif /* REMOTEPROC_TI_K3_COMMON_H */
@@ -66,13 +66,6 @@ static const struct rproc_ops k3_dsp_rproc_ops = {
.get_loaded_rsc_table = k3_get_loaded_rsc_table,
};
-static void k3_dsp_mem_release(void *data)
-{
- struct device *dev = data;
-
- of_reserved_mem_device_release(dev);
-}
-
static int k3_dsp_reserved_mem_init(struct k3_rproc *kproc)
{
struct device *dev = kproc->dev;
@@ -102,7 +95,7 @@ static int k3_dsp_reserved_mem_init(struct k3_rproc *kproc)
ERR_PTR(ret));
return ret;
}
- ret = devm_add_action_or_reset(dev, k3_dsp_mem_release, dev);
+ ret = devm_add_action_or_reset(dev, k3_mem_release, dev);
if (ret)
return ret;
@@ -21,13 +21,6 @@
#include "ti_sci_proc.h"
#include "ti_k3_common.h"
-static void k3_m4_rproc_dev_mem_release(void *data)
-{
- struct device *dev = data;
-
- of_reserved_mem_device_release(dev);
-}
-
static int k3_m4_reserved_mem_init(struct k3_rproc *kproc)
{
struct device *dev = kproc->dev;
@@ -56,7 +49,7 @@ static int k3_m4_reserved_mem_init(struct k3_rproc *kproc)
dev_err(dev, "device cannot initialize DMA pool (%d)\n", ret);
return ret;
}
- ret = devm_add_action_or_reset(dev, k3_m4_rproc_dev_mem_release, dev);
+ ret = devm_add_action_or_reset(dev, k3_mem_release, dev);
if (ret)
return ret;
The k3_dsp_mem_release() and k3_m4_rproc_dev_mem_release() functions release the reserved memory of the device, which get auto triggered upon device removal. Refactor these functions into ti_k3_common.c driver as k3_mem_release() and align DSP and M4 drivers to use this common function throughout. Signed-off-by: Beleswar Padhi <b-padhi@ti.com> --- drivers/remoteproc/ti_k3_common.c | 8 ++++++++ drivers/remoteproc/ti_k3_common.h | 1 + drivers/remoteproc/ti_k3_dsp_remoteproc.c | 9 +-------- drivers/remoteproc/ti_k3_m4_remoteproc.c | 9 +-------- 4 files changed, 11 insertions(+), 16 deletions(-)