Message ID | 1369356108-15865-1-git-send-email-sheu@google.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Hi Sheu, Thank you for this patch. May I also ask you to add me to Cc of next mem2mem patches, as I am the mem2mem submaintainer? Best wishes,
John, thanks for the patch. On Thu, May 23, 2013 at 5:41 PM, John Sheu <sheu@google.com> wrote: > Save flags correctly when taking spinlocks in v4l2_m2m_try_schedule. > > Signed-off-by: John Sheu <sheu@google.com> Acked-by: Pawel Osciak <pawel@osciak.com> > --- > drivers/media/v4l2-core/v4l2-mem2mem.c | 19 +++++++++++-------- > 1 file changed, 11 insertions(+), 8 deletions(-) > > diff --git a/drivers/media/v4l2-core/v4l2-mem2mem.c b/drivers/media/v4l2-core/v4l2-mem2mem.c > index 66f599f..3606ff2 100644 > --- a/drivers/media/v4l2-core/v4l2-mem2mem.c > +++ b/drivers/media/v4l2-core/v4l2-mem2mem.c > @@ -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) > { > 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; > 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; > } > > - 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)) { > - 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); > dprintk("No input buffers available\n"); > 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)) { > - spin_unlock_irqrestore(&m2m_ctx->cap_q_ctx.rdy_spinlock, flags); > - spin_unlock_irqrestore(&m2m_ctx->out_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_out); > spin_unlock_irqrestore(&m2m_dev->job_spinlock, flags_job); > dprintk("No output buffers available\n"); > return; > } > - spin_unlock_irqrestore(&m2m_ctx->cap_q_ctx.rdy_spinlock, flags); > - spin_unlock_irqrestore(&m2m_ctx->out_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_out); > > if (m2m_dev->m2m_ops->job_ready > && (!m2m_dev->m2m_ops->job_ready(m2m_ctx->priv))) { > -- > 1.8.2.1 > -- Best regards, Pawel Osciak -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/media/v4l2-core/v4l2-mem2mem.c b/drivers/media/v4l2-core/v4l2-mem2mem.c index 66f599f..3606ff2 100644 --- a/drivers/media/v4l2-core/v4l2-mem2mem.c +++ b/drivers/media/v4l2-core/v4l2-mem2mem.c @@ -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) { 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; 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; } - 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)) { - 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); dprintk("No input buffers available\n"); 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)) { - spin_unlock_irqrestore(&m2m_ctx->cap_q_ctx.rdy_spinlock, flags); - spin_unlock_irqrestore(&m2m_ctx->out_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_out); spin_unlock_irqrestore(&m2m_dev->job_spinlock, flags_job); dprintk("No output buffers available\n"); return; } - spin_unlock_irqrestore(&m2m_ctx->cap_q_ctx.rdy_spinlock, flags); - spin_unlock_irqrestore(&m2m_ctx->out_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_out); if (m2m_dev->m2m_ops->job_ready && (!m2m_dev->m2m_ops->job_ready(m2m_ctx->priv))) {
Save flags correctly when taking spinlocks in v4l2_m2m_try_schedule. Signed-off-by: John Sheu <sheu@google.com> --- drivers/media/v4l2-core/v4l2-mem2mem.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-)