From patchwork Tue Sep 24 18:12:36 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Saenz Julienne X-Patchwork-Id: 11159983 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 326E017D4 for ; Wed, 25 Sep 2019 04:17:39 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 186F921841 for ; Wed, 25 Sep 2019 04:17:39 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 186F921841 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iCyj1-0000Qu-Ji; Wed, 25 Sep 2019 04:16:23 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iCpJ9-0000FB-1Q for xen-devel@lists.xenproject.org; Tue, 24 Sep 2019 18:13:03 +0000 X-Inumbo-ID: ef6be1ac-def6-11e9-9625-12813bfff9fa Received: from mx1.suse.de (unknown [195.135.220.15]) by localhost (Halon) with ESMTPS id ef6be1ac-def6-11e9-9625-12813bfff9fa; Tue, 24 Sep 2019 18:12:57 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id D66E4AE78; Tue, 24 Sep 2019 18:12:56 +0000 (UTC) From: Nicolas Saenz Julienne To: robh+dt@kernel.org, devicetree@vger.kernel.org, frowand.list@gmail.com, linux-arm-kernel@lists.infradead.org, linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dmaengine@vger.kernel.org, etnaviv@lists.freedesktop.org, dri-devel@lists.freedesktop.org, xen-devel@lists.xenproject.org, linux-tegra@vger.kernel.org, linux-media@vger.kernel.org, linux-pci@vger.kernel.org Date: Tue, 24 Sep 2019 20:12:36 +0200 Message-Id: <20190924181244.7159-6-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190924181244.7159-1-nsaenzjulienne@suse.de> References: <20190924181244.7159-1-nsaenzjulienne@suse.de> MIME-Version: 1.0 X-Mailman-Approved-At: Wed, 25 Sep 2019 04:16:20 +0000 Subject: [Xen-devel] [PATCH 05/11] of: expose __of_get_dma_parent() to OF subsystem X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: f.fainelli@gmail.com, mbrugger@suse.com, wahrenst@gmx.net, james.quinlan@broadcom.com, robin.murphy@arm.com, Nicolas Saenz Julienne Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" The function was only available locally to of/address.c, make it available to the OF subsystem. Signed-off-by: Nicolas Saenz Julienne --- drivers/of/address.c | 18 ------------------ drivers/of/base.c | 25 +++++++++++++++++++++++++ drivers/of/of_private.h | 2 ++ 3 files changed, 27 insertions(+), 18 deletions(-) diff --git a/drivers/of/address.c b/drivers/of/address.c index c9eb4ebcc2e9..53666063e938 100644 --- a/drivers/of/address.c +++ b/drivers/of/address.c @@ -681,24 +681,6 @@ u64 of_translate_address(struct device_node *dev, const __be32 *in_addr) } EXPORT_SYMBOL(of_translate_address); -static struct device_node *__of_get_dma_parent(const struct device_node *np) -{ - struct of_phandle_args args; - int ret, index; - - index = of_property_match_string(np, "interconnect-names", "dma-mem"); - if (index < 0) - return of_get_parent(np); - - ret = of_parse_phandle_with_args(np, "interconnects", - "#interconnect-cells", - index, &args); - if (ret < 0) - return of_get_parent(np); - - return of_node_get(args.np); -} - static u64 of_translate_dma_address_parent(struct device_node *parent, const __be32 *in_addr) { diff --git a/drivers/of/base.c b/drivers/of/base.c index 94f83051910c..ec161e6b5222 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c @@ -716,6 +716,31 @@ struct device_node *of_get_parent(const struct device_node *node) } EXPORT_SYMBOL(of_get_parent); +/** + * __of_get_dma_parent - Get a node's dma parent if any + * @node: Node to get dma parent + * + * Returns a node pointer with refcount incremented, use + * of_node_put() on it when done. + */ +struct device_node *__of_get_dma_parent(const struct device_node *np) +{ + struct of_phandle_args args; + int ret, index; + + index = of_property_match_string(np, "interconnect-names", "dma-mem"); + if (index < 0) + return of_get_parent(np); + + ret = of_parse_phandle_with_args(np, "interconnects", + "#interconnect-cells", + index, &args); + if (ret < 0) + return of_get_parent(np); + + return of_node_get(args.np); +} + /** * of_get_next_parent - Iterate to a node's parent * @node: Node to get parent of diff --git a/drivers/of/of_private.h b/drivers/of/of_private.h index b528304be244..63bb16cc454c 100644 --- a/drivers/of/of_private.h +++ b/drivers/of/of_private.h @@ -42,6 +42,8 @@ extern struct kset *of_kset; int __of_n_addr_cells_parent(struct device_node *parent); int __of_n_size_cells_parent(struct device_node *parent); +struct device_node *__of_get_dma_parent(const struct device_node *np); + #if defined(CONFIG_OF_DYNAMIC) extern int of_property_notify(int action, struct device_node *np, struct property *prop, struct property *old_prop);