mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-01 06:33:07 +00:00
media: v4l2-mem2mem: Simplify exiting the function in __v4l2_m2m_try_schedule
The __v4l2_m2m_try_schedule function acquires and releases multiple spinlocks. Simplify unlocking the job lock by adding labels to unlock the lock and exit the function. Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
This commit is contained in:
parent
542a522d32
commit
cbec2836f8
1 changed files with 13 additions and 16 deletions
|
@ -297,51 +297,48 @@ static void __v4l2_m2m_try_queue(struct v4l2_m2m_dev *m2m_dev,
|
||||||
|
|
||||||
/* If the context is aborted then don't schedule it */
|
/* If the context is aborted then don't schedule it */
|
||||||
if (m2m_ctx->job_flags & TRANS_ABORT) {
|
if (m2m_ctx->job_flags & TRANS_ABORT) {
|
||||||
spin_unlock_irqrestore(&m2m_dev->job_spinlock, flags_job);
|
|
||||||
dprintk("Aborted context\n");
|
dprintk("Aborted context\n");
|
||||||
return;
|
goto job_unlock;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m2m_ctx->job_flags & TRANS_QUEUED) {
|
if (m2m_ctx->job_flags & TRANS_QUEUED) {
|
||||||
spin_unlock_irqrestore(&m2m_dev->job_spinlock, flags_job);
|
|
||||||
dprintk("On job queue already\n");
|
dprintk("On job queue already\n");
|
||||||
return;
|
goto job_unlock;
|
||||||
}
|
}
|
||||||
|
|
||||||
spin_lock_irqsave(&m2m_ctx->out_q_ctx.rdy_spinlock, flags_out);
|
spin_lock_irqsave(&m2m_ctx->out_q_ctx.rdy_spinlock, flags_out);
|
||||||
if (list_empty(&m2m_ctx->out_q_ctx.rdy_queue)
|
if (list_empty(&m2m_ctx->out_q_ctx.rdy_queue)
|
||||||
&& !m2m_ctx->out_q_ctx.buffered) {
|
&& !m2m_ctx->out_q_ctx.buffered) {
|
||||||
spin_unlock_irqrestore(&m2m_ctx->out_q_ctx.rdy_spinlock,
|
|
||||||
flags_out);
|
|
||||||
spin_unlock_irqrestore(&m2m_dev->job_spinlock, flags_job);
|
|
||||||
dprintk("No input buffers available\n");
|
dprintk("No input buffers available\n");
|
||||||
return;
|
goto out_unlock;
|
||||||
}
|
}
|
||||||
spin_lock_irqsave(&m2m_ctx->cap_q_ctx.rdy_spinlock, flags_cap);
|
spin_lock_irqsave(&m2m_ctx->cap_q_ctx.rdy_spinlock, flags_cap);
|
||||||
if (list_empty(&m2m_ctx->cap_q_ctx.rdy_queue)
|
if (list_empty(&m2m_ctx->cap_q_ctx.rdy_queue)
|
||||||
&& !m2m_ctx->cap_q_ctx.buffered) {
|
&& !m2m_ctx->cap_q_ctx.buffered) {
|
||||||
spin_unlock_irqrestore(&m2m_ctx->cap_q_ctx.rdy_spinlock,
|
|
||||||
flags_cap);
|
|
||||||
spin_unlock_irqrestore(&m2m_ctx->out_q_ctx.rdy_spinlock,
|
|
||||||
flags_out);
|
|
||||||
spin_unlock_irqrestore(&m2m_dev->job_spinlock, flags_job);
|
|
||||||
dprintk("No output buffers available\n");
|
dprintk("No output buffers available\n");
|
||||||
return;
|
goto cap_unlock;
|
||||||
}
|
}
|
||||||
spin_unlock_irqrestore(&m2m_ctx->cap_q_ctx.rdy_spinlock, flags_cap);
|
spin_unlock_irqrestore(&m2m_ctx->cap_q_ctx.rdy_spinlock, flags_cap);
|
||||||
spin_unlock_irqrestore(&m2m_ctx->out_q_ctx.rdy_spinlock, flags_out);
|
spin_unlock_irqrestore(&m2m_ctx->out_q_ctx.rdy_spinlock, flags_out);
|
||||||
|
|
||||||
if (m2m_dev->m2m_ops->job_ready
|
if (m2m_dev->m2m_ops->job_ready
|
||||||
&& (!m2m_dev->m2m_ops->job_ready(m2m_ctx->priv))) {
|
&& (!m2m_dev->m2m_ops->job_ready(m2m_ctx->priv))) {
|
||||||
spin_unlock_irqrestore(&m2m_dev->job_spinlock, flags_job);
|
|
||||||
dprintk("Driver not ready\n");
|
dprintk("Driver not ready\n");
|
||||||
return;
|
goto job_unlock;
|
||||||
}
|
}
|
||||||
|
|
||||||
list_add_tail(&m2m_ctx->queue, &m2m_dev->job_queue);
|
list_add_tail(&m2m_ctx->queue, &m2m_dev->job_queue);
|
||||||
m2m_ctx->job_flags |= TRANS_QUEUED;
|
m2m_ctx->job_flags |= TRANS_QUEUED;
|
||||||
|
|
||||||
spin_unlock_irqrestore(&m2m_dev->job_spinlock, flags_job);
|
spin_unlock_irqrestore(&m2m_dev->job_spinlock, flags_job);
|
||||||
|
return;
|
||||||
|
|
||||||
|
cap_unlock:
|
||||||
|
spin_unlock_irqrestore(&m2m_ctx->cap_q_ctx.rdy_spinlock, flags_cap);
|
||||||
|
out_unlock:
|
||||||
|
spin_unlock_irqrestore(&m2m_ctx->out_q_ctx.rdy_spinlock, flags_out);
|
||||||
|
job_unlock:
|
||||||
|
spin_unlock_irqrestore(&m2m_dev->job_spinlock, flags_job);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue