Commit c50c9c1e authored by Kieran Bingham's avatar Kieran Bingham Committed by Mauro Carvalho Chehab

media: uvcvideo: queue: Simplify spin-lock usage

Both uvc_start_streaming(), and uvc_stop_streaming() are called from
userspace context, with interrupts enabled. As such, they do not need to
save the IRQ state, and can use spin_lock_irq() and spin_unlock_irq()
respectively.
Signed-off-by: default avatarKieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
parent e829b262
...@@ -169,18 +169,19 @@ static int uvc_start_streaming(struct vb2_queue *vq, unsigned int count) ...@@ -169,18 +169,19 @@ static int uvc_start_streaming(struct vb2_queue *vq, unsigned int count)
{ {
struct uvc_video_queue *queue = vb2_get_drv_priv(vq); struct uvc_video_queue *queue = vb2_get_drv_priv(vq);
struct uvc_streaming *stream = uvc_queue_to_stream(queue); struct uvc_streaming *stream = uvc_queue_to_stream(queue);
unsigned long flags;
int ret; int ret;
lockdep_assert_irqs_enabled();
queue->buf_used = 0; queue->buf_used = 0;
ret = uvc_video_enable(stream, 1); ret = uvc_video_enable(stream, 1);
if (ret == 0) if (ret == 0)
return 0; return 0;
spin_lock_irqsave(&queue->irqlock, flags); spin_lock_irq(&queue->irqlock);
uvc_queue_return_buffers(queue, UVC_BUF_STATE_QUEUED); uvc_queue_return_buffers(queue, UVC_BUF_STATE_QUEUED);
spin_unlock_irqrestore(&queue->irqlock, flags); spin_unlock_irq(&queue->irqlock);
return ret; return ret;
} }
...@@ -188,14 +189,15 @@ static int uvc_start_streaming(struct vb2_queue *vq, unsigned int count) ...@@ -188,14 +189,15 @@ static int uvc_start_streaming(struct vb2_queue *vq, unsigned int count)
static void uvc_stop_streaming(struct vb2_queue *vq) static void uvc_stop_streaming(struct vb2_queue *vq)
{ {
struct uvc_video_queue *queue = vb2_get_drv_priv(vq); struct uvc_video_queue *queue = vb2_get_drv_priv(vq);
unsigned long flags;
lockdep_assert_irqs_enabled();
if (vq->type != V4L2_BUF_TYPE_META_CAPTURE) if (vq->type != V4L2_BUF_TYPE_META_CAPTURE)
uvc_video_enable(uvc_queue_to_stream(queue), 0); uvc_video_enable(uvc_queue_to_stream(queue), 0);
spin_lock_irqsave(&queue->irqlock, flags); spin_lock_irq(&queue->irqlock);
uvc_queue_return_buffers(queue, UVC_BUF_STATE_ERROR); uvc_queue_return_buffers(queue, UVC_BUF_STATE_ERROR);
spin_unlock_irqrestore(&queue->irqlock, flags); spin_unlock_irq(&queue->irqlock);
} }
static const struct vb2_ops uvc_queue_qops = { static const struct vb2_ops uvc_queue_qops = {
......
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