All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tomi Valkeinen <tomi.valkeinen@ti.com>
To: Philipp Zabel <p.zabel@pengutronix.de>
Cc: Grant Likely <grant.likely@linaro.org>,
	Mauro Carvalho Chehab <m.chehab@samsung.com>,
	Russell King - ARM Linux <linux@arm.linux.org.uk>,
	Rob Herring <robh+dt@kernel.org>,
	Sylwester Nawrocki <s.nawrocki@samsung.com>,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	Guennadi Liakhovetski <g.liakhovetski@gmx.de>,
	Kyungmin Park <kyungmin.park@samsung.com>,
	linux-kernel@vger.kernel.org, linux-media@vger.kernel.org,
	devicetree@vger.kernel.org
Subject: Re: [PATCH v5 6/7] of: Implement simplified graph binding for single port devices
Date: Tue, 4 Mar 2014 11:06:25 +0200	[thread overview]
Message-ID: <53159791.5080205@ti.com> (raw)
In-Reply-To: <1393522540-22887-7-git-send-email-p.zabel@pengutronix.de>

[-- Attachment #1: Type: text/plain, Size: 1082 bytes --]

On 27/02/14 19:35, Philipp Zabel wrote:
> For simple devices with only one port, it can be made implicit.
> The endpoint node can be a direct child of the device node.

<snip>

> @@ -2105,9 +2112,11 @@ struct device_node *of_graph_get_remote_port_parent(
>  	/* Get remote endpoint node. */
>  	np = of_parse_phandle(node, "remote-endpoint", 0);
>  
> -	/* Walk 3 levels up only if there is 'ports' node. */
> +	/* Walk 3 levels up only if there is 'ports' node */
>  	for (depth = 3; depth && np; depth--) {
>  		np = of_get_next_parent(np);
> +		if (depth == 3 && of_node_cmp(np->name, "port"))
> +			break;
>  		if (depth == 2 && of_node_cmp(np->name, "ports"))
>  			break;
>  	}

This function becomes a bit funny. Would it be clearer just to do
something like:

	np = of_parse_phandle(node, "remote-endpoint", 0);

	np = of_get_next_parent(np);
	if (of_node_cmp(np->name, "port") != 0)
		return np;

	np = of_get_next_parent(np);
	if (of_node_cmp(np->name, "ports") != 0)
		return np;

	np = of_get_next_parent(np);
	return np;

 Tomi



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 901 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: Tomi Valkeinen <tomi.valkeinen@ti.com>
To: Philipp Zabel <p.zabel@pengutronix.de>
Cc: Grant Likely <grant.likely@linaro.org>,
	Mauro Carvalho Chehab <m.chehab@samsung.com>,
	Russell King - ARM Linux <linux@arm.linux.org.uk>,
	Rob Herring <robh+dt@kernel.org>,
	Sylwester Nawrocki <s.nawrocki@samsung.com>,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	Guennadi Liakhovetski <g.liakhovetski@gmx.de>,
	Kyungmin Park <kyungmin.park@samsung.com>,
	<linux-kernel@vger.kernel.org>, <linux-media@vger.kernel.org>,
	<devicetree@vger.kernel.org>
Subject: Re: [PATCH v5 6/7] of: Implement simplified graph binding for single port devices
Date: Tue, 4 Mar 2014 11:06:25 +0200	[thread overview]
Message-ID: <53159791.5080205@ti.com> (raw)
In-Reply-To: <1393522540-22887-7-git-send-email-p.zabel@pengutronix.de>

[-- Attachment #1: Type: text/plain, Size: 1082 bytes --]

On 27/02/14 19:35, Philipp Zabel wrote:
> For simple devices with only one port, it can be made implicit.
> The endpoint node can be a direct child of the device node.

<snip>

> @@ -2105,9 +2112,11 @@ struct device_node *of_graph_get_remote_port_parent(
>  	/* Get remote endpoint node. */
>  	np = of_parse_phandle(node, "remote-endpoint", 0);
>  
> -	/* Walk 3 levels up only if there is 'ports' node. */
> +	/* Walk 3 levels up only if there is 'ports' node */
>  	for (depth = 3; depth && np; depth--) {
>  		np = of_get_next_parent(np);
> +		if (depth == 3 && of_node_cmp(np->name, "port"))
> +			break;
>  		if (depth == 2 && of_node_cmp(np->name, "ports"))
>  			break;
>  	}

This function becomes a bit funny. Would it be clearer just to do
something like:

	np = of_parse_phandle(node, "remote-endpoint", 0);

	np = of_get_next_parent(np);
	if (of_node_cmp(np->name, "port") != 0)
		return np;

	np = of_get_next_parent(np);
	if (of_node_cmp(np->name, "ports") != 0)
		return np;

	np = of_get_next_parent(np);
	return np;

 Tomi



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 901 bytes --]

  reply	other threads:[~2014-03-04  9:06 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-27 17:35 [PATCH v5 0/7] Move device tree graph parsing helpers to drivers/of Philipp Zabel
2014-02-27 17:35 ` [PATCH v5 1/7] [media] of: move graph helpers from drivers/media/v4l2-core " Philipp Zabel
     [not found] ` <1393522540-22887-1-git-send-email-p.zabel-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2014-02-27 17:35   ` [PATCH v5 2/7] Documentation: of: Document graph bindings Philipp Zabel
2014-02-27 17:35     ` Philipp Zabel
2014-02-28 21:08     ` Sylwester Nawrocki
2014-03-04 10:16       ` Philipp Zabel
2014-02-27 17:35 ` [PATCH v5 3/7] of: Warn if of_graph_get_next_endpoint is called with the root node Philipp Zabel
2014-02-28 21:09   ` Sylwester Nawrocki
2014-03-04 10:12     ` Philipp Zabel
2014-02-27 17:35 ` [PATCH v5 4/7] of: Reduce indentation in of_graph_get_next_endpoint Philipp Zabel
2014-02-27 17:35 ` [PATCH v5 5/7] [media] of: move common endpoint parsing to drivers/of Philipp Zabel
2014-02-28 21:09   ` Sylwester Nawrocki
2014-03-04 10:09     ` Philipp Zabel
     [not found]   ` <1393522540-22887-6-git-send-email-p.zabel-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2014-03-04  8:58     ` Tomi Valkeinen
2014-03-04  8:58       ` Tomi Valkeinen
2014-03-04 11:36       ` Philipp Zabel
2014-03-04 12:21         ` Tomi Valkeinen
2014-03-04 12:21           ` Tomi Valkeinen
2014-03-04 15:47           ` Philipp Zabel
     [not found]             ` <1393948056.3917.120.camel-+qGW7pzALmz7o/J7KWpOmN53zsg1cpMQ@public.gmane.org>
2014-03-05 10:05               ` Tomi Valkeinen
2014-03-05 10:05                 ` Tomi Valkeinen
     [not found]           ` <5315C535.2070303-l0cyMroinI0@public.gmane.org>
2014-03-06 23:59             ` Laurent Pinchart
2014-03-06 23:59               ` Laurent Pinchart
2014-03-07  0:06               ` Eric Boxer
2014-02-27 17:35 ` [PATCH v5 6/7] of: Implement simplified graph binding for single port devices Philipp Zabel
2014-03-04  9:06   ` Tomi Valkeinen [this message]
2014-03-04  9:06     ` Tomi Valkeinen
2014-03-04 10:04     ` Philipp Zabel
2014-02-27 17:35 ` [PATCH v5 7/7] of: Document " Philipp Zabel

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=53159791.5080205@ti.com \
    --to=tomi.valkeinen@ti.com \
    --cc=devicetree@vger.kernel.org \
    --cc=g.liakhovetski@gmx.de \
    --cc=grant.likely@linaro.org \
    --cc=kyungmin.park@samsung.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=m.chehab@samsung.com \
    --cc=p.zabel@pengutronix.de \
    --cc=robh+dt@kernel.org \
    --cc=s.nawrocki@samsung.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.