[Cbe-oss-dev] [PATCH 11/11]MARS: Fix build warnings

Yuji Mano yuji.mano at am.sony.com
Fri Sep 12 05:35:13 EST 2008


This patch fixes some build warnings.

Signed-off-by: Yuji Mano <yuji.mano at am.sony.com>

---
 src/host/lib/mars_task.c           |   34 ++++++++++++++++++++++++++--------
 src/host/lib/mars_workload_queue.c |    1 +
 src/mpu/kernel/mars_kernel_task.c  |    2 ++
 3 files changed, 29 insertions(+), 8 deletions(-)

--- a/src/host/lib/mars_task.c
+++ b/src/host/lib/mars_task.c
@@ -61,6 +61,7 @@ int mars_task_initialize(struct mars_con
 
 	int ret;
 	struct mars_task_context *task;
+	struct mars_workload_context *workload;
 	Elf32_Ehdr *ehdr = (Elf32_Ehdr *)elf_image;
 	Elf32_Phdr *phdr = (Elf32_Phdr *)((void *)ehdr + ehdr->e_phoff);
 
@@ -78,10 +79,12 @@ int mars_task_initialize(struct mars_con
 
 	/* begin process to add the task to the workload queue */
 	ret = workload_queue_add_begin(mars->workload_queue, &id->workload_id,
-				MARS_WORKLOAD_TYPE_TASK,
-				(struct mars_workload_context **)&task);
+				MARS_WORKLOAD_TYPE_TASK, &workload);
 	MARS_CHECK_RET(ret == MARS_SUCCESS, ret);
 
+	/* cast workload context to task context */
+	task = (struct mars_task_context *)workload;
+
 	/* initialize task specific id */
 	memcpy(&task->id, id, sizeof(struct mars_task_id));
 
@@ -129,13 +132,17 @@ int mars_task_finalize(struct mars_task_
 
 	int ret;
 	struct mars_task_context *task;
+	struct mars_workload_context *workload;
 	struct mars_context *mars = (void *)(uintptr_t)id->mars_context_ea;
 
 	/* begin process to remove the task from the workload queue */
-	ret = workload_queue_remove_begin(mars->workload_queue, id->workload_id,
-				(struct mars_workload_context **)&task);
+	ret = workload_queue_remove_begin(mars->workload_queue,
+				id->workload_id, &workload);
 	MARS_CHECK_RET(ret == MARS_SUCCESS, ret);
 
+	/* cast workload context to task context */
+	task = (struct mars_task_context *)workload;
+
 	/* free the allocated task context area if it has one */
 	if (task->context_save_size)
 		free((void *)(uintptr_t)task->context_save_area);
@@ -158,14 +165,17 @@ int mars_task_schedule(struct mars_task_
 
 	int ret;
 	struct mars_task_context *task;
+	struct mars_workload_context *workload;
 	struct mars_context *mars = (void *)(uintptr_t)id->mars_context_ea;
 
 	/* begin process to schedule the workload in the workload queue */
 	ret = workload_queue_schedule_begin(mars->workload_queue,
-					id->workload_id, priority,
-					(struct mars_workload_context **)&task);
+				id->workload_id, priority, &workload);
 	MARS_CHECK_RET(ret == MARS_SUCCESS, ret);
 
+	/* cast workload context to task context */
+	task = (struct mars_task_context *)workload;
+
 	/* initialize task specific context variables */
 	task->stack = 0;
 	if (args)
@@ -189,13 +199,17 @@ int mars_task_wait(struct mars_task_id *
 
 	int ret;
 	struct mars_task_context *task;
+	struct mars_workload_context *workload;
 	struct mars_context *mars = (void *)(uintptr_t)id->mars_context_ea;
 
 	/* blocking wait for workload completion */
 	ret = workload_queue_wait(mars->workload_queue, id->workload_id,
-				(struct mars_workload_context **)&task);
+				&workload);
 	MARS_CHECK_RET(ret == MARS_SUCCESS, ret);
 
+	/* cast workload context to task context */
+	task = (struct mars_task_context *)workload;
+
 	/* exit_code requested so return it to caller */
 	if (exit_code)
 		*exit_code = task->exit_code;
@@ -211,13 +225,17 @@ int mars_task_try_wait(struct mars_task_
 
 	int ret;
 	struct mars_task_context *task;
+	struct mars_workload_context *workload;
 	struct mars_context *mars = (void *)(uintptr_t)id->mars_context_ea;
 
 	/* non-blocking wait for workload completion */
 	ret = workload_queue_try_wait(mars->workload_queue, id->workload_id,
-				(struct mars_workload_context **)&task);
+				&workload);
 	MARS_CHECK_RET(ret == MARS_SUCCESS, ret);
 
+	/* cast workload context to task context */
+	task = (struct mars_task_context *)workload;
+
 	/* exit_code requested so return it to caller */
 	if (exit_code)
 		*exit_code = task->exit_code;
--- a/src/host/lib/mars_workload_queue.c
+++ b/src/host/lib/mars_workload_queue.c
@@ -41,6 +41,7 @@
 
 #include "mars/mars_workload_queue.h"
 #include "mars/mars_kernel_types.h"
+#include "mars/mars_mutex.h"
 #include "mars/mars_error.h"
 #include "mars/mars_debug.h"
 
--- a/src/mpu/kernel/mars_kernel_task.c
+++ b/src/mpu/kernel/mars_kernel_task.c
@@ -64,6 +64,8 @@ void task_exec(struct mars_task_context 
 
 void task_exit(struct mars_task_context *task)
 {
+	(void)task;
+
 	MARS_ASSERT(task);
 }
 






More information about the cbe-oss-dev mailing list