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>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Rob Herring <robh@kernel.org>,
Sudeep Holla <sudeep.holla@arm.com>,
Frank Rowand <frowand.list@gmail.com>,
devicetree@vger.kernel.org, Mark Rutland <mark.rutland@arm.com>,
Matt Sealey <matt.sealey@arm.com>,
Charles Garcia-Tobin <charles.garcia-tobin@arm.com>,
coresight@lists.linaro.org, John Horley <john.horley@arm.com>,
Mike Leach <mike.leach@linaro.org>
Subject: Re: [PATCH v2 02/10] coresight: platform: Refactor graph endpoint parsing
Date: Wed, 25 Jul 2018 10:01:53 +0100 [thread overview]
Message-ID: <ea1a6672-0cbb-86b7-c8cd-0759edb94f85@arm.com> (raw)
In-Reply-To: <CANLsYkwDTM2pT0JCCnLdetKoYe6xsmj48Gyb5OJFxJMmRLrZ_g@mail.gmail.com>
On 07/24/2018 10:34 PM, Mathieu Poirier wrote:
> On Tue, 24 Jul 2018 at 15:30, Mathieu Poirier
> <mathieu.poirier@linaro.org> wrote:
>>
>> Good afternoon,
>>
>> On Thu, Jul 19, 2018 at 11:55:06AM +0100, Suzuki K Poulose wrote:
>>> Refactor the of graph endpoint parsing code, to make the error
>>> handling easier.
>>>
>>> Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
>>> Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
>>> ---
>>> Changes since v1:
>>> - Splitted from the of_node refcounting fix, part1
>>> ---
>>> drivers/hwtracing/coresight/of_coresight.c | 129 +++++++++++++++++------------
>>> 1 file changed, 75 insertions(+), 54 deletions(-)
>>>
>>> diff --git a/drivers/hwtracing/coresight/of_coresight.c b/drivers/hwtracing/coresight/of_coresight.c
>>> index 6880bee..68faaf8 100644
>>> --- a/drivers/hwtracing/coresight/of_coresight.c
>>> +++ b/drivers/hwtracing/coresight/of_coresight.c
>>> @@ -114,17 +114,69 @@ int of_coresight_get_cpu(const struct device_node *node)
>>> }
>>> EXPORT_SYMBOL_GPL(of_coresight_get_cpu);
>>>
>>> +/*
>>> + * of_coresight_parse_endpoint : Parse the given output endpoint @ep
>>> + * and fill the connection information in @pdata[*@i].
>>> + *
>>> + * Parses the local port, remote device name and the remote port. Also
>>> + * updates *@i to point to the next index, when an entry is added.
>>> + *
>>> + * Returns :
>>> + * 0 - If the parsing completed without any fatal errors.
>>> + * -Errno - Fatal error, abort the scanning.
>>> + */
>>> +static int of_coresight_parse_endpoint(struct device *dev,
>>> + struct device_node *ep,
>>> + struct coresight_platform_data *pdata,
>>> + int *i)
>>> +{
>>> + int ret = 0;
>>> + struct of_endpoint endpoint, rendpoint;
>>> + struct device_node *rparent = NULL;
>>> + struct device_node *rport = NULL;
>>> + struct device *rdev = NULL;
>>> +
>>> + do {
>>> + /* Parse the local port details */
>>> + if (of_graph_parse_endpoint(ep, &endpoint))
>>> + break;
>>> + /*
>>> + * Get a handle on the remote port and parent
>>> + * attached to it.
>>> + */
>>> + rparent = of_graph_get_remote_port_parent(ep);
>>> + if (!rparent)
>>> + break;
>>> + rport = of_graph_get_remote_port(ep);
>>> + if (!rport)
>>> + break;
>>> + if (of_graph_parse_endpoint(rport, &rendpoint))
>>> + break;
>>> +
>>> + /* If the remote device is not available, defer probing */
>>> + rdev = of_coresight_get_endpoint_device(rparent);
>>> + if (!rdev) {
>>> + ret = -EPROBE_DEFER;
>>> + break;
>>> + }
>>> +
>>> + pdata->outports[*i] = endpoint.port;
>>> + pdata->child_names[*i] = dev_name(rdev);
>>> + pdata->child_ports[*i] = rendpoint.id;
>>> + /* Move the index */
>>> + (*i)++;
>>
>> Not a big fan, makes the code needlessly complex. Incrementation of the index
>> can be done in the while loop of of_get_coresight_platform_data(). See below.
Me neither..
>
> Void that - it properly deals with the first of_parse_endpoint().
Or may be we could do something with the return value :
1 - Successfully parsed and populated a connection entry
0 - No errors in parsing
< 0 - Errors in parsing
>>> @@ -132,64 +184,33 @@ of_get_coresight_platform_data(struct device *dev,
>>> + while ((ep = of_graph_get_next_endpoint(node, ep))) {
>>> + /*
>>> + * No need to deal with input ports, processing for as
>>> + * processing for output ports will deal with them.
>>> + */
>>
>> This comment has been broken for a while... It should read:
>>
>> /*
>> * No need to deal with input ports, as processing
>> * for output ports will deal with them.
>> */
Sure, will fix it.
Suzuki
next prev parent reply other threads:[~2018-07-25 9:01 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-19 10:55 [PATCH v2 00/10] coresight: Update device tree bindings Suzuki K Poulose
2018-07-19 10:55 ` [PATCH v2 01/10] coresight: Document error handling in coresight_register Suzuki K Poulose
2018-07-19 10:55 ` [PATCH v2 02/10] coresight: platform: Refactor graph endpoint parsing Suzuki K Poulose
2018-07-24 21:30 ` Mathieu Poirier
2018-07-24 21:34 ` Mathieu Poirier
2018-07-25 9:01 ` Suzuki K Poulose [this message]
2018-07-25 14:38 ` Mathieu Poirier
2018-07-19 10:55 ` [PATCH v2 03/10] coresight: platform: Fix refcounting for graph nodes Suzuki K Poulose
2018-07-19 10:55 ` [PATCH v2 04/10] coresight: platform: Fix leaking device reference Suzuki K Poulose
2018-07-19 10:55 ` [PATCH v2 05/10] coresight: Fix remote endpoint parsing Suzuki K Poulose
2018-07-19 10:55 ` [PATCH v2 06/10] coresight: Add helper to check if the endpoint is input Suzuki K Poulose
2018-07-19 10:55 ` [PATCH v2 07/10] coresight: platform: Cleanup coresight connection handling Suzuki K Poulose
2018-07-19 10:55 ` [PATCH v2 08/10] coresight: dts: Document usage of graph bindings Suzuki K Poulose
2018-07-19 10:55 ` [PATCH v2 09/10] coresight: Cleanup coresight DT bindings Suzuki K Poulose
2018-07-25 16:09 ` Rob Herring
2018-07-25 16:14 ` Suzuki K Poulose
2018-07-25 17:24 ` Rob Herring
2018-07-25 19:25 ` Mathieu Poirier
2018-07-19 10:55 ` [PATCH v2 10/10] dts: juno: Update coresight bindings for hw port Suzuki K Poulose
2018-07-19 11:01 ` Suzuki K Poulose
2018-07-19 10:55 ` [PATCH v2 10/10] dts: juno: Update coresight 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=ea1a6672-0cbb-86b7-c8cd-0759edb94f85@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
all inboxes | Powered by JetHome®