From patchwork Wed Mar 20 18:49:37 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suzuki K Poulose X-Patchwork-Id: 160717 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp626381jan; Wed, 20 Mar 2019 11:51:15 -0700 (PDT) X-Google-Smtp-Source: APXvYqxdIOO621QvBXZ94qIHqjQ63TjFC5q8l/c9TEEevaSby0dhoXR7/JyC9HQaFUtI7ZIXxng+ X-Received: by 2002:a17:902:a98c:: with SMTP id bh12mr9321798plb.289.1553107875541; Wed, 20 Mar 2019 11:51:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553107875; cv=none; d=google.com; s=arc-20160816; b=GApY2GvFbWnr0GfVuPRZyoEwCd+ju4HYLoxJ0Ts6SqDTwuAYY4Stj3XQtWp4INIkn3 GXGU0MfdCIMiYClcWSI2NnCK5IYsWgZUtlZ7c9zIB8NQE7Z0kCmFaZmI3vd58JNpTJo9 Q2EWJgRh7Y0B0InB4wPk9bAB+/Q0/oAzpIgIerzq/lqHPh7ZWvA26+03Z82tMZ1eA9l1 32it6Oc5G8e+oVFiaPZMLDuNnl313OHrqO2d+y3vM5HMo4ENIF5YAolQ9jsACaPk0Czm qULurzAxahXIuq0bkoZNu/qCdhdJCKYPNgkpDRMxNWcWjC9kvDmopKatrjGioUndgQ0X +0PA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=wfXSHKYkvK5PSGcPN2UoguzGa/Yd9DUdR3d523m4nUg=; b=Iqqh9neJCZGjKigPnJzYwlxCock4qB4X++lqnMKSGh/MeGqN6DecHsLZ7ghcRRNIgE PRGHJDxw7R6pWD/s82vBbAhSCbr61UDH5MdltiwCPdJDNG9ww7EJB64R56NCmpLrOiRi 9BUv6zT7eXdX6hR3nCJEI+/sqjUwTkWtrfEJifW6IEOi3ieNEKynf6Etea+7bAp03+kx nLVV0D5gvkhwpdK2iC+mI26xcBP2VInNl4h5DX6HT8xmrEkVIrS+mm+haBJgbIoA0WJS 9FK+A79xnJodffMO/WtwW8hm2g0Pi+hY4F9QxHBv5KcMzSqvaUJdoTdl8+9MANCtpzX9 6Xzg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g143si2234534pfb.29.2019.03.20.11.51.14; Wed, 20 Mar 2019 11:51:15 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727683AbfCTSus (ORCPT + 31 others); Wed, 20 Mar 2019 14:50:48 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:45010 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727062AbfCTSuo (ORCPT ); Wed, 20 Mar 2019 14:50:44 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 3ED081BC0; Wed, 20 Mar 2019 11:50:44 -0700 (PDT) Received: from en101.cambridge.arm.com (en101.cambridge.arm.com [10.1.196.93]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id B98463F59C; Wed, 20 Mar 2019 11:50:42 -0700 (PDT) From: Suzuki K Poulose To: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, coresight@lists.linaro.org, mike.leach@linaro.org, robert.walker@arm.com, Suzuki K Poulose , Mathieu Poirier Subject: [PATCH 20/25] coresight: platform: Use fwnode handle for device search Date: Wed, 20 Mar 2019 18:49:37 +0000 Message-Id: <1553107783-3340-21-git-send-email-suzuki.poulose@arm.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1553107783-3340-1-git-send-email-suzuki.poulose@arm.com> References: <1553107783-3340-1-git-send-email-suzuki.poulose@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 Signed-off-by: Suzuki K Poulose --- drivers/hwtracing/coresight/coresight-platform.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) -- 2.7.4 diff --git a/drivers/hwtracing/coresight/coresight-platform.c b/drivers/hwtracing/coresight/coresight-platform.c index 93b6c87..877ed2b 100644 --- a/drivers/hwtracing/coresight/coresight-platform.c +++ b/drivers/hwtracing/coresight/coresight-platform.c @@ -31,14 +31,13 @@ static int coresight_alloc_conns(struct device *dev, return 0; } -#ifdef CONFIG_OF -static int of_dev_node_match(struct device *dev, void *data) +static int coresight_fwnode_handle_match(struct device *dev, void *data) { - return dev->of_node == data; + return dev_fwnode(dev) == 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; @@ -47,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, coresight_fwnode_handle_match); if (dev) return dev; @@ -56,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, coresight_fwnode_handle_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"); @@ -186,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 */ @@ -204,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;