mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-05-02 05:15:59 +00:00
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 <suzuki.poulose@arm.com> Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
688da45f20
commit
20961aea98
1 changed files with 9 additions and 7 deletions
|
@ -36,14 +36,13 @@ static int coresight_alloc_conns(struct device *dev,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_OF
|
static int coresight_device_fwnode_match(struct device *dev, void *fwnode)
|
||||||
static int of_dev_node_match(struct device *dev, void *data)
|
|
||||||
{
|
{
|
||||||
return dev->of_node == data;
|
return dev_fwnode(dev) == fwnode;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct device *
|
static struct device *
|
||||||
of_coresight_get_endpoint_device(struct device_node *endpoint)
|
coresight_find_device_by_fwnode(struct fwnode_handle *fwnode)
|
||||||
{
|
{
|
||||||
struct device *dev = NULL;
|
struct device *dev = NULL;
|
||||||
|
|
||||||
|
@ -52,7 +51,7 @@ of_coresight_get_endpoint_device(struct device_node *endpoint)
|
||||||
* platform bus.
|
* platform bus.
|
||||||
*/
|
*/
|
||||||
dev = bus_find_device(&platform_bus_type, NULL,
|
dev = bus_find_device(&platform_bus_type, NULL,
|
||||||
endpoint, of_dev_node_match);
|
fwnode, coresight_device_fwnode_match);
|
||||||
if (dev)
|
if (dev)
|
||||||
return dev;
|
return dev;
|
||||||
|
|
||||||
|
@ -61,9 +60,10 @@ of_coresight_get_endpoint_device(struct device_node *endpoint)
|
||||||
* looking for the device that matches the endpoint node.
|
* looking for the device that matches the endpoint node.
|
||||||
*/
|
*/
|
||||||
return bus_find_device(&amba_bustype, NULL,
|
return bus_find_device(&amba_bustype, NULL,
|
||||||
endpoint, of_dev_node_match);
|
fwnode, coresight_device_fwnode_match);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef CONFIG_OF
|
||||||
static inline bool of_coresight_legacy_ep_is_input(struct device_node *ep)
|
static inline bool of_coresight_legacy_ep_is_input(struct device_node *ep)
|
||||||
{
|
{
|
||||||
return of_property_read_bool(ep, "slave-mode");
|
return of_property_read_bool(ep, "slave-mode");
|
||||||
|
@ -191,6 +191,7 @@ static int of_coresight_parse_endpoint(struct device *dev,
|
||||||
struct device_node *rparent = NULL;
|
struct device_node *rparent = NULL;
|
||||||
struct device_node *rep = NULL;
|
struct device_node *rep = NULL;
|
||||||
struct device *rdev = NULL;
|
struct device *rdev = NULL;
|
||||||
|
struct fwnode_handle *rdev_fwnode;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
/* Parse the local port details */
|
/* Parse the local port details */
|
||||||
|
@ -209,8 +210,9 @@ static int of_coresight_parse_endpoint(struct device *dev,
|
||||||
if (of_graph_parse_endpoint(rep, &rendpoint))
|
if (of_graph_parse_endpoint(rep, &rendpoint))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
rdev_fwnode = of_fwnode_handle(rparent);
|
||||||
/* If the remote device is not available, defer probing */
|
/* If the remote device is not available, defer probing */
|
||||||
rdev = of_coresight_get_endpoint_device(rparent);
|
rdev = coresight_find_device_by_fwnode(rdev_fwnode);
|
||||||
if (!rdev) {
|
if (!rdev) {
|
||||||
ret = -EPROBE_DEFER;
|
ret = -EPROBE_DEFER;
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Add table
Reference in a new issue