Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Herve Codina and committed by
Rob Herring (Arm)
f2b388d6 aa5545ae

+28
+25
drivers/of/dynamic.c
··· 1047 1047 return of_changeset_add_prop_helper(ocs, np, &prop); 1048 1048 } 1049 1049 EXPORT_SYMBOL_GPL(of_changeset_add_prop_u32_array); 1050 + 1051 + /** 1052 + * of_changeset_add_prop_bool - Add a boolean property (i.e. a property without 1053 + * any values) to a changeset. 1054 + * 1055 + * @ocs: changeset pointer 1056 + * @np: device node pointer 1057 + * @prop_name: name of the property to be added 1058 + * 1059 + * Create a boolean property and add it to a changeset. 1060 + * 1061 + * Return: 0 on success, a negative error value in case of an error. 1062 + */ 1063 + int of_changeset_add_prop_bool(struct of_changeset *ocs, struct device_node *np, 1064 + const char *prop_name) 1065 + { 1066 + struct property prop; 1067 + 1068 + prop.name = (char *)prop_name; 1069 + prop.length = 0; 1070 + prop.value = NULL; 1071 + 1072 + return of_changeset_add_prop_helper(ocs, np, &prop); 1073 + } 1074 + EXPORT_SYMBOL_GPL(of_changeset_add_prop_bool);
+3
include/linux/of.h
··· 1652 1652 return of_changeset_add_prop_u32_array(ocs, np, prop_name, &val, 1); 1653 1653 } 1654 1654 1655 + int of_changeset_add_prop_bool(struct of_changeset *ocs, struct device_node *np, 1656 + const char *prop_name); 1657 + 1655 1658 #else /* CONFIG_OF_DYNAMIC */ 1656 1659 static inline int of_reconfig_notifier_register(struct notifier_block *nb) 1657 1660 {