All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] usb: gadget/uvc: Remove non-required locking from 'uvc_queue_next_buffer' routine
@ 2012-03-22  4:50 Bhupesh Sharma
  2012-03-22 12:35 ` Sergei Shtylyov
  2012-03-22 14:40 ` Greg KH
  0 siblings, 2 replies; 7+ messages in thread
From: Bhupesh Sharma @ 2012-03-22  4:50 UTC (permalink / raw)
  To: gregkh, linux-usb
  Cc: laurent.pinchart, spear-devel, linux-media, Bhupesh Sharma

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: Bhupesh Sharma <bhupesh.sharma@st.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 drivers/usb/gadget/uvc_queue.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/gadget/uvc_queue.c b/drivers/usb/gadget/uvc_queue.c
index d776adb..104ae9c 100644
--- a/drivers/usb/gadget/uvc_queue.c
+++ b/drivers/usb/gadget/uvc_queue.c
@@ -543,11 +543,11 @@ done:
 	return ret;
 }
 
+/* called with &queue_irqlock held.. */
 static struct uvc_buffer *
 uvc_queue_next_buffer(struct uvc_video_queue *queue, struct uvc_buffer *buf)
 {
 	struct uvc_buffer *nextbuf;
-	unsigned long flags;
 
 	if ((queue->flags & UVC_QUEUE_DROP_INCOMPLETE) &&
 	    buf->buf.length != buf->buf.bytesused) {
@@ -556,14 +556,12 @@ uvc_queue_next_buffer(struct uvc_video_queue *queue, struct uvc_buffer *buf)
 		return buf;
 	}
 
-	spin_lock_irqsave(&queue->irqlock, flags);
 	list_del(&buf->queue);
 	if (!list_empty(&queue->irqqueue))
 		nextbuf = list_first_entry(&queue->irqqueue, struct uvc_buffer,
 					   queue);
 	else
 		nextbuf = NULL;
-	spin_unlock_irqrestore(&queue->irqlock, flags);
 
 	buf->buf.sequence = queue->sequence++;
 	do_gettimeofday(&buf->buf.timestamp);
-- 
1.7.2.2


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2012-03-23 14:57 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-22  4:50 [PATCH] usb: gadget/uvc: Remove non-required locking from 'uvc_queue_next_buffer' routine Bhupesh Sharma
2012-03-22 12:35 ` Sergei Shtylyov
2012-03-22 14:40 ` Greg KH
2012-03-23  9:31   ` Bhupesh SHARMA
2012-03-23 10:00     ` Laurent Pinchart
2012-03-23 11:16       ` Bhupesh SHARMA
2012-03-23 14:57     ` Greg KH

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.