Skip to content

Commit 1bfdb25

Browse files
committed
pipe: remove waiti when task is cancelled
Two reasons: (1)waiti would cause FW panic if it is called in irq level higher than passive level (2)no need to wait cancelled task to be complete. Signed-off-by: Pan Xiuli <xiuli.pan@linux.intel.com> Signed-off-by: Rander Wang <rander.wang@linux.intel.com>
1 parent 90b455e commit 1bfdb25

3 files changed

Lines changed: 7 additions & 21 deletions

File tree

src/audio/pipeline.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1134,7 +1134,7 @@ void pipeline_schedule_cancel(struct pipeline *p)
11341134
int err;
11351135

11361136
/* cancel and wait for pipeline to complete */
1137-
err = schedule_task_cancel(&p->pipe_task, 1);
1137+
err = schedule_task_cancel(&p->pipe_task);
11381138
if (err < 0)
11391139
trace_pipe_error("pC0");
11401140
}

src/include/sof/schedule.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ void schedule_task(struct task *task, uint64_t start, uint64_t deadline);
8484

8585
void schedule_task_idle(struct task *task, uint64_t deadline);
8686

87-
int schedule_task_cancel(struct task *task, int wait);
87+
int schedule_task_cancel(struct task *task);
8888

8989
void schedule_task_complete(struct task *task);
9090

src/lib/schedule.c

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ static struct task *schedule_edf(void)
214214
}
215215

216216
/* cancel and delete task from scheduler - won't stop it if already running */
217-
int schedule_task_cancel(struct task *task, int wait)
217+
int schedule_task_cancel(struct task *task)
218218
{
219219
uint32_t flags;
220220
int ret = 0;
@@ -223,31 +223,17 @@ int schedule_task_cancel(struct task *task, int wait)
223223

224224
spin_lock_irq(&sch->lock, flags);
225225

226-
/* check current task state */
227-
switch (task->state) {
228-
case TASK_STATE_QUEUED:
226+
/* check current task state, delete it if it is queued
227+
* if it is already running, nothing we can do about it atm
228+
*/
229+
if (task->state == TASK_STATE_QUEUED) {
229230
/* delete task */
230231
task->state = TASK_STATE_CANCEL;
231232
list_item_del(&task->list);
232-
break;
233-
case TASK_STATE_RUNNING:
234-
/* already running, nothing we can do about it atm */
235-
if (wait) {
236-
task->complete.timeout = SCHEDULE_TASK_MAX_TIME_SLICE;
237-
spin_unlock_irq(&sch->lock, flags);
238-
ret = wait_for_completion_timeout(&task->complete);
239-
goto out;
240-
} else {
241-
ret = -EBUSY;
242-
}
243-
break;
244-
default:
245-
break;
246233
}
247234

248235
spin_unlock_irq(&sch->lock, flags);
249236

250-
out:
251237
return ret;
252238
}
253239

0 commit comments

Comments
 (0)