diff options
author | Lizhi Hou <lizhi.hou@amd.com> | 2023-08-15 10:19:56 -0700 |
---|---|---|
committer | Rob Herring <robh@kernel.org> | 2023-08-22 14:56:09 -0500 |
commit | b544fc2b8606d718d0cc788ff2ea2492871df488 (patch) | |
tree | 1445d3452f3152d6763edce639e81268d466baef /include/linux/of.h | |
parent | ef04d2801c5d239b83932f8ce97af1d4a1ec1cf7 (diff) |
of: dynamic: Add interfaces for creating device node dynamically
of_changeset_create_node() creates device node dynamically and attaches
the newly created node to a changeset.
Expand of_changeset APIs to handle specific types of properties.
of_changeset_add_prop_string()
of_changeset_add_prop_string_array()
of_changeset_add_prop_u32_array()
Signed-off-by: Clément Léger <clement.leger@bootlin.com>
Signed-off-by: Lizhi Hou <lizhi.hou@amd.com>
Link: https://lore.kernel.org/r/1692120000-46900-2-git-send-email-lizhi.hou@amd.com
Signed-off-by: Rob Herring <robh@kernel.org>
Diffstat (limited to 'include/linux/of.h')
-rw-r--r-- | include/linux/of.h | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/include/linux/of.h b/include/linux/of.h index 7656cc637746..bc2e37f016ec 100644 --- a/include/linux/of.h +++ b/include/linux/of.h @@ -1579,6 +1579,29 @@ static inline int of_changeset_update_property(struct of_changeset *ocs, { return of_changeset_action(ocs, OF_RECONFIG_UPDATE_PROPERTY, np, prop); } + +struct device_node *of_changeset_create_node(struct of_changeset *ocs, + struct device_node *parent, + const char *full_name); +int of_changeset_add_prop_string(struct of_changeset *ocs, + struct device_node *np, + const char *prop_name, const char *str); +int of_changeset_add_prop_string_array(struct of_changeset *ocs, + struct device_node *np, + const char *prop_name, + const char **str_array, size_t sz); +int of_changeset_add_prop_u32_array(struct of_changeset *ocs, + struct device_node *np, + const char *prop_name, + const u32 *array, size_t sz); +static inline int of_changeset_add_prop_u32(struct of_changeset *ocs, + struct device_node *np, + const char *prop_name, + const u32 val) +{ + return of_changeset_add_prop_u32_array(ocs, np, prop_name, &val, 1); +} + #else /* CONFIG_OF_DYNAMIC */ static inline int of_reconfig_notifier_register(struct notifier_block *nb) { |