From patchwork Tue May 7 10:52:51 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: 163495 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:81:0:0:0:0 with SMTP id l1csp1184171ilm; Tue, 7 May 2019 03:54:20 -0700 (PDT) X-Google-Smtp-Source: APXvYqw2F7x0MHhIP884lrGyziEvxTrE9mPfg7k2tOzruJTe3bKtBZhlmy7ZAgQNOilHGfkDKTqU X-Received: by 2002:a63:1b11:: with SMTP id b17mr38920278pgb.207.1557226460008; Tue, 07 May 2019 03:54:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557226460; cv=none; d=google.com; s=arc-20160816; b=sszLqDYNPYzorIQ8bzZ6VNJ39VPhcv4KUYdncXDSol/CDvkl/ehrV7zg9OO1JOpYeq K0WS0JmVBVOc3vUy9g19L6rSv30FWCPiae4NtEss/esFiWdwcOfKHLWa6nuXIpdK0PJe zRsvPz9tHZ0cUw6XnFiHiBN3LlPLeTGkcwOwIEyy6v0m4JsKkyM1emtCJSUsD+XGd9az wFQG0CgLLOri1JFkx1GVNxrdhM8PGvKPiNZ7ZuP/b13cAP0N76p3VqSpa2BtVSblHeEN DSU3ICu0mCxy1gBMr8u4/adMAXEKoik3FbdZUFhDrN6AEa6w9zglLejsR9fyCNVr1loA ELSw== 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=k7Rh3trrPbSqxlqj0b5tzVcfnZUCUPoaNIBudmjpYf8=; b=l02QMdOr7FHvhWpRy4bJYrox+fBL6n0FaVVHeiWqwlyerl5iQ5S416L1Ptt/debLKF +XZDqYZ6/NBLDs1AuVqYQ5mWXWw0gb2H3jbwTFbPEVk8nOVkT3kGYVbrlsGpUV2PapRt RkZPXjPOcBaTWgsWYsoWSfJHfjnFTjOahe/huU1ls4sBiNvbJJBbxFUy9LELXA+C63K/ AlhIgBO2DLqmbG+PDLhMpGwp8XtIrStu2esY5syoXk0p5sUCuTJWCIe1cQCErw08gxPJ k7ntpzyWcWpanoSd480mgOsijV6jJDO4FC+DX+nxe/7vZcNCB6w1p8XQTRBAmWLJVBi/ KQRw== 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 h3si18802326pgg.83.2019.05.07.03.54.19; Tue, 07 May 2019 03:54:19 -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 S1727235AbfEGKyS (ORCPT + 30 others); Tue, 7 May 2019 06:54:18 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:50312 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727090AbfEGKyQ (ORCPT ); Tue, 7 May 2019 06:54:16 -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 00324374; Tue, 7 May 2019 03:54:16 -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 C146D3F5AF; Tue, 7 May 2019 03:54:14 -0700 (PDT) From: Suzuki K Poulose To: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org, coresight@lists.linaro.org, rjw@rjwysocki.net, mathieu.poirier@linaro.org, Suzuki K Poulose Subject: [PATCH v3 24/30] coresight: platform: Use fwnode handle for device search Date: Tue, 7 May 2019 11:52:51 +0100 Message-Id: <1557226378-10131-25-git-send-email-suzuki.poulose@arm.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1557226378-10131-1-git-send-email-suzuki.poulose@arm.com> References: <1557226378-10131-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 --- Change since v2: - Drop the generic helper. It requires further clean up, and will be dealt with a separate series. --- drivers/hwtracing/coresight/coresight-platform.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) -- 2.7.4 Reviewed-by: Mathieu Poirier diff --git a/drivers/hwtracing/coresight/coresight-platform.c b/drivers/hwtracing/coresight/coresight-platform.c index 53d6eed..4394095 100644 --- a/drivers/hwtracing/coresight/coresight-platform.c +++ b/drivers/hwtracing/coresight/coresight-platform.c @@ -36,14 +36,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_device_fwnode_match(struct device *dev, void *fwnode) { - return dev->of_node == data; + return dev_fwnode(dev) == fwnode; } 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 +51,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_device_fwnode_match); if (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. */ 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) { 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 *rep = NULL; struct device *rdev = NULL; + struct fwnode_handle *rdev_fwnode; do { /* 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)) 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;