hil_proc: use proc->ops->release()
authorWendy Liang <jliang@xilinx.com>
Wed, 6 Jul 2016 00:18:53 +0000 (17:18 -0700)
committerWendy Liang <jliang@xilinx.com>
Thu, 13 Oct 2016 05:01:44 +0000 (22:01 -0700)
Use proc->ops->release() to release resource of each remote
proc driver. This allow each remote processor to define its
own resource release function.

Signed-off-by: Wendy Liang <jliang@xilinx.com>
lib/common/hil.c
lib/remoteproc/drivers/zynq_remoteproc_a9.c
lib/remoteproc/drivers/zynqmp_remoteproc_a53.c

index adee84d73a5e00763bdb1f71d98fbcbfcd334fa9..724040686c76b87cdd2846c3184995d09facd8d4 100644 (file)
@@ -129,7 +129,7 @@ void hil_delete_proc(struct hil_proc *proc)
                if (proc ==
                        metal_container_of(node, struct hil_proc, node)) {
                        metal_list_del(&proc->node);
-                       env_free_memory(proc);
+                       proc->ops->release(proc);
                        return;
                }
        }
index 892d5ba99a870af6e16ff4ae1b1a2444dff2ce7b..8c36c0b8ce5fc9661c3bf0257bf9b44dff1e5a31 100644 (file)
@@ -83,6 +83,7 @@ static void _notify(int cpu_id, struct proc_intr *intr_info);
 static int _boot_cpu(int cpu_id, unsigned int load_addr);
 static void _shutdown_cpu(int cpu_id);
 static int _initialize(void *pdata, struct hil_proc *proc, int cpu_id);
+static void _release(struct hil_proc *proc);
 
 /*--------------------------- Globals ---------------------------------- */
 struct hil_platform_ops zynq_a9_proc_ops = {
@@ -91,6 +92,7 @@ struct hil_platform_ops zynq_a9_proc_ops = {
        .boot_cpu         = _boot_cpu,
        .shutdown_cpu     = _shutdown_cpu,
        .initialize = _initialize,
+       .release = _release,
 };
 
 static int _enable_interrupt(struct proc_vring *vring_hw)
@@ -183,3 +185,9 @@ static int _initialize(void *pdata,
        memcpy(proc, pdata, sizeof(struct hil_proc));
        return 0;
 }
+
+static void _release(struct hil_proc *proc)
+{
+       env_free_memory(proc);
+}
+
index 36bbaf37c37afa4b6d24aab800c65dbc8346e92f..03b03214a5b9a5af9cef6f9f729758830ab5abbf 100644 (file)
@@ -57,6 +57,7 @@ static void _notify(int cpu_id, struct proc_intr *intr_info);
 static int _boot_cpu(int cpu_id, unsigned int load_addr);
 static void _shutdown_cpu(int cpu_id);
 static int _initialize(void *pdata, struct hil_proc *proc, int cpu_id);
+static void _release(struct hil_proc *proc);
 
 static void _ipi_handler(int vect_id, void *data);
 static void _ipi_handler_deinit(int vect_id, void *data);
@@ -69,6 +70,7 @@ struct hil_platform_ops zynqmp_r5_a53_proc_ops = {
        .boot_cpu             = _boot_cpu,
        .shutdown_cpu         = _shutdown_cpu,
        .initialize    = _initialize,
+       .release    = _release,
 };
 
 /* Extern functions defined out from OpenAMP lib */
@@ -188,3 +190,8 @@ static int _initialize(void *pdata,
        return 0;
 }
 
+static void _release(struct hil_proc *proc)
+{
+       env_free_memory(proc);
+}
+