devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mathieu Poirier <mathieu.poirier@linaro.org>
To: Suzuki K Poulose <suzuki.poulose@arm.com>
Cc: mark.rutland@arm.com, robh@kernel.org,
	devicetree@vger.kernel.org, coresight@lists.linaro.org,
	john.horley@arm.com, linux-kernel@vger.kernel.org,
	arm@kernel.org, sudeep.holla@arm.com, matt.sealey@arm.com,
	mike.leach@linaro.org, frowand.list@gmail.com,
	linux-arm-kernel@lists.infradead.org,
	charles.garcia-tobin@arm.com
Subject: Re: [PATCH 03/20] coresight: Fix remote endpoint parsing
Date: Fri, 8 Jun 2018 14:05:03 -0600	[thread overview]
Message-ID: <20180608200503.GC30587@xps15> (raw)
In-Reply-To: <1528235011-30691-4-git-send-email-suzuki.poulose@arm.com>

On Tue, Jun 05, 2018 at 10:43:14PM +0100, Suzuki K Poulose wrote:
> When parsing the remote endpoint of an output port, we do :
>      rport = of_graph_get_remote_port(ep);
>      rparent = of_graph_get_remote_port_parent(ep);
> 
> and then parse the "remote_port" as if it was the remote endpoint,
> which is wrong. The code worked fine because we used endpoint number
> as the port number. Let us fix it and optimise a bit as:
> 
>      remote_ep = of_graph_get_remote_endpoint(ep);
>      if (remote_ep)
>         remote_parent = of_graph_get_port_parent(remote_ep);
> 
> and then, parse the remote_ep for the port/endpoint details.
> 
> Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
> Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
> ---
>  drivers/hwtracing/coresight/of_coresight.c | 22 +++++++++++-----------
>  1 file changed, 11 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/hwtracing/coresight/of_coresight.c b/drivers/hwtracing/coresight/of_coresight.c
> index 8a23c63..ada4f07 100644
> --- a/drivers/hwtracing/coresight/of_coresight.c
> +++ b/drivers/hwtracing/coresight/of_coresight.c
> @@ -129,7 +129,7 @@ static int of_coresight_parse_endpoint(struct device_node *ep,
>  	int ret = 0;
>  	struct of_endpoint endpoint, rendpoint;
>  	struct device_node *rparent = NULL;
> -	struct device_node *rport = NULL;
> +	struct device_node *rep = NULL;
>  	struct device *rdev = NULL;
>  
>  	do {
> @@ -144,16 +144,16 @@ static int of_coresight_parse_endpoint(struct device_node *ep,
>  		if (of_graph_parse_endpoint(ep, &endpoint))
>  			break;
>  		/*
> -		 * Get a handle on the remote port and parent
> -		 * attached to it.
> +		 * Get a handle on the remote endpoint and the device it is
> +		 * attached to.
>  		 */
> -		rparent = of_graph_get_remote_port_parent(ep);
> +		rep = of_graph_get_remote_endpoint(ep);
> +		if (!rep)
> +			break;
> +		rparent = of_graph_get_port_parent(rep);
>  		if (!rparent)
>  			break;
> -		rport = of_graph_get_remote_port(ep);
> -		if (!rport)
> -			break;
> -		if (of_graph_parse_endpoint(rport, &rendpoint))
> +		if (of_graph_parse_endpoint(rep, &rendpoint))
>  			break;
>  
>  		/* If the remote device is not available, defer probing */
> @@ -165,15 +165,15 @@ static int of_coresight_parse_endpoint(struct device_node *ep,
>  
>  		pdata->outports[*i] = endpoint.port;
>  		pdata->child_names[*i] = dev_name(rdev);
> -		pdata->child_ports[*i] = rendpoint.id;
> +		pdata->child_ports[*i] = rendpoint.port;
>  		/* Move the index */
>  		(*i)++;
>  	} while (0);
>  
>  	if (rparent)
>  		of_node_put(rparent);
> -	if (rport)
> -		of_node_put(rport);
> +	if (rep)
> +		of_node_put(rep);
>  
>  	return ret;
>  }

Reviewed-by: Mathieu Poirier <mathieu.poirier@linaro.org>

(Please add to the next iteration so that I don't have to review again)

> -- 
> 2.7.4
> 

  reply	other threads:[~2018-06-08 20:05 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-05 21:43 [PATCH 00/20] coresight: Update device tree bindings Suzuki K Poulose
2018-06-05 21:43 ` [PATCH 01/20] coresight: Fix memory leak in coresight_register Suzuki K Poulose
2018-06-06  6:44   ` Arvind Yadav
2018-06-06 10:16     ` Suzuki K Poulose
2018-06-05 21:43 ` [PATCH 02/20] coresight: of: Fix refcounting for graph nodes Suzuki K Poulose
2018-06-08 19:55   ` Mathieu Poirier
2018-06-11  9:18     ` Suzuki K Poulose
2018-06-05 21:43 ` [PATCH 03/20] coresight: Fix remote endpoint parsing Suzuki K Poulose
2018-06-08 20:05   ` Mathieu Poirier [this message]
2018-06-05 21:43 ` [PATCH 04/20] coresight: Cleanup platform description data Suzuki K Poulose
2018-06-08 19:41   ` Mathieu Poirier
2018-06-05 21:43 ` [PATCH 05/20] coresight: platform: Cleanup coresight connection handling Suzuki K Poulose
2018-06-08 20:18   ` Mathieu Poirier
2018-06-05 21:43 ` [PATCH 06/20] coresight: Handle errors in finding input/output ports Suzuki K Poulose
2018-06-08 20:24   ` Mathieu Poirier
2018-06-05 21:43 ` [PATCH 07/20] coresight: dts: Document usage of graph bindings Suzuki K Poulose
2018-06-08 20:30   ` Mathieu Poirier
2018-06-05 21:43 ` [PATCH 08/20] coresight: dts: Cleanup device tree " Suzuki K Poulose
2018-06-08 21:22   ` Mathieu Poirier
2018-06-11  9:22     ` Suzuki K Poulose
2018-06-11 16:52       ` Mathieu Poirier
2018-06-11 16:55         ` Suzuki K Poulose
2018-06-11 21:51           ` Mathieu Poirier
2018-06-05 21:43 ` [PATCH 09/20] coresight: dts: Define new bindings for direction of data flow Suzuki K Poulose
2018-06-08 21:39   ` Mathieu Poirier
2018-06-05 21:43 ` [PATCH 10/20] dts: juno: Update coresight bindings for hw port Suzuki K Poulose
2018-06-08 21:49   ` Mathieu Poirier
2018-06-08 21:52     ` Mathieu Poirier
2018-06-12  9:50       ` Suzuki K Poulose
2018-06-12 10:42       ` Sudeep Holla
2018-06-05 21:43 ` [PATCH 11/20] dts: hisilicon: Update coresight bindings for hw ports Suzuki K Poulose
2018-06-05 21:43 ` [PATCH 12/20] dts: spreadtrum: " Suzuki K Poulose
2018-06-05 21:43 ` [PATCH 13/20] dts: qcom: " Suzuki K Poulose
2018-06-05 21:43 ` [PATCH 14/20] dts: arm: hisilicon: Update coresight bindings for hardware port Suzuki K Poulose
2018-06-05 21:43 ` [PATCH 15/20] dts: arm: imx7{d,s}: Update coresight binding for hardware ports Suzuki K Poulose
2018-06-19  2:12   ` Shawn Guo
2018-06-19 10:35     ` Stefan Agner
2018-06-19 14:57     ` Mathieu Poirier
2018-06-05 21:43 ` [PATCH 16/20] dts: arm: omap: Update coresight bindings " Suzuki K Poulose
2018-07-03  7:09   ` Tony Lindgren
2018-07-03  7:59     ` Suzuki K Poulose
2018-07-03  8:12       ` Tony Lindgren
2018-06-05 21:43 ` [PATCH 17/20] dts: arm: qcom: " Suzuki K Poulose
2018-06-05 21:43 ` [PATCH 18/20] dts: sama5d2: " Suzuki K Poulose
2018-06-19 21:24   ` Alexandre Belloni
2018-06-20  9:44     ` Suzuki K Poulose
2018-06-20 10:53       ` Alexandre Belloni
2018-06-05 21:43 ` [PATCH 19/20] dts: ste-dbx5x0: Update coresight bindings for hardware port Suzuki K Poulose
2018-06-26  9:30   ` Linus Walleij
2018-06-26  9:31     ` Suzuki K Poulose
2018-06-05 21:43 ` [PATCH 20/20] dts: tc2: Update coresight bindings for hardware ports Suzuki K Poulose
2018-06-20  9:53 ` [PATCH 00/20] coresight: Update device tree bindings Suzuki K Poulose

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=20180608200503.GC30587@xps15 \
    --to=mathieu.poirier@linaro.org \
    --cc=arm@kernel.org \
    --cc=charles.garcia-tobin@arm.com \
    --cc=coresight@lists.linaro.org \
    --cc=devicetree@vger.kernel.org \
    --cc=frowand.list@gmail.com \
    --cc=john.horley@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=matt.sealey@arm.com \
    --cc=mike.leach@linaro.org \
    --cc=robh@kernel.org \
    --cc=sudeep.holla@arm.com \
    --cc=suzuki.poulose@arm.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 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).