Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b730627a authored by John Sheu's avatar John Sheu Committed by Mauro Carvalho Chehab
Browse files

[media] v4l2: mem2mem: save irq flags correctly



Save flags correctly when taking spinlocks in v4l2_m2m_try_schedule.

Signed-off-by: default avatarJohn Sheu <sheu@google.com>
Signed-off-by: default avatarKamil Debski <k.debski@samsung.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 8fdf94a2
Loading
Loading
Loading
Loading
+11 −8
Original line number Original line Diff line number Diff line
@@ -205,7 +205,7 @@ static void v4l2_m2m_try_run(struct v4l2_m2m_dev *m2m_dev)
static void v4l2_m2m_try_schedule(struct v4l2_m2m_ctx *m2m_ctx)
static void v4l2_m2m_try_schedule(struct v4l2_m2m_ctx *m2m_ctx)
{
{
	struct v4l2_m2m_dev *m2m_dev;
	struct v4l2_m2m_dev *m2m_dev;
	unsigned long flags_job, flags;
	unsigned long flags_job, flags_out, flags_cap;


	m2m_dev = m2m_ctx->m2m_dev;
	m2m_dev = m2m_ctx->m2m_dev;
	dprintk("Trying to schedule a job for m2m_ctx: %p\n", m2m_ctx);
	dprintk("Trying to schedule a job for m2m_ctx: %p\n", m2m_ctx);
@@ -223,23 +223,26 @@ static void v4l2_m2m_try_schedule(struct v4l2_m2m_ctx *m2m_ctx)
		return;
		return;
	}
	}


	spin_lock_irqsave(&m2m_ctx->out_q_ctx.rdy_spinlock, flags);
	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)) {
		spin_unlock_irqrestore(&m2m_ctx->out_q_ctx.rdy_spinlock, flags);
		spin_unlock_irqrestore(&m2m_ctx->out_q_ctx.rdy_spinlock,
					flags_out);
		spin_unlock_irqrestore(&m2m_dev->job_spinlock, flags_job);
		spin_unlock_irqrestore(&m2m_dev->job_spinlock, flags_job);
		dprintk("No input buffers available\n");
		dprintk("No input buffers available\n");
		return;
		return;
	}
	}
	spin_lock_irqsave(&m2m_ctx->cap_q_ctx.rdy_spinlock, flags);
	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)) {
		spin_unlock_irqrestore(&m2m_ctx->cap_q_ctx.rdy_spinlock, flags);
		spin_unlock_irqrestore(&m2m_ctx->cap_q_ctx.rdy_spinlock,
		spin_unlock_irqrestore(&m2m_ctx->out_q_ctx.rdy_spinlock, flags);
					flags_cap);
		spin_unlock_irqrestore(&m2m_ctx->out_q_ctx.rdy_spinlock,
					flags_out);
		spin_unlock_irqrestore(&m2m_dev->job_spinlock, flags_job);
		spin_unlock_irqrestore(&m2m_dev->job_spinlock, flags_job);
		dprintk("No output buffers available\n");
		dprintk("No output buffers available\n");
		return;
		return;
	}
	}
	spin_unlock_irqrestore(&m2m_ctx->cap_q_ctx.rdy_spinlock, flags);
	spin_unlock_irqrestore(&m2m_ctx->cap_q_ctx.rdy_spinlock, flags_cap);
	spin_unlock_irqrestore(&m2m_ctx->out_q_ctx.rdy_spinlock, flags);
	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))) {