lkml.org 
[lkml]   [2019]   [Apr]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2 28/36] coresight: platform: Use fwnode handle for device search
On Mon, Apr 15, 2019 at 05:04:11PM +0100, Suzuki K Poulose wrote:
> We match of_node while searching for a device. Make this
> more generic in preparation for the ACPI support by using
> fwnode_handle.
>
> Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
> Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
> ---
> drivers/hwtracing/coresight/coresight-platform.c | 17 +++++++----------
> 1 file changed, 7 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/hwtracing/coresight/coresight-platform.c b/drivers/hwtracing/coresight/coresight-platform.c
> index a408b01..318a6ff 100644
> --- a/drivers/hwtracing/coresight/coresight-platform.c
> +++ b/drivers/hwtracing/coresight/coresight-platform.c
> @@ -36,14 +36,8 @@ static int coresight_alloc_conns(struct device *dev,
> return 0;
> }
>
> -#ifdef CONFIG_OF
> -static int of_dev_node_match(struct device *dev, void *data)
> -{
> - return dev->of_node == data;
> -}
> -
> 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;
>
> @@ -52,7 +46,7 @@ of_coresight_get_endpoint_device(struct device_node *endpoint)
> * platform bus.
> */
> dev = bus_find_device(&platform_bus_type, NULL,
> - endpoint, of_dev_node_match);
> + fwnode, device_fwnode_match);
> if (dev)
> return dev;
>
> @@ -61,9 +55,10 @@ of_coresight_get_endpoint_device(struct device_node *endpoint)
> * looking for the device that matches the endpoint node.
> */
> return bus_find_device(&amba_bustype, NULL,
> - endpoint, of_dev_node_match);
> + fwnode, device_fwnode_match);
> }
>
> +#ifdef CONFIG_OF
> static inline bool of_coresight_legacy_ep_is_input(struct device_node *ep)
> {
> return of_property_read_bool(ep, "slave-mode");
> @@ -191,6 +186,7 @@ static int of_coresight_parse_endpoint(struct device *dev,
> struct device_node *rparent = NULL;
> struct device_node *rep = NULL;
> struct device *rdev = NULL;
> + struct fwnode_handle *rdev_fwnode;
>
> do {
> /* Parse the local port details */
> @@ -209,8 +205,9 @@ static int of_coresight_parse_endpoint(struct device *dev,
> if (of_graph_parse_endpoint(rep, &rendpoint))
> break;
>
> + rdev_fwnode = of_fwnode_handle(rparent);
> /* 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) {
> ret = -EPROBE_DEFER;
> break;

Reviewed-by: Mathieu Poirier <mathieu.poirier@linaro.org>

> --
> 2.7.4
>

\
 
 \ /
  Last update: 2019-04-23 18:17    [W:0.337 / U:5.432 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site