Lines Matching +full:bool +full:- +full:property
1 /* SPDX-License-Identifier: GPL-2.0+ */
8 * Copyright (C) 1996-2005 Paul Mackerras.
22 #include <linux/property.h>
31 struct property { struct
35 struct property *next; argument
57 struct property *properties; argument
58 struct property *deadprops; /* removed properties */
99 struct property *prop;
100 struct property *old_prop;
109 kobject_init(&node->kobj, &of_node_ktype); in of_node_init()
111 fwnode_init(&node->fwnode, &of_fwnode_ops); in of_node_init()
115 #define of_node_kobj(n) (&(n)->kobj)
124 /* Dummy ref counting routines - to be implemented later */
150 #define OF_BAD_ADDR ((u64)-1)
155 static inline bool is_of_node(const struct fwnode_handle *fwnode) in is_of_node()
157 return !IS_ERR_OR_NULL(fwnode) && fwnode->ops == &of_fwnode_ops; in is_of_node()
175 &__of_fwnode_handle_node->fwnode : NULL; \
178 static inline bool of_have_populated_dt(void) in of_have_populated_dt()
183 static inline bool of_node_is_root(const struct device_node *node) in of_node_is_root()
185 return node && (node->parent == NULL); in of_node_is_root()
190 return test_bit(flag, &n->_flags); in of_node_check_flag()
196 return test_and_set_bit(flag, &n->_flags); in of_node_test_and_set_flag()
201 set_bit(flag, &n->_flags); in of_node_set_flag()
206 clear_bit(flag, &n->_flags); in of_node_clear_flag()
210 static inline int of_property_check_flag(struct property *p, unsigned long flag) in of_property_check_flag()
212 return test_bit(flag, &p->_flags); in of_property_check_flag()
215 static inline void of_property_set_flag(struct property *p, unsigned long flag) in of_property_set_flag()
217 set_bit(flag, &p->_flags); in of_property_set_flag()
220 static inline void of_property_clear_flag(struct property *p, unsigned long flag) in of_property_clear_flag()
222 clear_bit(flag, &p->_flags); in of_property_clear_flag()
237 for (; size--; cell++) in of_read_number()
253 #define OF_IS_DYNAMIC(x) test_bit(OF_DYNAMIC, &x->_flags)
254 #define OF_MARK_DYNAMIC(x) set_bit(OF_DYNAMIC, &x->_flags)
256 extern bool of_node_name_eq(const struct device_node *np, const char *name);
257 extern bool of_node_name_prefix(const struct device_node *np, const char *prefix);
261 return np ? np->full_name : "<no-node>"; in of_node_full_name()
304 extern struct property *of_find_property(const struct device_node *np,
347 extern bool of_device_is_available(const struct device_node *device);
348 extern bool of_device_is_big_endian(const struct device_node *device);
358 for (pp = dn->properties; pp != NULL; pp = pp->next)
402 extern int of_add_property(struct device_node *np, struct property *prop);
403 extern int of_remove_property(struct device_node *np, struct property *prop);
404 extern int of_update_property(struct device_node *np, struct property *newprop);
419 * of_property_read_u8_array - Find and read an array of u8 from a property.
421 * @np: device node from which the property value is to be read.
422 * @propname: name of the property to be searched.
426 * Search for a property in a device node and read 8-bit value(s) from
427 * it. Returns 0 on success, -EINVAL if the property does not exist,
428 * -ENODATA if property does not have a value, and -EOVERFLOW if the
429 * property data isn't large enough.
432 * property = /bits/ 8 <0x50 0x60 0x70>;
449 * of_property_read_u16_array - Find and read an array of u16 from a property.
451 * @np: device node from which the property value is to be read.
452 * @propname: name of the property to be searched.
456 * Search for a property in a device node and read 16-bit value(s) from
457 * it. Returns 0 on success, -EINVAL if the property does not exist,
458 * -ENODATA if property does not have a value, and -EOVERFLOW if the
459 * property data isn't large enough.
462 * property = /bits/ 16 <0x5000 0x6000 0x7000>;
479 * of_property_read_u32_array - Find and read an array of 32 bit integers
480 * from a property.
482 * @np: device node from which the property value is to be read.
483 * @propname: name of the property to be searched.
487 * Search for a property in a device node and read 32-bit value(s) from
488 * it. Returns 0 on success, -EINVAL if the property does not exist,
489 * -ENODATA if property does not have a value, and -EOVERFLOW if the
490 * property data isn't large enough.
507 * of_property_read_u64_array - Find and read an array of 64 bit integers
508 * from a property.
510 * @np: device node from which the property value is to be read.
511 * @propname: name of the property to be searched.
515 * Search for a property in a device node and read 64-bit value(s) from
516 * it. Returns 0 on success, -EINVAL if the property does not exist,
517 * -ENODATA if property does not have a value, and -EOVERFLOW if the
518 * property data isn't large enough.
535 * struct property *prop;
542 const __be32 *of_prop_next_u32(struct property *prop, const __be32 *cur,
545 * struct property *prop;
551 const char *of_prop_next_string(struct property *prop, const char *cur);
553 bool of_console_check(struct device_node *dn, char *name, int index);
569 static inline bool is_of_node(const struct fwnode_handle *fwnode) in is_of_node()
579 static inline bool of_node_name_eq(const struct device_node *np, const char *name) in of_node_name_eq()
584 static inline bool of_node_name_prefix(const struct device_node *np, const char *prefix) in of_node_name_prefix()
591 return "<no-node>"; in of_node_full_name()
660 static inline bool of_have_populated_dt(void) in of_have_populated_dt()
690 static inline bool of_device_is_available(const struct device_node *device) in of_device_is_available()
695 static inline bool of_device_is_big_endian(const struct device_node *device) in of_device_is_big_endian()
700 static inline struct property *of_find_property(const struct device_node *np, in of_find_property()
718 return -ENOSYS; in of_property_count_elems_of_size()
724 return -ENOSYS; in of_property_read_u8_array()
730 return -ENOSYS; in of_property_read_u16_array()
737 return -ENOSYS; in of_property_read_u32_array()
744 return -ENOSYS; in of_property_read_u64_array()
750 return -ENOSYS; in of_property_read_u32_index()
756 return -ENOSYS; in of_property_read_u64_index()
797 return -ENOSYS; in of_property_read_variable_u8_array()
804 return -ENOSYS; in of_property_read_variable_u16_array()
813 return -ENOSYS; in of_property_read_variable_u32_array()
819 return -ENOSYS; in of_property_read_u64()
828 return -ENOSYS; in of_property_read_variable_u64_array()
835 return -ENOSYS; in of_property_read_string()
842 return -ENOSYS; in of_property_match_string()
849 return -ENOSYS; in of_property_read_string_helper()
865 return -ENOSYS; in of_parse_phandle_with_args()
874 return -ENOSYS; in of_parse_phandle_with_args_map()
881 return -ENOSYS; in of_parse_phandle_with_fixed_args()
888 return -ENOSYS; in of_count_phandle_with_args()
897 return -ENOSYS; in of_phandle_iterator_init()
902 return -ENOSYS; in of_phandle_iterator_next()
914 return -ENOSYS; in of_alias_get_id()
919 return -ENOSYS; in of_alias_get_highest_id()
926 return -ENOSYS; in of_alias_get_alias_list()
934 static inline int of_add_property(struct device_node *np, struct property *prop) in of_add_property()
939 static inline int of_remove_property(struct device_node *np, struct property *prop) in of_remove_property()
944 static inline bool of_console_check(const struct device_node *dn, const char *name, int index) in of_console_check()
949 static inline const __be32 *of_prop_next_u32(struct property *prop, in of_prop_next_u32()
955 static inline const char *of_prop_next_string(struct property *prop, in of_prop_next_string()
980 static inline int of_property_check_flag(struct property *p, unsigned long flag) in of_property_check_flag()
985 static inline void of_property_set_flag(struct property *p, unsigned long flag) in of_property_set_flag()
989 static inline void of_property_clear_flag(struct property *p, unsigned long flag) in of_property_clear_flag()
995 return -ENODEV; in of_cpu_node_to_id()
1002 return -EINVAL; in of_map_id()
1021 static inline int of_prop_val_eq(struct property *p1, struct property *p2) in of_prop_val_eq()
1023 return p1->length == p2->length && in of_prop_val_eq()
1024 !memcmp(p1->value, p2->value, (size_t)p1->length); in of_prop_val_eq()
1041 return -ENOSYS; in of_numa_init()
1057 static inline bool of_node_is_type(const struct device_node *np, const char *type) in of_node_is_type()
1065 * of_property_count_u8_elems - Count the number of u8 elements in a property
1067 * @np: device node from which the property value is to be read.
1068 * @propname: name of the property to be searched.
1070 * Search for a property in a device node and count the number of u8 elements
1071 * in it. Returns number of elements on sucess, -EINVAL if the property does
1072 * not exist or its length does not match a multiple of u8 and -ENODATA if the
1073 * property does not have a value.
1082 * of_property_count_u16_elems - Count the number of u16 elements in a property
1084 * @np: device node from which the property value is to be read.
1085 * @propname: name of the property to be searched.
1087 * Search for a property in a device node and count the number of u16 elements
1088 * in it. Returns number of elements on sucess, -EINVAL if the property does
1089 * not exist or its length does not match a multiple of u16 and -ENODATA if the
1090 * property does not have a value.
1099 * of_property_count_u32_elems - Count the number of u32 elements in a property
1101 * @np: device node from which the property value is to be read.
1102 * @propname: name of the property to be searched.
1104 * Search for a property in a device node and count the number of u32 elements
1105 * in it. Returns number of elements on sucess, -EINVAL if the property does
1106 * not exist or its length does not match a multiple of u32 and -ENODATA if the
1107 * property does not have a value.
1116 * of_property_count_u64_elems - Count the number of u64 elements in a property
1118 * @np: device node from which the property value is to be read.
1119 * @propname: name of the property to be searched.
1121 * Search for a property in a device node and count the number of u64 elements
1122 * in it. Returns number of elements on sucess, -EINVAL if the property does
1123 * not exist or its length does not match a multiple of u64 and -ENODATA if the
1124 * property does not have a value.
1133 * of_property_read_string_array() - Read an array of strings from a multiple
1134 * strings property.
1135 * @np: device node from which the property value is to be read.
1136 * @propname: name of the property to be searched.
1140 * Search for a property in a device tree node and retrieve a list of
1141 * terminated string values (pointer to data, not a copy) in that property.
1143 * If @out_strs is NULL, the number of strings in the property is returned.
1153 * of_property_count_strings() - Find and return the number of strings from a
1154 * multiple strings property.
1155 * @np: device node from which the property value is to be read.
1156 * @propname: name of the property to be searched.
1158 * Search for a property in a device tree node and retrieve the number of null
1160 * success, -EINVAL if the property does not exist, -ENODATA if property
1161 * does not have a value, and -EILSEQ if the string is not null-terminated
1162 * within the length of the property data.
1171 * of_property_read_string_index() - Find and read a string from a multiple
1172 * strings property.
1173 * @np: device node from which the property value is to be read.
1174 * @propname: name of the property to be searched.
1179 * Search for a property in a device tree node and retrieve a null
1181 * contained in that property.
1182 * Returns 0 on success, -EINVAL if the property does not exist, -ENODATA if
1183 * property does not have a value, and -EILSEQ if the string is not
1184 * null-terminated within the length of the property data.
1197 * of_property_read_bool - Find a property
1198 * @np: device node from which the property value is to be read.
1199 * @propname: name of the property to be searched.
1201 * Search for a property in a device node.
1202 * Returns true if the property exists false otherwise.
1204 static inline bool of_property_read_bool(const struct device_node *np, in of_property_read_bool()
1207 struct property *prop = of_find_property(np, propname, NULL); in of_property_read_bool()
1338 * struct of_changeset_entry - Holds a changeset entry
1343 * @prop: pointer to the property affected
1344 * @old_prop: hold a pointer to the original property
1355 struct property *prop;
1356 struct property *old_prop;
1360 * struct of_changeset - changeset tracker structure
1365 * live tree. In case of an error, changes are rolled-back.
1392 struct property *prop);
1407 struct device_node *np, struct property *prop) in of_changeset_add_property()
1413 struct device_node *np, struct property *prop) in of_changeset_remove_property()
1419 struct device_node *np, struct property *prop) in of_changeset_update_property()
1426 return -EINVAL; in of_reconfig_notifier_register()
1430 return -EINVAL; in of_reconfig_notifier_unregister()
1435 return -EINVAL; in of_reconfig_notify()
1440 return -EINVAL; in of_reconfig_get_state_change()
1445 * of_device_is_system_power_controller - Tells if system-power-controller is found for device_node
1450 static inline bool of_device_is_system_power_controller(const struct device_node *np) in of_device_is_system_power_controller()
1452 return of_property_read_bool(np, "system-power-controller"); in of_device_is_system_power_controller()
1486 return -ENOTSUPP; in of_overlay_fdt_apply()
1491 return -ENOTSUPP; in of_overlay_remove()
1496 return -ENOTSUPP; in of_overlay_remove_all()