Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp1616930pxb; Wed, 9 Feb 2022 00:11:47 -0800 (PST) X-Google-Smtp-Source: ABdhPJwl3HZdvsYTgtOjNTekJCJw1C7tZmHzq4zRhqrjUwZ8XNMK9mYjQg4dGa4RS2TtkpTkfDw1 X-Received: by 2002:a17:903:32c2:: with SMTP id i2mr976427plr.55.1644394307526; Wed, 09 Feb 2022 00:11:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644394307; cv=none; d=google.com; s=arc-20160816; b=SZiFCa3t8qPzvYfMK4d1PUp8UMrbTYGLWtss1KliCxRcPV1dDfnBwMEVpZcySJSXT2 r+7OXVZl0xQREs86BgD/QTthholnw966SKHsqEKu7imEgyDQ/cM70v9K/zKc2RHP7UFb 9PezyMb/QpPuKSh4v8BuqU7ug3eGUU9ajtIF5/7Hoy3egMXMFr7/nj5HO53Pz4KB/F9b ZDY+3ONgXKVMQ0TIc5QfYXvCIsyMO/skXCRpsFnvpruS4EZs679qmrRABSUosvR/d1+6 +zWUhjU1a/0yrltHzhJohCTe4gtxyLtOWViobY6uFTBmw4DEe7+Qs7XtTWeEkwUtIgiK 06tQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=VfeLDRAda3aVKgq4zGHwRqzeymLoMq2uAQN8hitEEMI=; b=f9v4y+zOUoxmCr3Ttx4ZWx+ypdyOMHgbOH96qPoL9NMog2k3fQoBRZv0tgZH8B30Hs PsHvJNjMBjtilRQnDO9NKKA9VgeR98uGrcCsLX5awfKllz3hjnR+Inmo9vxRX5KojbIJ F6o/vgAVe3uiY1NxAaskOIdzVOCFgRzIxWitJHOboMSEO+Fua5EG1Hi/g/E4AqOV7QZu y7TwYugHuhrO/ePqcVAhJBcSNb/DcVM8YfwHBitF4x35DCeXWAnApojIV5bdSUYTg+vD 9AfCXLLj1tvTN33k8Dcg5sA/PSeU0yqTqd4JerXdAP9fOpTolCS1njdmdmFrBcQRjl0d Ry9g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 198si15747707pgc.799.2022.02.09.00.11.34; Wed, 09 Feb 2022 00:11:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241450AbiBGKtO (ORCPT + 99 others); Mon, 7 Feb 2022 05:49:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36748 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352721AbiBGKpv (ORCPT ); Mon, 7 Feb 2022 05:45:51 -0500 Received: from relay2-d.mail.gandi.net (relay2-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::222]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E5FFAC043181; Mon, 7 Feb 2022 02:45:49 -0800 (PST) Received: (Authenticated sender: jacopo@jmondi.org) by mail.gandi.net (Postfix) with ESMTPSA id 0B2B840013; Mon, 7 Feb 2022 10:45:45 +0000 (UTC) Date: Mon, 7 Feb 2022 11:46:52 +0100 From: Jacopo Mondi To: Eugen Hristev Cc: robh+dt@kernel.org, linux-media@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, jacopo+renesas@jmondi.org, hverkuil-cisco@xs4all.nl, nicolas.ferre@microchip.com, sakari.ailus@iki.fi, laurent.pinchart@ideasonboard.com, Hans Verkuil Subject: Re: [PATCH v4 01/11] media: atmel: atmel-isc: replace 'stop' variable with vb2 calls Message-ID: <20220207104652.zovthrwpdi5cnvdm@uno.localdomain> References: <20220121131416.603972-1-eugen.hristev@microchip.com> <20220121131416.603972-2-eugen.hristev@microchip.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20220121131416.603972-2-eugen.hristev@microchip.com> X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Eugen, On Fri, Jan 21, 2022 at 03:14:06PM +0200, Eugen Hristev wrote: > The stop variable is redundant as the state of the streaming can be obtained > by calling vb2_start_streaming_called(&isc->vb2_vidq) or by calling > vb2_is_busy(&isc->vb2_vidq). > Thus, remove the stop variable completely. > > Suggested-by: Hans Verkuil > Signed-off-by: Eugen Hristev I trust yours and Hans' judgment here. The patch looks sane Reviewed-by: Jacopo Mondi Thanks > --- > Changes in v4: > - new patch > > drivers/media/platform/atmel/atmel-isc-base.c | 12 +++++------- > drivers/media/platform/atmel/atmel-isc.h | 2 -- > 2 files changed, 5 insertions(+), 9 deletions(-) > > diff --git a/drivers/media/platform/atmel/atmel-isc-base.c b/drivers/media/platform/atmel/atmel-isc-base.c > index db15770d5b88..9c62d0ae7887 100644 > --- a/drivers/media/platform/atmel/atmel-isc-base.c > +++ b/drivers/media/platform/atmel/atmel-isc-base.c > @@ -362,7 +362,6 @@ static int isc_start_streaming(struct vb2_queue *vq, unsigned int count) > spin_lock_irqsave(&isc->dma_queue_lock, flags); > > isc->sequence = 0; > - isc->stop = false; > reinit_completion(&isc->comp); > > isc->cur_frm = list_first_entry(&isc->dma_queue, > @@ -403,8 +402,6 @@ static void isc_stop_streaming(struct vb2_queue *vq) > > v4l2_ctrl_activate(isc->do_wb_ctrl, false); > > - isc->stop = true; > - > /* Wait until the end of the current frame */ > if (isc->cur_frm && !wait_for_completion_timeout(&isc->comp, 5 * HZ)) > v4l2_err(&isc->v4l2_dev, > @@ -1029,7 +1026,7 @@ static int isc_s_fmt_vid_cap(struct file *file, void *priv, > { > struct isc_device *isc = video_drvdata(file); > > - if (vb2_is_streaming(&isc->vb2_vidq)) > + if (vb2_is_busy(&isc->vb2_vidq)) > return -EBUSY; > > return isc_set_fmt(isc, f); > @@ -1236,7 +1233,8 @@ irqreturn_t isc_interrupt(int irq, void *dev_id) > isc->cur_frm = NULL; > } > > - if (!list_empty(&isc->dma_queue) && !isc->stop) { > + if (!list_empty(&isc->dma_queue) && > + vb2_start_streaming_called(&isc->vb2_vidq)) { > isc->cur_frm = list_first_entry(&isc->dma_queue, > struct isc_buffer, list); > list_del(&isc->cur_frm->list); > @@ -1244,7 +1242,7 @@ irqreturn_t isc_interrupt(int irq, void *dev_id) > isc_start_dma(isc); > } > > - if (isc->stop) > + if (!vb2_start_streaming_called(&isc->vb2_vidq)) > complete(&isc->comp); > > ret = IRQ_HANDLED; > @@ -1398,7 +1396,7 @@ static void isc_awb_work(struct work_struct *w) > int ret; > > /* streaming is not active anymore */ > - if (isc->stop) > + if (!vb2_start_streaming_called(&isc->vb2_vidq)) > return; > > if (ctrls->hist_stat != HIST_ENABLED) > diff --git a/drivers/media/platform/atmel/atmel-isc.h b/drivers/media/platform/atmel/atmel-isc.h > index 07fa6dbf8460..5fbf52a9080b 100644 > --- a/drivers/media/platform/atmel/atmel-isc.h > +++ b/drivers/media/platform/atmel/atmel-isc.h > @@ -201,7 +201,6 @@ struct isc_reg_offsets { > * @dma_queue: the queue for dma buffers > * @cur_frm: current isc frame/buffer > * @sequence: current frame number > - * @stop: true if isc is not streaming, false if streaming > * @comp: completion reference that signals frame completion > * > * @fmt: current v42l format > @@ -276,7 +275,6 @@ struct isc_device { > struct list_head dma_queue; > struct isc_buffer *cur_frm; > unsigned int sequence; > - bool stop; > struct completion comp; > > struct v4l2_format fmt; > -- > 2.25.1 >