mirror of https://github.com/thesofproject/sof.git
task: rename func to run
Renames task's func to run to better show intention of this callback. Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
This commit is contained in:
parent
752a3b2e15
commit
eb0d309cf9
|
@ -171,7 +171,7 @@ static inline void schedule(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
int schedule_task_init(struct task *task, uint16_t type, uint16_t priority,
|
int schedule_task_init(struct task *task, uint16_t type, uint16_t priority,
|
||||||
enum task_state (*func)(void *data), void *data,
|
enum task_state (*run)(void *data), void *data,
|
||||||
uint16_t core, uint32_t flags);
|
uint16_t core, uint32_t flags);
|
||||||
|
|
||||||
void scheduler_init(int type, const struct scheduler_ops *ops, void *data);
|
void scheduler_init(int type, const struct scheduler_ops *ops, void *data);
|
||||||
|
|
|
@ -47,7 +47,7 @@ struct task {
|
||||||
uint16_t flags;
|
uint16_t flags;
|
||||||
enum task_state state;
|
enum task_state state;
|
||||||
void *data;
|
void *data;
|
||||||
enum task_state (*func)(void *data);
|
enum task_state (*run)(void *data);
|
||||||
struct list_item list;
|
struct list_item list;
|
||||||
void *private;
|
void *private;
|
||||||
};
|
};
|
||||||
|
|
|
@ -37,10 +37,10 @@ static void schedule_edf(void *data);
|
||||||
static void schedule_edf_task_run(struct task *task, void *data)
|
static void schedule_edf_task_run(struct task *task, void *data)
|
||||||
{
|
{
|
||||||
while (1) {
|
while (1) {
|
||||||
/* execute task function and remove task from the list
|
/* execute task run function and remove task from the list
|
||||||
* only if completed
|
* only if completed
|
||||||
*/
|
*/
|
||||||
if (task->func(task->data) == SOF_TASK_STATE_COMPLETED)
|
if (task->run(task->data) == SOF_TASK_STATE_COMPLETED)
|
||||||
schedule_edf_task_complete(data, task);
|
schedule_edf_task_complete(data, task);
|
||||||
|
|
||||||
/* find new task for execution */
|
/* find new task for execution */
|
||||||
|
|
|
@ -83,7 +83,7 @@ static void schedule_ll_tasks_execute(struct ll_schedule_data *sch)
|
||||||
|
|
||||||
/* run task if its pending and remove from the list */
|
/* run task if its pending and remove from the list */
|
||||||
if (task->state == SOF_TASK_STATE_PENDING) {
|
if (task->state == SOF_TASK_STATE_PENDING) {
|
||||||
task->state = task->func(task->data);
|
task->state = task->run(task->data);
|
||||||
|
|
||||||
/* do we need to reschedule this task */
|
/* do we need to reschedule this task */
|
||||||
if (task->state == SOF_TASK_STATE_COMPLETED) {
|
if (task->state == SOF_TASK_STATE_COMPLETED) {
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
int schedule_task_init(struct task *task, uint16_t type, uint16_t priority,
|
int schedule_task_init(struct task *task, uint16_t type, uint16_t priority,
|
||||||
enum task_state (*func)(void *data), void *data,
|
enum task_state (*run)(void *data), void *data,
|
||||||
uint16_t core, uint32_t flags)
|
uint16_t core, uint32_t flags)
|
||||||
{
|
{
|
||||||
struct schedulers *schedulers = *arch_schedulers_get();
|
struct schedulers *schedulers = *arch_schedulers_get();
|
||||||
|
@ -39,7 +39,7 @@ int schedule_task_init(struct task *task, uint16_t type, uint16_t priority,
|
||||||
task->core = core;
|
task->core = core;
|
||||||
task->flags = flags;
|
task->flags = flags;
|
||||||
task->state = SOF_TASK_STATE_INIT;
|
task->state = SOF_TASK_STATE_INIT;
|
||||||
task->func = func;
|
task->run = run;
|
||||||
task->data = data;
|
task->data = data;
|
||||||
|
|
||||||
list_for_item(slist, &schedulers->list) {
|
list_for_item(slist, &schedulers->list) {
|
||||||
|
|
|
@ -68,7 +68,7 @@ void notifier_unregister(struct notifier *notifier)
|
||||||
}
|
}
|
||||||
|
|
||||||
int schedule_task_init(struct task *task, uint16_t type, uint16_t priority,
|
int schedule_task_init(struct task *task, uint16_t type, uint16_t priority,
|
||||||
enum task_state (*func)(void *data), void *data,
|
enum task_state (*run)(void *data), void *data,
|
||||||
uint16_t core, uint32_t xflags)
|
uint16_t core, uint32_t xflags)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -33,6 +33,6 @@ void cleanup_test_data(struct pipeline_connect_data *data);
|
||||||
static inline void schedule_task_mock_free(void *data, struct task *task)
|
static inline void schedule_task_mock_free(void *data, struct task *task)
|
||||||
{
|
{
|
||||||
task->state = SOF_TASK_STATE_FREE;
|
task->state = SOF_TASK_STATE_FREE;
|
||||||
task->func = NULL;
|
task->run = NULL;
|
||||||
task->data = NULL;
|
task->data = NULL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,7 +75,7 @@ static void test_audio_pipeline_free_sheduler_task_free(void **state)
|
||||||
|
|
||||||
assert_int_equal(result.pipe_task.state, SOF_TASK_STATE_FREE);
|
assert_int_equal(result.pipe_task.state, SOF_TASK_STATE_FREE);
|
||||||
assert_ptr_equal(NULL, result.pipe_task.data);
|
assert_ptr_equal(NULL, result.pipe_task.data);
|
||||||
assert_ptr_equal(NULL, result.pipe_task.func);
|
assert_ptr_equal(NULL, result.pipe_task.run);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_audio_pipeline_free_disconnect_full(void **state)
|
static void test_audio_pipeline_free_disconnect_full(void **state)
|
||||||
|
|
|
@ -27,13 +27,13 @@ void platform_dai_timestamp(struct comp_dev *dai,
|
||||||
}
|
}
|
||||||
|
|
||||||
int schedule_task_init(struct task *task, uint16_t type, uint16_t priority,
|
int schedule_task_init(struct task *task, uint16_t type, uint16_t priority,
|
||||||
enum task_state (*func)(void *data), void *data,
|
enum task_state (*run)(void *data), void *data,
|
||||||
uint16_t core, uint32_t xflags)
|
uint16_t core, uint32_t xflags)
|
||||||
{
|
{
|
||||||
(void)task;
|
(void)task;
|
||||||
(void)type;
|
(void)type;
|
||||||
(void)priority;
|
(void)priority;
|
||||||
(void)func;
|
(void)run;
|
||||||
(void)data;
|
(void)data;
|
||||||
(void)core;
|
(void)core;
|
||||||
(void)xflags;
|
(void)xflags;
|
||||||
|
|
|
@ -37,8 +37,8 @@ static void schedule_edf_task(void *data, struct task *task, uint64_t start,
|
||||||
list_item_prepend(&task->list, &sch->list);
|
list_item_prepend(&task->list, &sch->list);
|
||||||
task->state = SOF_TASK_STATE_QUEUED;
|
task->state = SOF_TASK_STATE_QUEUED;
|
||||||
|
|
||||||
if (task->func)
|
if (task->run)
|
||||||
task->func(task->data);
|
task->run(task->data);
|
||||||
|
|
||||||
schedule_edf_task_complete(task);
|
schedule_edf_task_complete(task);
|
||||||
}
|
}
|
||||||
|
@ -87,7 +87,7 @@ static void schedule_edf_task_cancel(void *data, struct task *task)
|
||||||
static void schedule_edf_task_free(void *data, struct task *task)
|
static void schedule_edf_task_free(void *data, struct task *task)
|
||||||
{
|
{
|
||||||
task->state = SOF_TASK_STATE_FREE;
|
task->state = SOF_TASK_STATE_FREE;
|
||||||
task->func = NULL;
|
task->run = NULL;
|
||||||
task->data = NULL;
|
task->data = NULL;
|
||||||
|
|
||||||
free(edf_sch_get_pdata(task));
|
free(edf_sch_get_pdata(task));
|
||||||
|
|
|
@ -21,7 +21,7 @@ struct schedulers **arch_schedulers_get(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
int schedule_task_init(struct task *task, uint16_t type, uint16_t priority,
|
int schedule_task_init(struct task *task, uint16_t type, uint16_t priority,
|
||||||
enum task_state (*func)(void *data), void *data,
|
enum task_state (*run)(void *data), void *data,
|
||||||
uint16_t core, uint32_t flags)
|
uint16_t core, uint32_t flags)
|
||||||
{
|
{
|
||||||
struct schedulers *schedulers = *arch_schedulers_get();
|
struct schedulers *schedulers = *arch_schedulers_get();
|
||||||
|
@ -39,7 +39,7 @@ int schedule_task_init(struct task *task, uint16_t type, uint16_t priority,
|
||||||
task->core = core;
|
task->core = core;
|
||||||
task->flags = flags;
|
task->flags = flags;
|
||||||
task->state = SOF_TASK_STATE_INIT;
|
task->state = SOF_TASK_STATE_INIT;
|
||||||
task->func = func;
|
task->run = run;
|
||||||
task->data = data;
|
task->data = data;
|
||||||
|
|
||||||
list_for_item(slist, &schedulers->list) {
|
list_for_item(slist, &schedulers->list) {
|
||||||
|
|
Loading…
Reference in New Issue