From patchwork Mon Jun 19 11:27:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 92604 Received: from vger.kernel.org ([23.128.96.18]) by www.linuxtv.org with esmtp (Exim 4.92) (envelope-from ) id 1qBD2h-004jgg-8R; Mon, 19 Jun 2023 11:27:31 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231420AbjFSL12 (ORCPT + 1 other); Mon, 19 Jun 2023 07:27:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46602 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230293AbjFSL11 (ORCPT ); Mon, 19 Jun 2023 07:27:27 -0400 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7ACD810F; Mon, 19 Jun 2023 04:27:25 -0700 (PDT) Received: from desky.lan (91-154-35-171.elisa-laajakaista.fi [91.154.35.171]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 3D59AFB; Mon, 19 Jun 2023 13:26:49 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1687174009; bh=SKZE2foAuEiJpM0lv3kNXoNAKjM6FsyDumDBcf61Xvs=; h=From:To:Cc:Subject:Date:From; b=ZF1xhfol2ETOAkBHuhR8/KeNPrD0+8aql8U32pZdWdmLtitmvbN4/Ts/ld3X49toj bsV/UKVz4R3t7OB11GHOwHoZYDQntwySGsdDPALi8WSBW0tjWr1OCMpePzXtZi/Kj2 W1ddrcCS0M/mRKUHjd8D2tehqnxQneYVwKyOu+tY= From: Tomi Valkeinen To: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Mauro Carvalho Chehab , Sakari Ailus , Laurent Pinchart , Jacopo Mondi Cc: Tomi Valkeinen Subject: [PATCH 1/3] media: subdev: Drop implicit zeroing of stream field Date: Mon, 19 Jun 2023 14:27:05 +0300 Message-Id: <20230619112707.239565-1-tomi.valkeinen@ideasonboard.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS, 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-media@vger.kernel.org X-LSpam-Score: -4.8 (----) X-LSpam-Report: No, score=-4.8 required=5.0 tests=BAYES_00=-1.9,DKIM_SIGNED=0.1,DKIM_VALID=-0.1,DKIM_VALID_AU=-0.1,HEADER_FROM_DIFFERENT_DOMAINS=0.5,MAILING_LIST_MULTI=-1,RCVD_IN_DNSWL_MED=-2.3 autolearn=ham autolearn_force=no Now that the kernel drivers have been fixed to initialize the stream field, and we have the client capability which the userspace uses to say it has initialized the stream field, we can drop the implicit zeroing of the stream field in the various check functions. Signed-off-by: Tomi Valkeinen Reviewed-by: Jacopo Mondi --- drivers/media/v4l2-core/v4l2-subdev.c | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/drivers/media/v4l2-core/v4l2-subdev.c b/drivers/media/v4l2-core/v4l2-subdev.c index 2ec179cd1264..c1ac6d7a63d2 100644 --- a/drivers/media/v4l2-core/v4l2-subdev.c +++ b/drivers/media/v4l2-core/v4l2-subdev.c @@ -200,9 +200,6 @@ static inline int check_format(struct v4l2_subdev *sd, if (!format) return -EINVAL; - if (!(sd->flags & V4L2_SUBDEV_FL_STREAMS)) - format->stream = 0; - return check_which(format->which) ? : check_pad(sd, format->pad) ? : check_state(sd, state, format->which, format->pad, format->stream); } @@ -230,9 +227,6 @@ static int call_enum_mbus_code(struct v4l2_subdev *sd, if (!code) return -EINVAL; - if (!(sd->flags & V4L2_SUBDEV_FL_STREAMS)) - code->stream = 0; - return check_which(code->which) ? : check_pad(sd, code->pad) ? : check_state(sd, state, code->which, code->pad, code->stream) ? : sd->ops->pad->enum_mbus_code(sd, state, code); @@ -245,9 +239,6 @@ static int call_enum_frame_size(struct v4l2_subdev *sd, if (!fse) return -EINVAL; - if (!(sd->flags & V4L2_SUBDEV_FL_STREAMS)) - fse->stream = 0; - return check_which(fse->which) ? : check_pad(sd, fse->pad) ? : check_state(sd, state, fse->which, fse->pad, fse->stream) ? : sd->ops->pad->enum_frame_size(sd, state, fse); @@ -283,9 +274,6 @@ static int call_enum_frame_interval(struct v4l2_subdev *sd, if (!fie) return -EINVAL; - if (!(sd->flags & V4L2_SUBDEV_FL_STREAMS)) - fie->stream = 0; - return check_which(fie->which) ? : check_pad(sd, fie->pad) ? : check_state(sd, state, fie->which, fie->pad, fie->stream) ? : sd->ops->pad->enum_frame_interval(sd, state, fie); @@ -298,9 +286,6 @@ static inline int check_selection(struct v4l2_subdev *sd, if (!sel) return -EINVAL; - if (!(sd->flags & V4L2_SUBDEV_FL_STREAMS)) - sel->stream = 0; - return check_which(sel->which) ? : check_pad(sd, sel->pad) ? : check_state(sd, state, sel->which, sel->pad, sel->stream); } From patchwork Mon Jun 19 11:27:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 92603 Received: from vger.kernel.org ([23.128.96.18]) by www.linuxtv.org with esmtp (Exim 4.92) (envelope-from ) id 1qBD2g-004jgg-5d; Mon, 19 Jun 2023 11:27:30 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231342AbjFSL11 (ORCPT + 1 other); Mon, 19 Jun 2023 07:27:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46604 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230311AbjFSL11 (ORCPT ); Mon, 19 Jun 2023 07:27:27 -0400 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E68B4113; Mon, 19 Jun 2023 04:27:25 -0700 (PDT) Received: from desky.lan (91-154-35-171.elisa-laajakaista.fi [91.154.35.171]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 19B36547; Mon, 19 Jun 2023 13:26:50 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1687174010; bh=vKoVEh8/BVZ6bIy/hlGDIh7J4gLuFZr4qI4O6tce2iI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HjZjo4QG3nRjoqquQPe5bfdbkA0Xmvxu7yuKfqGthGc3bq6IA8xHcAzqdb9rOWX+e AhmLPyGjc1Tu/c/1dRXsXfp8LzsA7T377g5X2dANXTsCondZTP0Z7g4XK7kQ+WxYjd RZ8vcIA1cloPOrcC34vqnWeB0bWj0YXnNsZAWPrQ= From: Tomi Valkeinen To: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Mauro Carvalho Chehab , Sakari Ailus , Laurent Pinchart , Jacopo Mondi Cc: Tomi Valkeinen Subject: [PATCH 2/3] media: subdev: Constify v4l2_subdev_set_routing_with_fmt() param Date: Mon, 19 Jun 2023 14:27:06 +0300 Message-Id: <20230619112707.239565-2-tomi.valkeinen@ideasonboard.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230619112707.239565-1-tomi.valkeinen@ideasonboard.com> References: <20230619112707.239565-1-tomi.valkeinen@ideasonboard.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS, 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-media@vger.kernel.org X-LSpam-Score: -4.8 (----) X-LSpam-Report: No, score=-4.8 required=5.0 tests=BAYES_00=-1.9,DKIM_SIGNED=0.1,DKIM_VALID=-0.1,DKIM_VALID_AU=-0.1,HEADER_FROM_DIFFERENT_DOMAINS=0.5,MAILING_LIST_MULTI=-1,RCVD_IN_DNSWL_MED=-2.3 autolearn=ham autolearn_force=no The routing parameter of v4l2_subdev_set_routing_with_fmt() is missing 'const'. Add it. Signed-off-by: Tomi Valkeinen Reviewed-by: Jacopo Mondi --- drivers/media/v4l2-core/v4l2-subdev.c | 2 +- include/media/v4l2-subdev.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/media/v4l2-core/v4l2-subdev.c b/drivers/media/v4l2-core/v4l2-subdev.c index c1ac6d7a63d2..73f716a42569 100644 --- a/drivers/media/v4l2-core/v4l2-subdev.c +++ b/drivers/media/v4l2-core/v4l2-subdev.c @@ -1590,7 +1590,7 @@ EXPORT_SYMBOL_GPL(__v4l2_subdev_next_active_route); int v4l2_subdev_set_routing_with_fmt(struct v4l2_subdev *sd, struct v4l2_subdev_state *state, - struct v4l2_subdev_krouting *routing, + const struct v4l2_subdev_krouting *routing, const struct v4l2_mbus_framefmt *fmt) { struct v4l2_subdev_stream_configs *stream_configs; diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h index b325df0d54d6..ca0bacb88537 100644 --- a/include/media/v4l2-subdev.h +++ b/include/media/v4l2-subdev.h @@ -1532,7 +1532,7 @@ __v4l2_subdev_next_active_route(const struct v4l2_subdev_krouting *routing, */ int v4l2_subdev_set_routing_with_fmt(struct v4l2_subdev *sd, struct v4l2_subdev_state *state, - struct v4l2_subdev_krouting *routing, + const struct v4l2_subdev_krouting *routing, const struct v4l2_mbus_framefmt *fmt); /** From patchwork Mon Jun 19 11:27:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 92605 Received: from vger.kernel.org ([23.128.96.18]) by www.linuxtv.org with esmtp (Exim 4.92) (envelope-from ) id 1qBD2i-004jgg-6f; Mon, 19 Jun 2023 11:27:32 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231494AbjFSL1a (ORCPT + 1 other); Mon, 19 Jun 2023 07:27:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46614 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229932AbjFSL13 (ORCPT ); Mon, 19 Jun 2023 07:27:29 -0400 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6CC9F100; Mon, 19 Jun 2023 04:27:28 -0700 (PDT) Received: from desky.lan (91-154-35-171.elisa-laajakaista.fi [91.154.35.171]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id DB887800; Mon, 19 Jun 2023 13:26:50 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1687174011; bh=Ua5NcitkYLYSqBnLZDqy7P/dMOR9PahCDNt3nwt7wFM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZNHpJMwzDW3Z/m/Niqez8UbbEjXIXS1IOOiQTnROmHWVPt55Owh09Fnz6j/ytirh8 ePGHkqMzS3byVpgXkvJF6NcpS3kxhtDEknarMnldYRYtA6LqlZuLwWOGB3sFlhaJcb WE0zJE+/WWHvQMbci4olFIHpTO3mrfKBxzj16AFM= From: Tomi Valkeinen To: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Mauro Carvalho Chehab , Sakari Ailus , Laurent Pinchart , Jacopo Mondi Cc: Tomi Valkeinen Subject: [PATCH 3/3] media: subdev: Add debug prints to enable/disable_streams Date: Mon, 19 Jun 2023 14:27:07 +0300 Message-Id: <20230619112707.239565-3-tomi.valkeinen@ideasonboard.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230619112707.239565-1-tomi.valkeinen@ideasonboard.com> References: <20230619112707.239565-1-tomi.valkeinen@ideasonboard.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS, 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-media@vger.kernel.org X-LSpam-Score: -4.8 (----) X-LSpam-Report: No, score=-4.8 required=5.0 tests=BAYES_00=-1.9,DKIM_SIGNED=0.1,DKIM_VALID=-0.1,DKIM_VALID_AU=-0.1,HEADER_FROM_DIFFERENT_DOMAINS=0.5,MAILING_LIST_MULTI=-1,RCVD_IN_DNSWL_MED=-2.3 autolearn=ham autolearn_force=no It is often useful to see when streaming for a device is being enabled or disabled. Add debug prints for this to v4l2_subdev_enable_streams() and v4l2_subdev_disable_streams(). Signed-off-by: Tomi Valkeinen Reviewed-by: Jacopo Mondi --- drivers/media/v4l2-core/v4l2-subdev.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/drivers/media/v4l2-core/v4l2-subdev.c b/drivers/media/v4l2-core/v4l2-subdev.c index 73f716a42569..0f86a165b202 100644 --- a/drivers/media/v4l2-core/v4l2-subdev.c +++ b/drivers/media/v4l2-core/v4l2-subdev.c @@ -1977,11 +1977,16 @@ int v4l2_subdev_enable_streams(struct v4l2_subdev *sd, u32 pad, goto done; } + dev_dbg(dev, "enable streams %u:%#llx\n", pad, streams_mask); + /* Call the .enable_streams() operation. */ ret = v4l2_subdev_call(sd, pad, enable_streams, state, pad, streams_mask); - if (ret) + if (ret) { + dev_dbg(dev, "enable streams %u:%#llx failed: %d\n", pad, + streams_mask, ret); goto done; + } /* Mark the streams as enabled. */ for (i = 0; i < state->stream_configs.num_configs; ++i) { @@ -2089,11 +2094,16 @@ int v4l2_subdev_disable_streams(struct v4l2_subdev *sd, u32 pad, goto done; } + dev_dbg(dev, "disable streams %u:%#llx\n", pad, streams_mask); + /* Call the .disable_streams() operation. */ ret = v4l2_subdev_call(sd, pad, disable_streams, state, pad, streams_mask); - if (ret) + if (ret) { + dev_dbg(dev, "disable streams %u:%#llx failed: %d\n", pad, + streams_mask, ret); goto done; + } /* Mark the streams as disabled. */ for (i = 0; i < state->stream_configs.num_configs; ++i) {