@@ -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)
{
@@ -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
@@ -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);
The function was only available locally to of/address.c, make it available to the OF subsystem. Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de> --- drivers/of/address.c | 18 ------------------ drivers/of/base.c | 25 +++++++++++++++++++++++++ drivers/of/of_private.h | 2 ++ 3 files changed, 27 insertions(+), 18 deletions(-)