Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp1392714pxb; Fri, 21 Jan 2022 17:28:18 -0800 (PST) X-Google-Smtp-Source: ABdhPJyDKtjRWc6wSAsvuYe8xlE65mWhopJeoOk7RsR64wm4Vs/SI86zVutxs/NFVjJJp9VE0ifu X-Received: by 2002:a17:902:bd05:b0:148:a2f7:9d87 with SMTP id p5-20020a170902bd0500b00148a2f79d87mr6005576pls.166.1642814898756; Fri, 21 Jan 2022 17:28:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1642814898; cv=none; d=google.com; s=arc-20160816; b=GlD2FvKSnKegR82HDn/WWlY9drWbqgHCOLQ3+zo+wIbDmSRtYVsex/zhKOSjDEwFDD IqRnMBT1m0tMtZDWfz7EGF81EjF63DpIaOB+2KAsT+kCdMCf5+wnGLTKwdX8mghmaEmz 8Ff0UYeaIygIB/nO5IAuc7PjrqihLeTxJbMxQnKbUK8st7id73f171yW4AtZ7mMZWc8G tYOZn9RGLEIoBD7zdr1RxFX6TS7VLs8ZSIGVRzBDLgVyLVnf3s0ety40nHNvfzlGDru/ yzI7HfPSmj4sL/v+3CpFhfYqXumPl31Z+9Ey8j4phXS0ZQvYMnbVH7No80cx24UaD3dq OUXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :ironport-sdr:dkim-signature; bh=m+HwfzGGyoZB9PUk2Y6BLl//QZXI61qq8/KiM0UNmcU=; b=fmRmalEynIfKFfATKe5Y1jdSc84r9abrY9xb782w5xda51KiYFv8ZEqbJkXBzdmfiU Jl1azKgEKcf+KVunqqC/lBFR3f8ay3td7Q2t7es0Bb1uejO07E1AecYo27ZjjvPV5ueu eR3yadD+0Rda+TCFPL3FDoi01up4ZP4UpSVzlBsl829INLCFFqFAhfDLFTBZQwppxS6/ HCknJNcwb8ZmwkqtqWQ7Dx+F9BQp/Npjz/PvV5toc11XFvJNXAKpCJ8AF7FB7HNryCLY TcZnI9pMcvFUDHADVczu/HTnuG5tItt8+PjAw/vGXlHsQ+FIbkJFmVPNVwQvUBxwe07L e5/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@microchip.com header.s=mchp header.b=AopBZ1SW; 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; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v15si8329842pgq.418.2022.01.21.17.28.07; Fri, 21 Jan 2022 17:28:18 -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; dkim=fail header.i=@microchip.com header.s=mchp header.b=AopBZ1SW; 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; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1380571AbiAUNOx (ORCPT + 99 others); Fri, 21 Jan 2022 08:14:53 -0500 Received: from esa.microchip.iphmx.com ([68.232.154.123]:17292 "EHLO esa.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380564AbiAUNOw (ORCPT ); Fri, 21 Jan 2022 08:14:52 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1642770892; x=1674306892; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=BYYXVCKs1JCrJsDzDJXziUYTB89mGKLgyoq8H+1C8Qk=; b=AopBZ1SWp3xlI99vhK4YX3SwsOyBJvhM/FyDPDiw3VIGIQzvmMb7v6To NnROq3w7BaQO6+AV72qFDjljy1OdH6tTepLOq2ufae7o5bxGkGCADEu/0 fttW9G132Ey7j8Vv9O1GOdgV8pKFCEqg8NBBhl4fo1+Zo0wKHvCfrU0+Z vwxwjtRiTMRswnCC2LpbXkxuRT+L7QSKwGmsS4NiJUoaEijQRMcRl3Nno pLxtUmqkcEKZsSsmPP/nhAkApRS0JN2xalFHNnRdipsZRsZyEeingPb3V lYeVM17ucD5QDXR2drZfYtzrAV2kE0JDStL86EJlcxkXWvL5TvVpdzEIE Q==; IronPort-SDR: poy7PptaPgGUdsUQgNjNBOK8se4QIPy8Vf4QOSi1iZcl+fUyd7WL7h5pas/XJj1gNyc7v+xNm5 WttFiHymCQmVUomj7MLCraaZ03Qteg6woXEC8vIJTrfZ3RxbL69OiHOUIeDxZh0RL3BUjG8jIy WwWG6wueN4ROGNGPH6EyuKEy1sqcs6fMXQ6X+TpsQSt/yX3mQgNPCMEzVXm5iNlb38bT4pNV6v 9CywHuKbsrR63sKuEioyh2VFZNjWvAKqL69N+gJQ+xGNUNY7t9DcsBVhzD4qAfDGNdTnAaJsGT 0+sa1MH6vmGkIQqTD1JW7tNx X-IronPort-AV: E=Sophos;i="5.88,304,1635231600"; d="scan'208";a="146183353" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa2.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 21 Jan 2022 06:14:51 -0700 Received: from chn-vm-ex04.mchp-main.com (10.10.85.152) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.17; Fri, 21 Jan 2022 06:14:50 -0700 Received: from ROB-ULT-M18282.microchip.com (10.10.115.15) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server id 15.1.2375.17 via Frontend Transport; Fri, 21 Jan 2022 06:14:42 -0700 From: Eugen Hristev To: , , , , , , CC: , , , Eugen Hristev , Hans Verkuil Subject: [PATCH v4 01/11] media: atmel: atmel-isc: replace 'stop' variable with vb2 calls Date: Fri, 21 Jan 2022 15:14:06 +0200 Message-ID: <20220121131416.603972-2-eugen.hristev@microchip.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220121131416.603972-1-eugen.hristev@microchip.com> References: <20220121131416.603972-1-eugen.hristev@microchip.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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