Commit 96330407 authored by Suzuki K Poulose's avatar Suzuki K Poulose Committed by Greg Kroah-Hartman

coresight: Fix remote endpoint parsing

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.
Signed-off-by: default avatarSuzuki K Poulose <suzuki.poulose@arm.com>
Signed-off-by: default avatarMathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 5111e749
...@@ -134,7 +134,7 @@ static int of_coresight_parse_endpoint(struct device *dev, ...@@ -134,7 +134,7 @@ static int of_coresight_parse_endpoint(struct device *dev,
int ret = 0; int ret = 0;
struct of_endpoint endpoint, rendpoint; struct of_endpoint endpoint, rendpoint;
struct device_node *rparent = NULL; struct device_node *rparent = NULL;
struct device_node *rport = NULL; struct device_node *rep = NULL;
struct device *rdev = NULL; struct device *rdev = NULL;
do { do {
...@@ -142,16 +142,16 @@ static int of_coresight_parse_endpoint(struct device *dev, ...@@ -142,16 +142,16 @@ static int of_coresight_parse_endpoint(struct device *dev,
if (of_graph_parse_endpoint(ep, &endpoint)) if (of_graph_parse_endpoint(ep, &endpoint))
break; break;
/* /*
* Get a handle on the remote port and parent * Get a handle on the remote endpoint and the device it is
* attached to it. * attached to.
*/ */
rparent = of_graph_get_remote_port_parent(ep); rep = of_graph_get_remote_endpoint(ep);
if (!rparent) if (!rep)
break; break;
rport = of_graph_get_remote_port(ep); rparent = of_graph_get_port_parent(rep);
if (!rport) if (!rparent)
break; break;
if (of_graph_parse_endpoint(rport, &rendpoint)) if (of_graph_parse_endpoint(rep, &rendpoint))
break; break;
/* If the remote device is not available, defer probing */ /* If the remote device is not available, defer probing */
...@@ -165,15 +165,15 @@ static int of_coresight_parse_endpoint(struct device *dev, ...@@ -165,15 +165,15 @@ static int of_coresight_parse_endpoint(struct device *dev,
pdata->child_names[i] = devm_kstrdup(dev, pdata->child_names[i] = devm_kstrdup(dev,
dev_name(rdev), dev_name(rdev),
GFP_KERNEL); GFP_KERNEL);
pdata->child_ports[i] = rendpoint.id; pdata->child_ports[i] = rendpoint.port;
/* Connection record updated */ /* Connection record updated */
ret = 1; ret = 1;
} while (0); } while (0);
if (rparent) if (rparent)
of_node_put(rparent); of_node_put(rparent);
if (rport) if (rep)
of_node_put(rport); of_node_put(rep);
if (rdev) if (rdev)
put_device(rdev); put_device(rdev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment