[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220323095022.453708-2-clement.leger@bootlin.com>
Date: Wed, 23 Mar 2022 10:50:21 +0100
From: Clément Léger <clement.leger@...tlin.com>
To: Philipp Zabel <p.zabel@...gutronix.de>,
Rob Herring <robh+dt@...nel.org>,
Frank Rowand <frowand.list@...il.com>
Cc: Thomas Petazzoni <thomas.petazzoni@...tlin.com>,
Alexandre Belloni <alexandre.belloni@...tlin.com>,
Allan Nielsen <allan.nielsen@...rochip.com>,
linux-kernel@...r.kernel.org, devicetree@...r.kernel.org,
Clément Léger <clement.leger@...tlin.com>
Subject: [PATCH 1/2] of: add function to convert fwnode_reference_args to of_phandle_args
Add of_phandle_args_from_fwnode_reference_args() which convert a struct
fwnode_reference_args to an of_phandle_args. This is used to maintain
compatibility for device-tree specifiers translation functions that are
used by various subsystem.
Signed-off-by: Clément Léger <clement.leger@...tlin.com>
---
include/linux/of.h | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/include/linux/of.h b/include/linux/of.h
index 2dc77430a91a..1f6c8927c5ff 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -175,6 +175,18 @@ static inline bool is_of_node(const struct fwnode_handle *fwnode)
&__of_fwnode_handle_node->fwnode : NULL; \
})
+static inline void
+of_phandle_args_from_fwnode_reference_args(struct of_phandle_args *of_args,
+ const struct fwnode_reference_args *fwnode_args)
+{
+ int i;
+
+ of_args->np = to_of_node(fwnode_args->fwnode);
+ of_args->args_count = fwnode_args->nargs;
+ for (i = 0; i < fwnode_args->nargs; i++)
+ of_args->args[i] = fwnode_args->args[i];
+}
+
static inline bool of_have_populated_dt(void)
{
return of_root != NULL;
@@ -543,6 +555,12 @@ static inline struct device_node *of_find_node_with_property(
#define of_fwnode_handle(node) NULL
+static inline void
+of_phandle_args_from_fwnode_reference_args(struct of_phandle_args *of_args,
+ const struct fwnode_reference_args *fwnode_args)
+{
+}
+
static inline bool of_have_populated_dt(void)
{
return false;
--
2.34.1
Powered by blists - more mailing lists