Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp5427862img; Wed, 27 Mar 2019 08:20:00 -0700 (PDT) X-Google-Smtp-Source: APXvYqysouRRcnzQsSOYjMvk6+88Bt+Q4cPeIP0I9biD5B1x9ECcUa7CBGtXeUc+s+X401iS957D X-Received: by 2002:a65:624a:: with SMTP id q10mr7897156pgv.435.1553700000894; Wed, 27 Mar 2019 08:20:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553700000; cv=none; d=google.com; s=arc-20160816; b=GDce/o4pgmAGXmbIXBVac3Xs1piOEwIiRjMCbDQDgIUVObFVhXpzfCYNJDLnTTra+7 9gnHMahIH3Rd1J6B2RRCo8MyJ/eGVVHkzzfJPYO8EoOwzhLOMqGBBQLu49BAkCQzDccH sIX8ulEp2dWs26hVbmvAyNyWTlslRwrO1b0TJPiRnsrrVA+ZRCD5QY3JztZHskyVsScb mznGhOpKUpyzUgVGjb5pjT4FSZl0Og1aVMFK5Yt4cWOs5i6YtQiIGloArpZFxLOTgAIr skF/1NRPEul00Cv5K9CqhfQAx1HHJy4YiFLwNxrLR/alI7iAxRXKwEnl85AMu7y2dlaA cwRw== 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:message-id:date:subject:cc:to:from; bh=nmWEQ/6yxEZZWL3NiUL0q2g85EZa4Xrdnot4Y9cJ9J4=; b=eRpMQroSck5nWmogU/OkQ2rTZ92U2YnGimrAWcegrRFT/A/06DifPzWfRiOthVdBJd 4CI+2eA/T90angq/gLVyEFhrRkPmqvB4D9NYrtX02h6nls/5Dr/ToJXBAPN38S/GkkpE yeTnQYwnU1SGjTQUpPeVtqnWNyPLFHhRfz5abCYowzEiJ8CBmG2dzkzKIf9RRQKO1kiV GxPsuWwNFfl6YZXKKTJbEtfPj6CZ3gLZSV04UqnO0kDXc0UazmRbkZoF2pCAKd8+VRRO 0nWP7QgO3KiUSDLI1CEz507bglBYh6T+DMiiDQxRBOGcCGK3d2rr5BNPqsryZjC20V3b ZvpQ== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f7si18108456pgo.569.2019.03.27.08.19.45; Wed, 27 Mar 2019 08:20:00 -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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729921AbfC0PS7 (ORCPT + 99 others); Wed, 27 Mar 2019 11:18:59 -0400 Received: from bhuna.collabora.co.uk ([46.235.227.227]:48478 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725764AbfC0PS6 (ORCPT ); Wed, 27 Mar 2019 11:18:58 -0400 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: tonyk) with ESMTPSA id 27CA0281FF5 From: =?UTF-8?q?Andr=C3=A9=20Almeida?= To: linux-media@vger.kernel.org Cc: mchehab@kernel.org, hverkuil@xs4all.nl, helen.koike@collabora.com, lucmaga@gmail.com, linux-kernel@vger.kernel.org, kernel@collabora.com, lkcamp@lists.libreplanetbr.org Subject: [PATCH v2 02/15] media: vimc: Remove unnecessary stream checks Date: Wed, 27 Mar 2019 12:17:30 -0300 Message-Id: <20190327151743.18528-3-andrealmeid@collabora.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190327151743.18528-1-andrealmeid@collabora.com> References: <20190327151743.18528-1-andrealmeid@collabora.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Change the way subdevices check if the stream is running. Verify the stream pointer instead of src_frame. This makes easier to get rid of the void* and u8* in the subdevices structs. Also, remove redundant checks for stream. Signed-off-by: André Almeida --- Changes in v2: - Squashed commits that remove unnecessary checks together - Reworded commit message drivers/media/platform/vimc/vimc-debayer.c | 5 +---- drivers/media/platform/vimc/vimc-scaler.c | 7 ++----- drivers/media/platform/vimc/vimc-sensor.c | 6 +----- 3 files changed, 4 insertions(+), 14 deletions(-) diff --git a/drivers/media/platform/vimc/vimc-debayer.c b/drivers/media/platform/vimc/vimc-debayer.c index 419ad57a4f5c..613b7abbe06e 100644 --- a/drivers/media/platform/vimc/vimc-debayer.c +++ b/drivers/media/platform/vimc/vimc-debayer.c @@ -270,7 +270,7 @@ static int vimc_deb_set_fmt(struct v4l2_subdev *sd, if (fmt->which == V4L2_SUBDEV_FORMAT_ACTIVE) { /* Do not change the format while stream is on */ - if (vdeb->src_frame) + if (vdeb->ved.stream) return -EBUSY; sink_fmt = &vdeb->sink_fmt; @@ -337,9 +337,6 @@ static int vimc_deb_s_stream(struct v4l2_subdev *sd, int enable) const struct v4l2_format_info *pix_info; unsigned int frame_size; - if (vdeb->src_frame) - return 0; - /* We only support translating bayer to RGB24 */ if (src_pixelformat != V4L2_PIX_FMT_RGB24) { dev_err(vdeb->dev, diff --git a/drivers/media/platform/vimc/vimc-scaler.c b/drivers/media/platform/vimc/vimc-scaler.c index f15542920bdc..8544c745c6e6 100644 --- a/drivers/media/platform/vimc/vimc-scaler.c +++ b/drivers/media/platform/vimc/vimc-scaler.c @@ -158,7 +158,7 @@ static int vimc_sca_set_fmt(struct v4l2_subdev *sd, if (fmt->which == V4L2_SUBDEV_FORMAT_ACTIVE) { /* Do not change the format while stream is on */ - if (vsca->src_frame) + if (vsca->ved.stream) return -EBUSY; sink_fmt = &vsca->sink_fmt; @@ -213,9 +213,6 @@ static int vimc_sca_s_stream(struct v4l2_subdev *sd, int enable) const struct v4l2_format_info *pix_info; unsigned int frame_size; - if (vsca->src_frame) - return 0; - if (!vimc_sca_is_pixfmt_supported(pixelformat)) { dev_err(vsca->dev, "pixfmt (%s) is not supported\n", v4l2_get_fourcc_name(pixelformat)); @@ -337,7 +334,7 @@ static void *vimc_sca_process_frame(struct vimc_ent_device *ved, ved); /* If the stream in this node is not active, just return */ - if (!vsca->src_frame) + if (!ved->stream) return ERR_PTR(-EINVAL); vimc_sca_fill_src_frame(vsca, sink_frame); diff --git a/drivers/media/platform/vimc/vimc-sensor.c b/drivers/media/platform/vimc/vimc-sensor.c index 081e54204c9f..1b2b75b27952 100644 --- a/drivers/media/platform/vimc/vimc-sensor.c +++ b/drivers/media/platform/vimc/vimc-sensor.c @@ -141,7 +141,7 @@ static int vimc_sen_set_fmt(struct v4l2_subdev *sd, if (fmt->which == V4L2_SUBDEV_FORMAT_ACTIVE) { /* Do not change the format while stream is on */ - if (vsen->frame) + if (vsen->ved.stream) return -EBUSY; mf = &vsen->mbus_format; @@ -197,10 +197,6 @@ static int vimc_sen_s_stream(struct v4l2_subdev *sd, int enable) const struct v4l2_format_info *pix_info; unsigned int frame_size; - if (vsen->kthread_sen) - /* tpg is already executing */ - return 0; - /* Calculate the frame size */ pix_info = v4l2_format_info(pixelformat); frame_size = vsen->mbus_format.width * pix_info->bpp[0] * -- 2.21.0