Skip to content

Commit 20961ae

Browse files
Suzuki K Poulosegregkh
Suzuki K Poulose
authored andcommitted
coresight: platform: Use fwnode handle for device search
We match of_node while searching for a device. Make this more generic in preparation for the ACPI support by using fwnode_handle. Signed-off-by: Suzuki K Poulose <[email protected]> Signed-off-by: Mathieu Poirier <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 688da45 commit 20961ae

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

drivers/hwtracing/coresight/coresight-platform.c

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,13 @@ static int coresight_alloc_conns(struct device *dev,
3636
return 0;
3737
}
3838

39-
#ifdef CONFIG_OF
40-
static int of_dev_node_match(struct device *dev, void *data)
39+
static int coresight_device_fwnode_match(struct device *dev, void *fwnode)
4140
{
42-
return dev->of_node == data;
41+
return dev_fwnode(dev) == fwnode;
4342
}
4443

4544
static struct device *
46-
of_coresight_get_endpoint_device(struct device_node *endpoint)
45+
coresight_find_device_by_fwnode(struct fwnode_handle *fwnode)
4746
{
4847
struct device *dev = NULL;
4948

@@ -52,7 +51,7 @@ of_coresight_get_endpoint_device(struct device_node *endpoint)
5251
* platform bus.
5352
*/
5453
dev = bus_find_device(&platform_bus_type, NULL,
55-
endpoint, of_dev_node_match);
54+
fwnode, coresight_device_fwnode_match);
5655
if (dev)
5756
return dev;
5857

@@ -61,9 +60,10 @@ of_coresight_get_endpoint_device(struct device_node *endpoint)
6160
* looking for the device that matches the endpoint node.
6261
*/
6362
return bus_find_device(&amba_bustype, NULL,
64-
endpoint, of_dev_node_match);
63+
fwnode, coresight_device_fwnode_match);
6564
}
6665

66+
#ifdef CONFIG_OF
6767
static inline bool of_coresight_legacy_ep_is_input(struct device_node *ep)
6868
{
6969
return of_property_read_bool(ep, "slave-mode");
@@ -191,6 +191,7 @@ static int of_coresight_parse_endpoint(struct device *dev,
191191
struct device_node *rparent = NULL;
192192
struct device_node *rep = NULL;
193193
struct device *rdev = NULL;
194+
struct fwnode_handle *rdev_fwnode;
194195

195196
do {
196197
/* Parse the local port details */
@@ -209,8 +210,9 @@ static int of_coresight_parse_endpoint(struct device *dev,
209210
if (of_graph_parse_endpoint(rep, &rendpoint))
210211
break;
211212

213+
rdev_fwnode = of_fwnode_handle(rparent);
212214
/* If the remote device is not available, defer probing */
213-
rdev = of_coresight_get_endpoint_device(rparent);
215+
rdev = coresight_find_device_by_fwnode(rdev_fwnode);
214216
if (!rdev) {
215217
ret = -EPROBE_DEFER;
216218
break;

0 commit comments

Comments
 (0)