diff options
author | Herve Codina <herve.codina@bootlin.com> | 2024-05-27 18:14:42 +0200 |
---|---|---|
committer | Rob Herring (Arm) <robh@kernel.org> | 2024-07-09 01:40:30 +0200 |
commit | f2b388d63e6c7c6151bb295e5cbf48a2ac91e51a (patch) | |
tree | b850985764d89c432fa28e58b15097143c860dba /drivers/of/dynamic.c | |
parent | of: unittest: Add tests for changeset properties adding (diff) | |
download | linux-f2b388d63e6c7c6151bb295e5cbf48a2ac91e51a.tar.xz linux-f2b388d63e6c7c6151bb295e5cbf48a2ac91e51a.zip |
of: dynamic: Introduce of_changeset_add_prop_bool()
APIs to add some properties in a changeset exist but nothing to add a DT
boolean property (i.e. a property without any values).
Fill this lack with of_changeset_add_prop_bool().
Signed-off-by: Herve Codina <herve.codina@bootlin.com>
Link: https://lore.kernel.org/r/20240527161450.326615-16-herve.codina@bootlin.com
Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
Diffstat (limited to 'drivers/of/dynamic.c')
-rw-r--r-- | drivers/of/dynamic.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/drivers/of/dynamic.c b/drivers/of/dynamic.c index 70011a98c500..110104a936d9 100644 --- a/drivers/of/dynamic.c +++ b/drivers/of/dynamic.c @@ -1047,3 +1047,28 @@ int of_changeset_add_prop_u32_array(struct of_changeset *ocs, return of_changeset_add_prop_helper(ocs, np, &prop); } EXPORT_SYMBOL_GPL(of_changeset_add_prop_u32_array); + +/** + * of_changeset_add_prop_bool - Add a boolean property (i.e. a property without + * any values) to a changeset. + * + * @ocs: changeset pointer + * @np: device node pointer + * @prop_name: name of the property to be added + * + * Create a boolean property and add it to a changeset. + * + * Return: 0 on success, a negative error value in case of an error. + */ +int of_changeset_add_prop_bool(struct of_changeset *ocs, struct device_node *np, + const char *prop_name) +{ + struct property prop; + + prop.name = (char *)prop_name; + prop.length = 0; + prop.value = NULL; + + return of_changeset_add_prop_helper(ocs, np, &prop); +} +EXPORT_SYMBOL_GPL(of_changeset_add_prop_bool); |