From patchwork Wed May 22 10:34:57 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: 164787 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp694049ili; Wed, 22 May 2019 03:35:55 -0700 (PDT) X-Google-Smtp-Source: APXvYqwy6yk7CIcgtST4H0gSFjGszN6aVo9RFEjs9wCwGj/7VrPRNzkpj1LHVvvel46dMVt+3DCf X-Received: by 2002:a17:902:a70f:: with SMTP id w15mr19638904plq.222.1558521355529; Wed, 22 May 2019 03:35:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558521355; cv=none; d=google.com; s=arc-20160816; b=ZtDYFgrMNYOaheX9Z58qyfM+r26USfSL7kg7bpcJuLHigkJwtrhcfyvtBqWksWc3CU VvDW3dTktylnb2VpS9VXwLj/fF3PZQnkSbsQ0/d8Fjv9LQC/2Pf4GX/FkTMh5N+OTzXo U8cUA4PpJ6SMCV1rWjbYfhS138ILXi3CqU5t4r2YGqIGRzHm/l+cq2jCE62StGAACLg1 GBASxkR4kn2phR5bzB/XewJ0elXFyiMVlgfJnWXnIdDCd/xiMOSfsr+HktTZsmZdIAvp IEYnQ+01rvJlPHT74uhFTsmdKguJ/9EB+45eMUATaDrxygySYIOspV5rcpyg8tl9tFxo 2jzg== 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=ir/k5CQ0aMyPcU2Z+CLN3ARLdWQoFaaRxuqfRj/T6so=; b=ve8HfGUsESyJWV/mrikZUQr6suc/AInY/FnEZ0VNlkDwCwk6KzXsse8KhChbXXBW+R SL/ai03NEb1t3hGhK8mVFkLac97zQnZ1P/0OY10rJkGnGsLA2elEI3WE/q8maDL40Q3O i0TLIwy2pHKhv2DllPuawPtRbvZWEnIHIV0JAYjTvOTopcVhGydc6fGI7aTCMLmSuS4M b/1VRtw/VAxcgAwhBhkP/ss98oIA+jjjMkTslPiFcj1IhJ4Fc8XHJKskK+U1ypfs/iGO SFlCaanGlejRtXZAcEbZ5Yx9X66ZPLccO5TRQMRwRSB0hKVJj9mLhBcZXgVzopnimPCx im9Q== 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 h68si25312309pgc.270.2019.05.22.03.35.54; Wed, 22 May 2019 03:35:55 -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 S1729464AbfEVKfx (ORCPT + 30 others); Wed, 22 May 2019 06:35:53 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:47168 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729398AbfEVKfu (ORCPT ); Wed, 22 May 2019 06:35:50 -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 8A53315BF; Wed, 22 May 2019 03:35:49 -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 7A83D3F575; Wed, 22 May 2019 03:35:48 -0700 (PDT) From: Suzuki K Poulose To: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org, mathieu.poirier@linaro.org, coresight@lists.linaro.org, Suzuki K Poulose Subject: [PATCH v4 24/30] coresight: platform: Use fwnode handle for device search Date: Wed, 22 May 2019 11:34:57 +0100 Message-Id: <1558521304-27469-25-git-send-email-suzuki.poulose@arm.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1558521304-27469-1-git-send-email-suzuki.poulose@arm.com> References: <1558521304-27469-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. Reviewed-by: 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 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;