linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Suzuki K Poulose <suzuki.poulose@arm.com>
To: Mathieu Poirier <mathieu.poirier@linaro.org>
Cc: linux-arm-kernel <linux-arm-kernel@lists.infradead.org>,
	Sudeep Holla <sudeep.holla@arm.com>,
	Rob Herring <robh@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Frank Rowand <frowand.list@gmail.com>,
	Matt Sealey <matt.sealey@arm.com>,
	Charles Garcia-Tobin <charles.garcia-tobin@arm.com>,
	John Horley <john.horley@arm.com>,
	Mike Leach <mike.leach@linaro.org>,
	coresight@lists.linaro.org,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	devicetree@vger.kernel.org
Subject: Re: [RFC PATCH 2/8] coresight: Fix remote endpoint parsing
Date: Mon, 4 Jun 2018 11:34:32 +0100	[thread overview]
Message-ID: <005ec90b-6697-1b33-de01-b5f2a6c509cf@arm.com> (raw)
In-Reply-To: <CANLsYkzY-1z4NBmZECczMisDixgPb2UkJL0k9_LmDNEiqUS1=g@mail.gmail.com>

On 06/01/2018 08:46 PM, Mathieu Poirier wrote:
> On 1 June 2018 at 13:38, Mathieu Poirier <mathieu.poirier@linaro.org> wrote:
>> On Fri, Jun 01, 2018 at 02:16:01PM +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 | 19 ++++++++++---------
>>>   1 file changed, 10 insertions(+), 9 deletions(-)
>>>
>>> diff --git a/drivers/hwtracing/coresight/of_coresight.c b/drivers/hwtracing/coresight/of_coresight.c
>>> index 7c37544..e0deab0 100644
>>> --- a/drivers/hwtracing/coresight/of_coresight.c
>>> +++ b/drivers/hwtracing/coresight/of_coresight.c
>>> @@ -128,7 +128,7 @@ of_get_coresight_platform_data(struct device *dev,
>>>        struct device *rdev;
>>>        struct device_node *ep = NULL;
>>>        struct device_node *rparent = NULL;
>>> -     struct device_node *rport = NULL;
>>> +     struct device_node *rep = NULL;
>>>
>>>        pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
>>>        if (!pdata)
>>> @@ -169,16 +169,17 @@ of_get_coresight_platform_data(struct device *dev,
>>>                        pdata->outports[i] = endpoint.port;
>>>
>>>                        /*
>>> -                      * 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);
>>> -                     rport = of_graph_get_remote_port(ep);
>>> -
>>> -                     if (!rparent || !rport)
>>> +                     rep = of_graph_get_remote_endpoint(ep);
>>> +                     if (!rep)
>>> +                             continue;
>>> +                     rparent = of_graph_get_port_parent(rep);
>>> +                     if (!rparent)
>>>                                continue;
>>>
>>> -                     if (of_graph_parse_endpoint(rport, &rendpoint))
>>> +                     if (of_graph_parse_endpoint(rep, &rendpoint))
>>>                                continue;
>>
>> You are correct and I'm out to lunch.
>>
>>>
>>>                        rdev = of_coresight_get_endpoint_device(rparent);
>>> @@ -186,7 +187,7 @@ of_get_coresight_platform_data(struct device *dev,
>>>                                return ERR_PTR(-EPROBE_DEFER);
>>>
>>>                        pdata->child_names[i] = dev_name(rdev);
>>> -                     pdata->child_ports[i] = rendpoint.id;
>>> +                     pdata->child_ports[i] = rendpoint.port;
>>
>> You need to do a of_node_put() here for both rep and rparent.
> 
> Same thing for the "continue" and error condition above.


Mathieu,

Thanks for pointing that out. I see that we were missing them for the
existing code as well. I will clean all this up.

Cheers
Suzuki

  reply	other threads:[~2018-06-04 10:34 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-01 13:15 [RFC PATCH 0/8] coresight: Update device tree bindings Suzuki K Poulose
2018-06-01 13:16 ` [RFC PATCH 1/8] dts: binding: coresight: Document graph bindings Suzuki K Poulose
2018-06-01 16:14   ` Mathieu Poirier
2018-06-01 13:16 ` [RFC PATCH 2/8] coresight: Fix remote endpoint parsing Suzuki K Poulose
2018-06-01 19:38   ` Mathieu Poirier
2018-06-01 19:46     ` Mathieu Poirier
2018-06-04 10:34       ` Suzuki K Poulose [this message]
2018-06-01 13:16 ` [RFC PATCH 3/8] coresight: Cleanup platform description data Suzuki K Poulose
2018-06-01 13:16 ` [RFC PATCH 4/8] coresight: platform: Cleanup coresight connection handling Suzuki K Poulose
2018-06-01 13:16 ` [RFC PATCH 5/8] coresight: Handle errors in finding input/output ports Suzuki K Poulose
2018-06-01 13:16 ` [RFC PATCH 6/8] dts: coresight: Clean up the device tree graph bindings Suzuki K Poulose
2018-06-01 20:26   ` Mathieu Poirier
2018-06-12 20:48   ` Rob Herring
2018-06-13  9:45     ` Suzuki K Poulose
2018-06-13 12:49       ` Matt Sealey
2018-06-13 13:35         ` Suzuki K Poulose
2018-06-13 13:57           ` Rob Herring
2018-06-13 15:47           ` Matt Sealey
2018-06-13 17:07             ` Suzuki K Poulose
2018-06-13 19:40               ` Mathieu Poirier
2018-06-13 21:07                 ` Matt Sealey
2018-06-14  8:53                   ` Suzuki K Poulose
2018-06-14 13:59                     ` Rob Herring
2018-06-14 15:04                       ` Matt Sealey
2018-06-15  9:58                       ` Suzuki K Poulose
2018-07-03  9:44                       ` Suzuki K Poulose
2018-06-01 13:16 ` [RFC PATCH 7/8] dts: coresight: Define new bindings for direction of data flow Suzuki K Poulose
2018-06-01 20:39   ` Mathieu Poirier
2018-06-04 14:20     ` Suzuki K Poulose
2018-06-01 13:16 ` [RFC PATCH 8/8] dts: juno: Update coresight bindings for hw port Suzuki K Poulose
2018-06-01 20:59   ` Mathieu Poirier
2018-06-01 21:04 ` [RFC PATCH 0/8] coresight: Update device tree bindings Mathieu Poirier

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=005ec90b-6697-1b33-de01-b5f2a6c509cf@arm.com \
    --to=suzuki.poulose@arm.com \
    --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=mathieu.poirier@linaro.org \
    --cc=matt.sealey@arm.com \
    --cc=mike.leach@linaro.org \
    --cc=robh@kernel.org \
    --cc=sudeep.holla@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).