[Cbe-oss-dev] [PATCH 10/10 V2] MARS: workload type move from context to queue block
Geoff Levand
geoffrey.levand at am.sony.com
Thu Aug 7 10:06:48 EST 2008
Yuji Mano wrote:
> Make the workload context a completely abstract container.
> Previously the workload type was part of the workload context, but this moves
> the type into the inherited workload context (task context).
>
> Signed-off-by: Yuji Mano <yuji.mano at am.sony.com>
>
> ---
> Changes since V1:
> - remove unnecessary pad in task context
> - rename pad to context in workload context
No mention of my comments on workload_queue_add() and
mars_workload_to_task()...
> @@ -47,7 +47,7 @@ extern "C" {
> int workload_queue_initialize(struct mars_workload_queue *queue);
> int workload_queue_finalize(struct mars_workload_queue *queue);
> int workload_queue_add(struct mars_workload_queue *queue, uint16_t *id,
> - struct mars_workload_context *workload);
> + struct mars_workload_context *workload, uint8_t type);
The workload arg to workload_queue_add() will always need to be cast, so
is meaningless, and so should just be a void* type.
> int workload_queue_remove(struct mars_workload_queue *queue, uint16_t id,
> struct mars_workload_context *workload);
> int workload_queue_context(struct mars_workload_queue *queue, uint16_t id,
> --- a/include/mpu/mars/mars_kernel.h
> +++ b/include/mpu/mars/mars_kernel.h
> @@ -65,9 +66,9 @@ void workload_run(void)
> workload_state = MARS_WORKLOAD_STATE_RUNNING;
>
> /* workload type specific handling */
> - switch(workload.type) {
> + switch(workload_type) {
> case MARS_WORKLOAD_TYPE_TASK:
> - task_run(&workload.type_context.task);
> + task_run((struct mars_task_context *)&workload);
In general, casts in open code like this are undesirable. Make a
mars_workload_to_task() or some such routine.
More information about the cbe-oss-dev
mailing list