Lines Matching +full:string +full:- +full:array +full:- +full:property
1 /* SPDX-License-Identifier: GPL-2.0+ */
8 * Copyright (C) 1996-2005 Paul Mackerras.
19 #include <linux/property.h>
27 struct property { struct
31 struct property *next; argument
53 struct property *properties; argument
54 struct property *deadprops; /* removed properties */
95 struct property *prop;
96 struct property *old_prop;
103 * of_node_init - initialize a devicetree node
109 * whether to free the memory will be done by node->release(), which is
115 kobject_init(&node->kobj, &of_node_ktype); in of_node_init()
117 fwnode_init(&node->fwnode, &of_fwnode_ops); in of_node_init()
121 #define of_node_kobj(n) (&(n)->kobj)
130 /* Dummy ref counting routines - to be implemented later */
155 #define OF_BAD_ADDR ((u64)-1)
162 return !IS_ERR_OR_NULL(fwnode) && fwnode->ops == &of_fwnode_ops; in is_of_node()
180 &__of_fwnode_handle_node->fwnode : NULL; \
190 return node && (node->parent == NULL); in of_node_is_root()
195 return test_bit(flag, &n->_flags); in of_node_check_flag()
201 return test_and_set_bit(flag, &n->_flags); in of_node_test_and_set_flag()
206 set_bit(flag, &n->_flags); in of_node_set_flag()
211 clear_bit(flag, &n->_flags); in of_node_clear_flag()
215 static inline int of_property_check_flag(const struct property *p, unsigned long flag) in of_property_check_flag()
217 return test_bit(flag, &p->_flags); in of_property_check_flag()
220 static inline void of_property_set_flag(struct property *p, unsigned long flag) in of_property_set_flag()
222 set_bit(flag, &p->_flags); in of_property_set_flag()
225 static inline void of_property_clear_flag(struct property *p, unsigned long flag) in of_property_clear_flag()
227 clear_bit(flag, &p->_flags); in of_property_clear_flag()
242 for (; size--; cell++) in of_read_number()
258 #define OF_IS_DYNAMIC(x) test_bit(OF_DYNAMIC, &x->_flags)
259 #define OF_MARK_DYNAMIC(x) set_bit(OF_DYNAMIC, &x->_flags)
266 return np ? np->full_name : "<no-node>"; in of_node_full_name()
309 extern struct property *of_find_property(const struct device_node *np,
344 const char *string);
366 for (pp = dn->properties; pp != NULL; pp = pp->next)
407 extern int of_add_property(struct device_node *np, struct property *prop);
408 extern int of_remove_property(struct device_node *np, struct property *prop);
409 extern int of_update_property(struct device_node *np, struct property *newprop);
424 * struct property *prop;
431 const __be32 *of_prop_next_u32(struct property *prop, const __be32 *cur,
434 * struct property *prop;
438 * printk("String value: %s\n", s);
440 const char *of_prop_next_string(struct property *prop, const char *cur);
483 return "<no-node>"; in of_node_full_name()
592 static inline struct property *of_find_property(const struct device_node *np, in of_find_property()
610 return -ENOSYS; in of_property_count_elems_of_size()
616 return -ENOSYS; in of_property_read_u32_index()
622 return -ENOSYS; in of_property_read_u64_index()
645 return -ENODEV; in of_cpu_node_to_id()
673 return -ENOSYS; in of_property_read_variable_u8_array()
680 return -ENOSYS; in of_property_read_variable_u16_array()
689 return -ENOSYS; in of_property_read_variable_u32_array()
695 return -ENOSYS; in of_property_read_u64()
704 return -ENOSYS; in of_property_read_variable_u64_array()
711 return -ENOSYS; in of_property_read_string()
716 const char *string) in of_property_match_string() argument
718 return -ENOSYS; in of_property_match_string()
725 return -ENOSYS; in of_property_read_string_helper()
735 return -ENOSYS; in __of_parse_phandle_with_args()
744 return -ENOSYS; in of_parse_phandle_with_args_map()
751 return -ENOSYS; in of_count_phandle_with_args()
757 return -ENODEV; in of_modalias()
762 return -ENODEV; in of_request_module()
771 return -ENOSYS; in of_phandle_iterator_init()
776 return -ENOSYS; in of_phandle_iterator_next()
788 return -ENOSYS; in of_alias_get_id()
793 return -ENOSYS; in of_alias_get_highest_id()
801 static inline int of_add_property(struct device_node *np, struct property *prop) in of_add_property()
806 static inline int of_remove_property(struct device_node *np, struct property *prop) in of_remove_property()
816 static inline const __be32 *of_prop_next_u32(struct property *prop, in of_prop_next_u32()
822 static inline const char *of_prop_next_string(struct property *prop, in of_prop_next_string()
847 static inline int of_property_check_flag(const struct property *p, in of_property_check_flag()
853 static inline void of_property_set_flag(struct property *p, unsigned long flag) in of_property_set_flag()
857 static inline void of_property_clear_flag(struct property *p, unsigned long flag) in of_property_clear_flag()
865 return -EINVAL; in of_map_id()
882 /* Default string compare functions, Allow arch asm/prom.h to override */
889 static inline int of_prop_val_eq(struct property *p1, struct property *p2) in of_prop_val_eq()
891 return p1->length == p2->length && in of_prop_val_eq()
892 !memcmp(p1->value, p2->value, (size_t)p1->length); in of_prop_val_eq()
909 return -ENOSYS; in of_numa_init()
933 * of_parse_phandle - Resolve a phandle property to a device_node pointer
934 * @np: Pointer to device node holding phandle property
935 * @phandle_name: Name of property holding a phandle value
956 * of_parse_phandle_with_args() - Find a node pointed by phandle in a list
958 * @list_name: property name that contains a list
959 * @cells_name: property name that specifies phandles' arguments count
967 * Caller is responsible to call of_node_put() on the returned out_args->np
973 * #list-cells = <2>;
977 * #list-cells = <1>;
985 * of_parse_phandle_with_args(node3, "list", "#list-cells", 1, &args);
993 int cell_count = -1; in of_parse_phandle_with_args()
1004 * of_parse_phandle_with_fixed_args() - Find a node pointed by phandle in a list
1006 * @list_name: property name that contains a list
1015 * Caller is responsible to call of_node_put() on the returned out_args->np
1044 * of_parse_phandle_with_optional_args() - Find a node pointed by phandle in a list
1046 * @list_name: property name that contains a list
1047 * @cells_name: property name that specifies phandles' arguments count
1051 * Same as of_parse_phandle_with_args() except that if the cells_name property
1055 * before and thus doesn't have a '#*-cells' property but is now migrated to
1069 * of_property_count_u8_elems - Count the number of u8 elements in a property
1071 * @np: device node from which the property value is to be read.
1072 * @propname: name of the property to be searched.
1074 * Search for a property in a device node and count the number of u8 elements
1077 * Return: The number of elements on sucess, -EINVAL if the property does
1078 * not exist or its length does not match a multiple of u8 and -ENODATA if the
1079 * property does not have a value.
1088 * of_property_count_u16_elems - Count the number of u16 elements in a property
1090 * @np: device node from which the property value is to be read.
1091 * @propname: name of the property to be searched.
1093 * Search for a property in a device node and count the number of u16 elements
1096 * Return: The number of elements on sucess, -EINVAL if the property does
1097 * not exist or its length does not match a multiple of u16 and -ENODATA if the
1098 * property does not have a value.
1107 * of_property_count_u32_elems - Count the number of u32 elements in a property
1109 * @np: device node from which the property value is to be read.
1110 * @propname: name of the property to be searched.
1112 * Search for a property in a device node and count the number of u32 elements
1115 * Return: The number of elements on sucess, -EINVAL if the property does
1116 * not exist or its length does not match a multiple of u32 and -ENODATA if the
1117 * property does not have a value.
1126 * of_property_count_u64_elems - Count the number of u64 elements in a property
1128 * @np: device node from which the property value is to be read.
1129 * @propname: name of the property to be searched.
1131 * Search for a property in a device node and count the number of u64 elements
1134 * Return: The number of elements on sucess, -EINVAL if the property does
1135 * not exist or its length does not match a multiple of u64 and -ENODATA if the
1136 * property does not have a value.
1145 * of_property_read_string_array() - Read an array of strings from a multiple
1146 * strings property.
1147 * @np: device node from which the property value is to be read.
1148 * @propname: name of the property to be searched.
1149 * @out_strs: output array of string pointers.
1150 * @sz: number of array elements to read.
1152 * Search for a property in a device tree node and retrieve a list of
1153 * terminated string values (pointer to data, not a copy) in that property.
1155 * Return: If @out_strs is NULL, the number of strings in the property is returned.
1165 * of_property_count_strings() - Find and return the number of strings from a
1166 * multiple strings property.
1167 * @np: device node from which the property value is to be read.
1168 * @propname: name of the property to be searched.
1170 * Search for a property in a device tree node and retrieve the number of null
1171 * terminated string contain in it.
1173 * Return: The number of strings on success, -EINVAL if the property does not
1174 * exist, -ENODATA if property does not have a value, and -EILSEQ if the string
1175 * is not null-terminated within the length of the property data.
1184 * of_property_read_string_index() - Find and read a string from a multiple
1185 * strings property.
1186 * @np: device node from which the property value is to be read.
1187 * @propname: name of the property to be searched.
1188 * @index: index of the string in the list of strings
1189 * @output: pointer to null terminated return string, modified only if
1192 * Search for a property in a device tree node and retrieve a null
1193 * terminated string value (pointer to data, not a copy) in the list of strings
1194 * contained in that property.
1196 * Return: 0 on success, -EINVAL if the property does not exist, -ENODATA if
1197 * property does not have a value, and -EILSEQ if the string is not
1198 * null-terminated within the length of the property data.
1200 * The out_string pointer is modified only if a valid string can be decoded.
1211 * of_property_read_bool - Find a property
1212 * @np: device node from which the property value is to be read.
1213 * @propname: name of the property to be searched.
1215 * Search for a boolean property in a device node. Usage on non-boolean
1216 * property types is deprecated.
1218 * Return: true if the property exists false otherwise.
1223 struct property *prop = of_find_property(np, propname, NULL); in of_property_read_bool()
1229 * of_property_present - Test if a property is present in a node
1230 * @np: device node to search for the property.
1231 * @propname: name of the property to be searched.
1233 * Test for a property present in a device node.
1235 * Return: true if the property exists false otherwise.
1243 * of_property_read_u8_array - Find and read an array of u8 from a property.
1245 * @np: device node from which the property value is to be read.
1246 * @propname: name of the property to be searched.
1248 * @sz: number of array elements to read
1250 * Search for a property in a device node and read 8-bit value(s) from
1253 * dts entry of array should be like:
1254 * ``property = /bits/ 8 <0x50 0x60 0x70>;``
1256 * Return: 0 on success, -EINVAL if the property does not exist,
1257 * -ENODATA if property does not have a value, and -EOVERFLOW if the
1258 * property data isn't large enough.
1275 * of_property_read_u16_array - Find and read an array of u16 from a property.
1277 * @np: device node from which the property value is to be read.
1278 * @propname: name of the property to be searched.
1280 * @sz: number of array elements to read
1282 * Search for a property in a device node and read 16-bit value(s) from
1285 * dts entry of array should be like:
1286 * ``property = /bits/ 16 <0x5000 0x6000 0x7000>;``
1288 * Return: 0 on success, -EINVAL if the property does not exist,
1289 * -ENODATA if property does not have a value, and -EOVERFLOW if the
1290 * property data isn't large enough.
1307 * of_property_read_u32_array - Find and read an array of 32 bit integers
1308 * from a property.
1310 * @np: device node from which the property value is to be read.
1311 * @propname: name of the property to be searched.
1313 * @sz: number of array elements to read
1315 * Search for a property in a device node and read 32-bit value(s) from
1318 * Return: 0 on success, -EINVAL if the property does not exist,
1319 * -ENODATA if property does not have a value, and -EOVERFLOW if the
1320 * property data isn't large enough.
1337 * of_property_read_u64_array - Find and read an array of 64 bit integers
1338 * from a property.
1340 * @np: device node from which the property value is to be read.
1341 * @propname: name of the property to be searched.
1343 * @sz: number of array elements to read
1345 * Search for a property in a device node and read 64-bit value(s) from
1348 * Return: 0 on success, -EINVAL if the property does not exist,
1349 * -ENODATA if property does not have a value, and -EOVERFLOW if the
1350 * property data isn't large enough.
1495 * struct of_changeset_entry - Holds a changeset entry
1500 * @prop: pointer to the property affected
1501 * @old_prop: hold a pointer to the original property
1512 struct property *prop;
1513 struct property *old_prop;
1517 * struct of_changeset - changeset tracker structure
1522 * live tree. In case of an error, changes are rolled-back.
1551 struct property *prop);
1566 struct device_node *np, struct property *prop) in of_changeset_add_property()
1572 struct device_node *np, struct property *prop) in of_changeset_remove_property()
1578 struct device_node *np, struct property *prop) in of_changeset_update_property()
1596 const u32 *array, size_t sz);
1608 return -EINVAL; in of_reconfig_notifier_register()
1612 return -EINVAL; in of_reconfig_notifier_unregister()
1617 return -EINVAL; in of_reconfig_notify()
1622 return -EINVAL; in of_reconfig_get_state_change()
1627 * of_device_is_system_power_controller - Tells if system-power-controller is found for device_node
1634 return of_property_read_bool(np, "system-power-controller"); in of_device_is_system_power_controller()
1653 "pre-apply", in of_overlay_action_name()
1654 "post-apply", in of_overlay_action_name()
1655 "pre-remove", in of_overlay_action_name()
1656 "post-remove", in of_overlay_action_name()
1682 return -ENOTSUPP; in of_overlay_fdt_apply()
1687 return -ENOTSUPP; in of_overlay_remove()
1692 return -ENOTSUPP; in of_overlay_remove_all()