[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190924181244.7159-6-nsaenzjulienne@suse.de>
Date: Tue, 24 Sep 2019 20:12:36 +0200
From: Nicolas Saenz Julienne <nsaenzjulienne@...e.de>
To: robh+dt@...nel.org, devicetree@...r.kernel.org,
frowand.list@...il.com, linux-arm-kernel@...ts.infradead.org,
linux-wireless@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-arm-msm@...r.kernel.org, dmaengine@...r.kernel.org,
etnaviv@...ts.freedesktop.org, dri-devel@...ts.freedesktop.org,
xen-devel@...ts.xenproject.org, linux-tegra@...r.kernel.org,
linux-media@...r.kernel.org, linux-pci@...r.kernel.org
Cc: mbrugger@...e.com, robin.murphy@....com, f.fainelli@...il.com,
james.quinlan@...adcom.com, wahrenst@....net,
Nicolas Saenz Julienne <nsaenzjulienne@...e.de>
Subject: [PATCH 05/11] of: expose __of_get_dma_parent() to OF subsystem
The function was only available locally to of/address.c, make it
available to the OF subsystem.
Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@...e.de>
---
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);
--
2.23.0
Powered by blists - more mailing lists