Skip to content

Commit 663cdb7

Browse files
authored
Merge pull request #314 from RanderWang/waiti-1.2
pipe: remove waiti when task is cancelled
2 parents 3753fc5 + 1bfdb25 commit 663cdb7

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
@@ -216,7 +216,7 @@ static struct task *schedule_edf(void)
216216
}
217217

218218
/* cancel and delete task from scheduler - won't stop it if already running */
219-
int schedule_task_cancel(struct task *task, int wait)
219+
int schedule_task_cancel(struct task *task)
220220
{
221221
uint32_t flags;
222222
int ret = 0;
@@ -225,31 +225,17 @@ int schedule_task_cancel(struct task *task, int wait)
225225

226226
spin_lock_irq(&sch->lock, flags);
227227

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

250237
spin_unlock_irq(&sch->lock, flags);
251238

252-
out:
253239
return ret;
254240
}
255241

0 commit comments

Comments
 (0)