Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754678AbeALJTd (ORCPT + 1 other); Fri, 12 Jan 2018 04:19:33 -0500 Received: from o1.7nn.fshared.sendgrid.net ([167.89.55.65]:52059 "EHLO o1.7nn.fshared.sendgrid.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754562AbeALJT1 (ORCPT ); Fri, 12 Jan 2018 04:19:27 -0500 From: Kieran Bingham To: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Guennadi Liakhovetski , Laurent Pinchart , Olivier BRAUN , Troy Kisky , Kieran Bingham Subject: [RFT PATCH v3 4/6] uvcvideo: queue: Simplify spin-lock usage Date: Fri, 12 Jan 2018 09:19:26 +0000 (UTC) Message-Id: <9f83cda1d54615e068c20fcadf69a1f09ae50ec1.1515748369.git-series.kieran.bingham@ideasonboard.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: References: In-Reply-To: References: X-SG-EID: UsLXQ589HNP4HLBydmD9pgHURQozLYm9XliudupI8YvJ+naxdDgENRyPBJTkbE3mnh4sUWm838Sb6K eYRSHdqkMOtE0R5yWXfEq8lhFcXesenQN4A++tqyfhalyawPGuEIJdzKWBmYfENnCCpY3l6Nn/Yq02 zmzS68LFmw0RF/OY2H6jDVVNgdwGRy8yOlHxUrBYW+BDTqRxmSTsA3lC/YcqYnThf4vur0AjK6MktS Q/K/IrRDX126MywwcPbvj1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: Both uvc_start_streaming(), and uvc_stop_streaming() are called from userspace context. 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: Kieran Bingham --- drivers/media/usb/uvc/uvc_queue.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/media/usb/uvc/uvc_queue.c b/drivers/media/usb/uvc/uvc_queue.c index 4a581d631525..ddac4d89a291 100644 --- a/drivers/media/usb/uvc/uvc_queue.c +++ b/drivers/media/usb/uvc/uvc_queue.c @@ -158,7 +158,6 @@ static int uvc_start_streaming(struct vb2_queue *vq, unsigned int count) { struct uvc_video_queue *queue = vb2_get_drv_priv(vq); struct uvc_streaming *stream = uvc_queue_to_stream(queue); - unsigned long flags; int ret; queue->buf_used = 0; @@ -167,9 +166,9 @@ static int uvc_start_streaming(struct vb2_queue *vq, unsigned int count) if (ret == 0) return 0; - spin_lock_irqsave(&queue->irqlock, flags); + spin_lock_irq(&queue->irqlock); uvc_queue_return_buffers(queue, UVC_BUF_STATE_QUEUED); - spin_unlock_irqrestore(&queue->irqlock, flags); + spin_unlock_irq(&queue->irqlock); return ret; } @@ -178,13 +177,12 @@ static void uvc_stop_streaming(struct vb2_queue *vq) { struct uvc_video_queue *queue = vb2_get_drv_priv(vq); struct uvc_streaming *stream = uvc_queue_to_stream(queue); - unsigned long flags; uvc_video_enable(stream, 0); - spin_lock_irqsave(&queue->irqlock, flags); + spin_lock_irq(&queue->irqlock); 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 = { -- git-series 0.9.1