From patchwork Fri Jan 12 09:19:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 10160127 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 6CE4F602B3 for ; Fri, 12 Jan 2018 09:21:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4D496288A3 for ; Fri, 12 Jan 2018 09:21:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 424062893C; Fri, 12 Jan 2018 09:21:44 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, RCVD_IN_DNSWL_HI, URIBL_GREY autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E028E288A3 for ; Fri, 12 Jan 2018 09:21:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754680AbeALJTd (ORCPT ); Fri, 12 Jan 2018 04:19:33 -0500 Received: from o1682455182.outbound-mail.sendgrid.net ([168.245.5.182]:2196 "EHLO o1682455182.outbound-mail.sendgrid.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754570AbeALJT1 (ORCPT ); Fri, 12 Jan 2018 04:19:27 -0500 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=sendgrid.me; h=from:to:cc:subject:in-reply-to:references:in-reply-to:references; s=smtpapi; bh=vrqXfWerfP5sJf7a3l+lbEB+bsM=; b=GO95o6RClEmwHgChfI bzykLko/33LDbKBpbkfQcQ2YUNJD+ObaShOi8MXgIlAMt0IKPo/JppCANaEpNwTK Apvnc/+3XPfEE1lRLhMSjtSAlYbKQlwHBjvfqgrVaZ1Nbqfj1r3j6oBgOgbmA1tG 6JM49+vc6nZV49tfsX6P7tK1g= Received: by filter0018p3las1.sendgrid.net with SMTP id filter0018p3las1-25740-5A587D9D-39 2018-01-12 09:19:26.123994636 +0000 UTC Received: from localhost.localdomain (cpc89242-aztw30-2-0-cust488.18-1.cable.virginm.net [86.31.129.233]) by ismtpd0005p1lon1.sendgrid.net (SG) with ESMTP id 9MnwH3KLRFW1YgGZxjsAOQ Fri, 12 Jan 2018 09:19:25.840 +0000 (UTC) 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: Tfq0zQjjJFmIKL8hyrOr6KT7wyjsEm7XZZskPfLyBPIHTTwyW//aUyDXngFIdeG2cD5zfUlclysO3w fuI4xKTv0Qi/Rrv2rJR8617nl8lsiGM6Ier2hzAcGQ76FEJDWbwPqdr4aG9AJfbff0OiwDsaQs6CO2 20w3ADXN8ivU6BuczXQrokEMIkaxMAWoaZQfY8cJAypzQKmRJPqIXjgS4WhWWq/LJuOi4aSSMTgCxf oeWOoTzFvi4wmxANfxgL86 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Reviewed-by: Laurent Pinchart --- 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 = {