From: neil.armstrong@linaro.org
To: Vladimir Zapolskiy <vladimir.zapolskiy@linaro.org>,
Robert Foss <rfoss@kernel.org>, Todor Tomov <todor.too@gmail.com>,
Bryan O'Donoghue <bryan.odonoghue@linaro.org>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
Hans Verkuil <hans.verkuil@cisco.com>
Cc: linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org
Subject: Re: [PATCH 7/9] media: qcom: camss: change internals of endpoint parsing to fwnode handling
Date: Mon, 23 Jun 2025 11:29:29 +0200 [thread overview]
Message-ID: <9ff883f4-e7cc-4b2c-8f12-f583ef5182d0@linaro.org> (raw)
In-Reply-To: <20250513142353.2572563-8-vladimir.zapolskiy@linaro.org>
On 13/05/2025 16:23, Vladimir Zapolskiy wrote:
> Since a few called V4L2 functions operate with fwnode arguments the change
> from OF device nodes to fwnodes brings a simplification to the code.
>
> Because camss_probe() as the single caller of camss_of_parse_endpoint_node()
> has no need to know a number of async registered remote devices, it makes
> sense to remove the related computation from it. In addition there is no
> reason to check for a OF device availability on CAMSS side, the check is
> useless as the always passed one.
I think you should explain why it's useless, TBH I'm not even sure why it's
not necessary. What if we set the remote endpoint as disabled, this is
a regression, no ?
Why not replace it with fwnode_device_is_available() and remove it in another
patch really explaining why it's useless ?
Neil
>
> Signed-off-by: Vladimir Zapolskiy <vladimir.zapolskiy@linaro.org>
> ---
> drivers/media/platform/qcom/camss/camss.c | 52 ++++++++++-------------
> 1 file changed, 23 insertions(+), 29 deletions(-)
>
> diff --git a/drivers/media/platform/qcom/camss/camss.c b/drivers/media/platform/qcom/camss/camss.c
> index 39c5472f4552..d4745fb21152 100644
> --- a/drivers/media/platform/qcom/camss/camss.c
> +++ b/drivers/media/platform/qcom/camss/camss.c
> @@ -2973,16 +2973,16 @@ static const struct parent_dev_ops vfe_parent_dev_ops = {
> };
>
> /*
> - * camss_of_parse_endpoint_node - Parse port endpoint node
> - * @dev: Device
> - * @node: Device node to be parsed
> + * camss_parse_endpoint_node - Parse port endpoint node
> + * @dev: CAMSS device
> + * @ep: Device endpoint to be parsed
> * @csd: Parsed data from port endpoint node
> *
> * Return 0 on success or a negative error code on failure
> */
> -static int camss_of_parse_endpoint_node(struct device *dev,
> - struct device_node *node,
> - struct camss_async_subdev *csd)
> +static int camss_parse_endpoint_node(struct device *dev,
> + struct fwnode_handle *ep,
> + struct camss_async_subdev *csd)
> {
> struct csiphy_lanes_cfg *lncfg = &csd->interface.csi2.lane_cfg;
> struct v4l2_mbus_config_mipi_csi2 *mipi_csi2;
> @@ -2990,7 +2990,7 @@ static int camss_of_parse_endpoint_node(struct device *dev,
> unsigned int i;
> int ret;
>
> - ret = v4l2_fwnode_endpoint_parse(of_fwnode_handle(node), &vep);
> + ret = v4l2_fwnode_endpoint_parse(ep, &vep);
> if (ret)
> return ret;
>
> @@ -3025,52 +3025,46 @@ static int camss_of_parse_endpoint_node(struct device *dev,
> }
>
> /*
> - * camss_of_parse_ports - Parse ports node
> - * @dev: Device
> - * @notifier: v4l2_device notifier data
> + * camss_parse_ports - Parse ports node
> + * @dev: CAMSS device
> *
> - * Return number of "port" nodes found in "ports" node
> + * Return 0 on success or a negative error code on failure
> */
> -static int camss_of_parse_ports(struct camss *camss)
> +static int camss_parse_ports(struct camss *camss)
> {
> struct device *dev = camss->dev;
> - struct device_node *node = NULL;
> - struct device_node *remote = NULL;
> - int ret, num_subdevs = 0;
> + struct fwnode_handle *fwnode = dev_fwnode(dev), *ep;
> + int ret;
>
> - for_each_endpoint_of_node(dev->of_node, node) {
> + fwnode_graph_for_each_endpoint(fwnode, ep) {
> struct camss_async_subdev *csd;
> + struct fwnode_handle *remote;
>
> - if (!of_device_is_available(node))
> - continue;
> -
> - remote = of_graph_get_remote_port_parent(node);
> + remote = fwnode_graph_get_remote_port_parent(ep);
> if (!remote) {
> dev_err(dev, "Cannot get remote parent\n");
> ret = -EINVAL;
> goto err_cleanup;
> }
>
> - csd = v4l2_async_nf_add_fwnode(&camss->notifier,
> - of_fwnode_handle(remote),
> + csd = v4l2_async_nf_add_fwnode(&camss->notifier, remote,
> struct camss_async_subdev);
> - of_node_put(remote);
> + fwnode_handle_put(remote);
> if (IS_ERR(csd)) {
> ret = PTR_ERR(csd);
> goto err_cleanup;
> }
>
> - ret = camss_of_parse_endpoint_node(dev, node, csd);
> + ret = camss_parse_endpoint_node(dev, ep, csd);
> if (ret < 0)
> goto err_cleanup;
> -
> - num_subdevs++;
> }
>
> - return num_subdevs;
> + return 0;
>
> err_cleanup:
> - of_node_put(node);
> + fwnode_handle_put(ep);
> +
> return ret;
> }
>
> @@ -3626,7 +3620,7 @@ static int camss_probe(struct platform_device *pdev)
>
> pm_runtime_enable(dev);
>
> - ret = camss_of_parse_ports(camss);
> + ret = camss_parse_ports(camss);
> if (ret < 0)
> goto err_v4l2_device_unregister;
>
next prev parent reply other threads:[~2025-06-23 9:29 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-13 14:23 [PATCH 0/9] media: qcom: camss: a number of cleanups and fixes Vladimir Zapolskiy
2025-05-13 14:23 ` [PATCH 1/9] media: qcom: camss: cleanup media device allocated resource on error path Vladimir Zapolskiy
2025-06-13 15:36 ` Bryan O'Donoghue
2025-05-13 14:23 ` [PATCH 2/9] media: qcom: camss: remove duplicated csiphy_formats_sc7280 data Vladimir Zapolskiy
2025-05-13 16:30 ` Bryan O'Donoghue
2025-05-13 14:23 ` [PATCH 3/9] media: qcom: camss: remove .link_entities Vladimir Zapolskiy
2025-05-13 16:29 ` Bryan O'Donoghue
2025-05-13 14:23 ` [PATCH 4/9] media: qcom: camss: register camss media device before subdevices Vladimir Zapolskiy
2025-06-13 9:06 ` Bryan O'Donoghue
2025-06-17 16:14 ` Vladimir Zapolskiy
2025-06-23 9:24 ` neil.armstrong
2025-05-13 14:23 ` [PATCH 5/9] media: qcom: camss: unconditionally set async notifier of subdevices Vladimir Zapolskiy
2025-05-13 15:46 ` Bryan O'Donoghue
2025-05-14 15:16 ` Vladimir Zapolskiy
2025-05-15 9:25 ` Loic Poulain
2025-06-13 9:11 ` Bryan O'Donoghue
2025-06-17 16:22 ` Vladimir Zapolskiy
2025-06-23 9:26 ` neil.armstrong
2025-05-13 14:23 ` [PATCH 6/9] media: qcom: camss: simplify camss_subdev_notifier_complete() function Vladimir Zapolskiy
2025-06-13 9:13 ` Bryan O'Donoghue
2025-05-13 14:23 ` [PATCH 7/9] media: qcom: camss: change internals of endpoint parsing to fwnode handling Vladimir Zapolskiy
2025-06-13 9:30 ` Bryan O'Donoghue
2025-06-17 16:30 ` Vladimir Zapolskiy
2025-06-23 9:29 ` neil.armstrong [this message]
2025-06-23 12:00 ` Vladimir Zapolskiy
2025-05-13 14:23 ` [PATCH 8/9] media: qcom: camss: use a handy v4l2_async_nf_add_fwnode_remote() function Vladimir Zapolskiy
2025-05-13 14:23 ` [PATCH 9/9] MAINTAINERS: add myself as a CAMSS patch reviewer Vladimir Zapolskiy
2025-05-13 15:06 ` Bryan O'Donoghue
2025-06-06 10:52 ` [PATCH 0/9] media: qcom: camss: a number of cleanups and fixes Vladimir Zapolskiy
2025-06-10 17:26 ` Vladimir Zapolskiy
2025-06-10 18:53 ` Bryan O'Donoghue
2025-06-10 21:15 ` Vladimir Zapolskiy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=9ff883f4-e7cc-4b2c-8f12-f583ef5182d0@linaro.org \
--to=neil.armstrong@linaro.org \
--cc=bryan.odonoghue@linaro.org \
--cc=hans.verkuil@cisco.com \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=rfoss@kernel.org \
--cc=todor.too@gmail.com \
--cc=vladimir.zapolskiy@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).