Commit 95faf82b authored by Bhupesh Sharma's avatar Bhupesh Sharma Committed by Mauro Carvalho Chehab

[media] usb: gadget/uvc: Remove non-required locking from 'uvc_queue_next_buffer' routine

This patch removes the non-required spinlock acquire/release calls on
'queue_irqlock' from 'uvc_queue_next_buffer' routine.

This routine is called from 'video->encode' function (which translates to either
'uvc_video_encode_bulk' or 'uvc_video_encode_isoc') in 'uvc_video.c'.
As, the 'video->encode' routines are called with 'queue_irqlock' already held,
so acquiring a 'queue_irqlock' again in 'uvc_queue_next_buffer' routine causes
a spin lock recursion.
Signed-off-by: default avatarBhupesh Sharma <bhupesh.sharma@st.com>
Acked-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 7cfce77d
...@@ -543,11 +543,11 @@ static int uvc_queue_enable(struct uvc_video_queue *queue, int enable) ...@@ -543,11 +543,11 @@ static int uvc_queue_enable(struct uvc_video_queue *queue, int enable)
return ret; return ret;
} }
/* called with &queue_irqlock held.. */
static struct uvc_buffer * static struct uvc_buffer *
uvc_queue_next_buffer(struct uvc_video_queue *queue, struct uvc_buffer *buf) uvc_queue_next_buffer(struct uvc_video_queue *queue, struct uvc_buffer *buf)
{ {
struct uvc_buffer *nextbuf; struct uvc_buffer *nextbuf;
unsigned long flags;
if ((queue->flags & UVC_QUEUE_DROP_INCOMPLETE) && if ((queue->flags & UVC_QUEUE_DROP_INCOMPLETE) &&
buf->buf.length != buf->buf.bytesused) { buf->buf.length != buf->buf.bytesused) {
...@@ -556,14 +556,12 @@ uvc_queue_next_buffer(struct uvc_video_queue *queue, struct uvc_buffer *buf) ...@@ -556,14 +556,12 @@ uvc_queue_next_buffer(struct uvc_video_queue *queue, struct uvc_buffer *buf)
return buf; return buf;
} }
spin_lock_irqsave(&queue->irqlock, flags);
list_del(&buf->queue); list_del(&buf->queue);
if (!list_empty(&queue->irqqueue)) if (!list_empty(&queue->irqqueue))
nextbuf = list_first_entry(&queue->irqqueue, struct uvc_buffer, nextbuf = list_first_entry(&queue->irqqueue, struct uvc_buffer,
queue); queue);
else else
nextbuf = NULL; nextbuf = NULL;
spin_unlock_irqrestore(&queue->irqlock, flags);
buf->buf.sequence = queue->sequence++; buf->buf.sequence = queue->sequence++;
do_gettimeofday(&buf->buf.timestamp); do_gettimeofday(&buf->buf.timestamp);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment