Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp4347005imm; Mon, 30 Jul 2018 12:57:28 -0700 (PDT) X-Google-Smtp-Source: AAOMgpef/rdGxQbhIcl/0TZsoFAVM9UGqCJpc700ZtgbSwpzADmft12rpinKVgdBCYli03ZgX22u X-Received: by 2002:a17:902:6501:: with SMTP id b1-v6mr17714430plk.31.1532980648547; Mon, 30 Jul 2018 12:57:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532980648; cv=none; d=google.com; s=arc-20160816; b=ieyANtlrJULMDjgBckUrfRzsiOMn9fCwCE/kzHIQSbcSuPdidve5bQKlbJCS/dGUTy ETBZ8+qzZXq8yW90aKLpepCM4M22vEyluIcCzcTF4cep2ZrImtFOoC32B/qtY8jPCTSF RcLXdaLfczP2dGIqbKfJl55l/aveEfi8ElZyMvQYnpk6DlOG2JIYF2EdHns/NBjxWORz YUgHU+O7mpivZ4sICLPx04WBm/QsE68c++oJ8rWZhXyWGeCLstjt+o4/3m2CfDyCl1vM D4xauPWgljf/TFLuPXoQJYgsHNqNpFBucbRG5fmW9XLZtg9HHDW7E+VZFHVzzdCkMAFw VUtg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:organization:message-id:date:subject:cc:to :from:dkim-signature:arc-authentication-results; bh=cVin6OuReGnWeKMY2VNKU4/hR+BQfFSGAhKNEXSwvAM=; b=JtRIHY3XyVMX1flXO1IBvvim4ZyBuZ8SZPUw8yVgyDc8ak7f/eaZeoaar+mXvvu02L dskmmKdHEv0E2zB7w+LzY55GKndIbU8sXs4z+E5Vssufwah4MKHAlJmPbrojRAtEhNZ1 mE88+M0aXyau7LOI81BB86h6/U+Ir+SxIof10Oq78Mn4l/TDTPAi1MRCtV7Zf5mPf9lz ireRThXBbHLTavmXXXBgWvLLiJJjQ6Njqg2AEZuIMnVWWHXcUua+DK3HVxUAV6t6cCth IhpwLPEWBe43VYSKjyOxG82y2e0v7huFX7zIKc/t0HVWqeXrC/TtwvGstrxlWVmzSEPC dgYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=lkbExwWG; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n13-v6si5527630pgq.655.2018.07.30.12.57.12; Mon, 30 Jul 2018 12:57:28 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=lkbExwWG; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731806AbeG3Vc6 (ORCPT + 99 others); Mon, 30 Jul 2018 17:32:58 -0400 Received: from perceval.ideasonboard.com ([213.167.242.64]:43290 "EHLO perceval.ideasonboard.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727474AbeG3Vc6 (ORCPT ); Mon, 30 Jul 2018 17:32:58 -0400 Received: from avalon.localnet (dfj612ybrt5fhg77mgycy-3.rev.dnainternet.fi [IPv6:2001:14ba:21f5:5b00:2e86:4862:ef6a:2804]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id D646B1AC2; Mon, 30 Jul 2018 21:56:20 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1532980581; bh=RYbDVTyJAYrDKVeLv7KXFL7hurtLXF7H2eQevnqKMIo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lkbExwWGM3SVlalMh5yxzIHgAz5sOl3MOxVW3PhYEYCal/hibmfJt5ZlSIbRRw5rQ 1axp5fq3u0z4ZghSfhJcg5l7gBeI86VmxeGKb/QsIR+vjW22mBU/3i7PkG6dI3ZbIh Z2YmzjjRCWHlhxATU2xPhGRAsYeA2wIaa+2/xdB8= From: Laurent Pinchart To: Kieran Bingham Cc: linux-media@vger.kernel.org, Guennadi Liakhovetski , Olivier BRAUN , Troy Kisky , Randy Dunlap , Philipp Zabel , Mauro Carvalho Chehab , open list Subject: Re: [PATCH v4 4/6] media: uvcvideo: queue: Simplify spin-lock usage Date: Mon, 30 Jul 2018 22:57:00 +0300 Message-ID: <18698388.LcrgILxgHI@avalon> Organization: Ideas on Board Oy In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Kieran, Thank you for the patch. On Tuesday, 27 March 2018 19:46:01 EEST Kieran Bingham wrote: > 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: Kieran Bingham > > --- > > v4: > - Rebase to v4.16 (linux-media/master) > > 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 adcc4928fae4..698d9a5a5aae 100644 > --- a/drivers/media/usb/uvc/uvc_queue.c > +++ b/drivers/media/usb/uvc/uvc_queue.c > @@ -169,7 +169,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; > @@ -178,9 +177,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; > } > @@ -188,14 +187,13 @@ static int uvc_start_streaming(struct vb2_queue *vq, > unsigned int count) static void uvc_stop_streaming(struct vb2_queue *vq) > { > struct uvc_video_queue *queue = vb2_get_drv_priv(vq); > - unsigned long flags; > > if (vq->type != V4L2_BUF_TYPE_META_CAPTURE) > 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); > - spin_unlock_irqrestore(&queue->irqlock, flags); > + spin_unlock_irq(&queue->irqlock); > } I think you missed my comment that stated > Please add a one-line comment above both functions to state > > /* Must be called with interrupts enabled. */ Philipp Zabel commented that you could also add lockdep_assert_irqs_enabled(), and I think that's a good idea. I'll let you decide whether to do both, or only add lockdep_assert_irqs_enabled(), I'm fine with either option. With this fixed, Reviewed-by: Laurent Pinchart > static const struct vb2_ops uvc_queue_qops = { -- Regards, Laurent Pinchart