From b734091d638080a311c2f44745d431374fc43fd5 Mon Sep 17 00:00:00 2001 From: Tomasz Lauda Date: Thu, 10 Oct 2019 10:17:09 +0200 Subject: [PATCH] ll_schedule_domain: pass task during unregistration Changes domain_unregister operation to also receive task being unregistered. Signed-off-by: Tomasz Lauda --- src/include/sof/schedule/ll_schedule_domain.h | 6 +++--- src/schedule/dma_multi_chan_domain.c | 2 ++ src/schedule/dma_single_chan_domain.c | 2 ++ src/schedule/ll_schedule.c | 7 ++++--- src/schedule/timer_domain.c | 2 +- 5 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/include/sof/schedule/ll_schedule_domain.h b/src/include/sof/schedule/ll_schedule_domain.h index 1c352bf23..9e2945b65 100644 --- a/src/include/sof/schedule/ll_schedule_domain.h +++ b/src/include/sof/schedule/ll_schedule_domain.h @@ -30,7 +30,7 @@ struct ll_schedule_domain_ops { uint64_t period, struct task *task, void (*handler)(void *arg), void *arg); void (*domain_unregister)(struct ll_schedule_domain *domain, - uint32_t num_tasks); + struct task *task, uint32_t num_tasks); void (*domain_enable)(struct ll_schedule_domain *domain, int core); void (*domain_disable)(struct ll_schedule_domain *domain, int core); void (*domain_set)(struct ll_schedule_domain *domain, uint64_t start); @@ -85,11 +85,11 @@ static inline int domain_register(struct ll_schedule_domain *domain, } static inline void domain_unregister(struct ll_schedule_domain *domain, - uint32_t num_tasks) + struct task *task, uint32_t num_tasks) { assert(domain->ops->domain_unregister); - domain->ops->domain_unregister(domain, num_tasks); + domain->ops->domain_unregister(domain, task, num_tasks); } static inline void domain_enable(struct ll_schedule_domain *domain, int core) diff --git a/src/schedule/dma_multi_chan_domain.c b/src/schedule/dma_multi_chan_domain.c index f4f922077..8c6450391 100644 --- a/src/schedule/dma_multi_chan_domain.c +++ b/src/schedule/dma_multi_chan_domain.c @@ -172,9 +172,11 @@ static void dma_multi_chan_domain_irq_unregister(struct dma_domain_data *data) /** * \brief Unregisters task from DMA domain. * \param[in,out] domain Pointer to schedule domain. + * \param[in,out] task Task to be unregistered from the domain.. * \param[in] num_tasks Number of currently scheduled tasks. */ static void dma_multi_chan_domain_unregister(struct ll_schedule_domain *domain, + struct task *task, uint32_t num_tasks) { struct dma_domain *dma_domain = ll_sch_domain_get_pdata(domain); diff --git a/src/schedule/dma_single_chan_domain.c b/src/schedule/dma_single_chan_domain.c index eab962e4d..309fa9468 100644 --- a/src/schedule/dma_single_chan_domain.c +++ b/src/schedule/dma_single_chan_domain.c @@ -333,9 +333,11 @@ static void dma_domain_unregister_owner(struct ll_schedule_domain *domain, /** * \brief Unregisters task from DMA domain. * \param[in,out] domain Pointer to schedule domain. + * \param[in,out] task Task to be unregistered from the domain. * \param[in] num_tasks Number of currently scheduled tasks. */ static void dma_single_chan_domain_unregister(struct ll_schedule_domain *domain, + struct task *task, uint32_t num_tasks) { struct dma_domain *dma_domain = ll_sch_domain_get_pdata(domain); diff --git a/src/schedule/ll_schedule.c b/src/schedule/ll_schedule.c index 73f798d6f..c6b26cec1 100644 --- a/src/schedule/ll_schedule.c +++ b/src/schedule/ll_schedule.c @@ -191,7 +191,8 @@ static int schedule_ll_domain_set(struct ll_schedule_data *sch, return 0; } -static void schedule_ll_domain_clear(struct ll_schedule_data *sch) +static void schedule_ll_domain_clear(struct ll_schedule_data *sch, + struct task *task) { spin_lock(sch->domain->lock); @@ -212,7 +213,7 @@ static void schedule_ll_domain_clear(struct ll_schedule_data *sch) spin_unlock(sch->domain->lock); - domain_unregister(sch->domain, atomic_read(&sch->num_tasks)); + domain_unregister(sch->domain, task, atomic_read(&sch->num_tasks)); } static void schedule_ll_task_insert(struct task *task, struct list_item *tasks) @@ -339,7 +340,7 @@ static void schedule_ll_task_cancel(void *data, struct task *task) /* found it */ if (curr_task == task) { - schedule_ll_domain_clear(sch); + schedule_ll_domain_clear(sch, task); break; } } diff --git a/src/schedule/timer_domain.c b/src/schedule/timer_domain.c index b2c3e22fd..f361ec17f 100644 --- a/src/schedule/timer_domain.c +++ b/src/schedule/timer_domain.c @@ -56,7 +56,7 @@ static int timer_domain_register(struct ll_schedule_domain *domain, } static void timer_domain_unregister(struct ll_schedule_domain *domain, - uint32_t num_tasks) + struct task *task, uint32_t num_tasks) { struct timer_domain *timer_domain = ll_sch_domain_get_pdata(domain); int core = cpu_get_id();