Lines Matching +full:bool +full:- +full:property

1 /* SPDX-License-Identifier: GPL-2.0+ */
8 * Copyright (C) 1996-2005 Paul Mackerras.
20 #include <linux/property.h>
28 struct property { struct
32 struct property *next; argument
54 struct property *properties; argument
55 struct property *deadprops; /* removed properties */
96 struct property *prop;
97 struct property *old_prop;
104 * of_node_init - initialize a devicetree node
110 * whether to free the memory will be done by node->release(), which is
116 kobject_init(&node->kobj, &of_node_ktype); in of_node_init()
118 fwnode_init(&node->fwnode, &of_fwnode_ops); in of_node_init()
122 #define of_node_kobj(n) (&(n)->kobj)
131 /* Dummy ref counting routines - to be implemented later */
157 #define OF_BAD_ADDR ((u64)-1)
162 static inline bool is_of_node(const struct fwnode_handle *fwnode) in is_of_node()
164 return !IS_ERR_OR_NULL(fwnode) && fwnode->ops == &of_fwnode_ops; in is_of_node()
182 &__of_fwnode_handle_node->fwnode : NULL; \
185 static inline bool of_node_is_root(const struct device_node *node) in of_node_is_root()
187 return node && (node->parent == NULL); in of_node_is_root()
192 return test_bit(flag, &n->_flags); in of_node_check_flag()
198 return test_and_set_bit(flag, &n->_flags); in of_node_test_and_set_flag()
203 set_bit(flag, &n->_flags); in of_node_set_flag()
208 clear_bit(flag, &n->_flags); in of_node_clear_flag()
212 static inline int of_property_check_flag(const struct property *p, unsigned long flag) in of_property_check_flag()
214 return test_bit(flag, &p->_flags); in of_property_check_flag()
217 static inline void of_property_set_flag(struct property *p, unsigned long flag) in of_property_set_flag()
219 set_bit(flag, &p->_flags); in of_property_set_flag()
222 static inline void of_property_clear_flag(struct property *p, unsigned long flag) in of_property_clear_flag()
224 clear_bit(flag, &p->_flags); in of_property_clear_flag()
239 for (; size--; cell++) in of_read_number()
255 #define OF_IS_DYNAMIC(x) test_bit(OF_DYNAMIC, &x->_flags)
256 #define OF_MARK_DYNAMIC(x) set_bit(OF_DYNAMIC, &x->_flags)
258 extern bool of_node_name_eq(const struct device_node *np, const char *name);
259 extern bool of_node_name_prefix(const struct device_node *np, const char *prefix);
263 return np ? np->full_name : "<no-node>"; in of_node_full_name()
311 extern struct property *of_find_property(const struct device_node *np,
314 extern bool of_property_read_bool(const struct device_node *np, const char *propname);
355 extern bool of_device_is_available(const struct device_node *device);
356 extern bool of_device_is_big_endian(const struct device_node *device);
404 bool of_machine_compatible_match(const char *const *compats);
407 * of_machine_is_compatible - Test root of device tree for a given compatible value
408 * @compat: compatible string to look for in root node's compatible property.
410 * Return: true if the root node has the given value in its compatible property.
412 static inline bool of_machine_is_compatible(const char *compat) in of_machine_is_compatible()
419 extern int of_add_property(struct device_node *np, struct property *prop);
420 extern int of_remove_property(struct device_node *np, struct property *prop);
421 extern int of_update_property(struct device_node *np, struct property *newprop);
441 const __be32 *of_prop_next_u32(const struct property *prop, const __be32 *cur,
444 * struct property *prop;
450 const char *of_prop_next_string(const struct property *prop, const char *cur);
452 bool of_console_check(const struct device_node *dn, char *name, int index);
471 static inline bool is_of_node(const struct fwnode_handle *fwnode) in is_of_node()
481 static inline bool of_node_name_eq(const struct device_node *np, const char *name) in of_node_name_eq()
486 static inline bool of_node_name_prefix(const struct device_node *np, const char *prefix) in of_node_name_prefix()
493 return "<no-node>"; in of_node_full_name()
593 static inline bool of_device_is_available(const struct device_node *device) in of_device_is_available()
598 static inline bool of_device_is_big_endian(const struct device_node *device) in of_device_is_big_endian()
603 static inline struct property *of_find_property(const struct device_node *np, in of_find_property()
618 static inline bool of_property_read_bool(const struct device_node *np, in of_property_read_bool()
627 return -ENOSYS; in of_property_count_elems_of_size()
633 return -ENOSYS; in of_property_read_u32_index()
639 return -ENOSYS; in of_property_read_u64_index()
662 return -ENODEV; in of_cpu_node_to_id()
690 return -ENOSYS; in of_property_read_variable_u8_array()
697 return -ENOSYS; in of_property_read_variable_u16_array()
706 return -ENOSYS; in of_property_read_variable_u32_array()
712 return -ENOSYS; in of_property_read_u64()
721 return -ENOSYS; in of_property_read_variable_u64_array()
728 return -ENOSYS; in of_property_read_string()
735 return -ENOSYS; in of_property_match_string()
742 return -ENOSYS; in of_property_read_string_helper()
752 return -ENOSYS; in __of_parse_phandle_with_args()
761 return -ENOSYS; in of_parse_phandle_with_args_map()
768 return -ENOSYS; in of_count_phandle_with_args()
774 return -ENODEV; in of_modalias()
779 return -ENODEV; in of_request_module()
788 return -ENOSYS; in of_phandle_iterator_init()
793 return -ENOSYS; in of_phandle_iterator_next()
805 return -ENOSYS; in of_alias_get_id()
810 return -ENOSYS; in of_alias_get_highest_id()
818 static inline int of_add_property(struct device_node *np, struct property *prop) in of_add_property()
823 static inline int of_remove_property(struct device_node *np, struct property *prop) in of_remove_property()
828 static inline bool of_machine_compatible_match(const char *const *compats) in of_machine_compatible_match()
833 static inline bool of_console_check(const struct device_node *dn, const char *name, int index) in of_console_check()
838 static inline const __be32 *of_prop_next_u32(const struct property *prop, in of_prop_next_u32()
844 static inline const char *of_prop_next_string(const struct property *prop, in of_prop_next_string()
869 static inline int of_property_check_flag(const struct property *p, in of_property_check_flag()
875 static inline void of_property_set_flag(struct property *p, unsigned long flag) in of_property_set_flag()
879 static inline void of_property_clear_flag(struct property *p, unsigned long flag) in of_property_clear_flag()
887 return -EINVAL; in of_map_id()
911 static inline int of_prop_val_eq(const struct property *p1, const struct property *p2) in of_prop_val_eq()
913 return p1->length == p2->length && in of_prop_val_eq()
914 !memcmp(p1->value, p2->value, (size_t)p1->length); in of_prop_val_eq()
918 for (pp = dn->properties; pp != NULL; pp = pp->next)
934 return -ENOSYS; in of_numa_init()
950 static inline bool of_node_is_type(const struct device_node *np, const char *type) in of_node_is_type()
958 * of_parse_phandle - Resolve a phandle property to a device_node pointer
959 * @np: Pointer to device node holding phandle property
960 * @phandle_name: Name of property holding a phandle value
981 * of_parse_phandle_with_args() - Find a node pointed by phandle in a list
983 * @list_name: property name that contains a list
984 * @cells_name: property name that specifies phandles' arguments count
992 * Caller is responsible to call of_node_put() on the returned out_args->np
998 * #list-cells = <2>;
1002 * #list-cells = <1>;
1010 * of_parse_phandle_with_args(node3, "list", "#list-cells", 1, &args);
1018 int cell_count = -1; in of_parse_phandle_with_args()
1029 * of_parse_phandle_with_fixed_args() - Find a node pointed by phandle in a list
1031 * @list_name: property name that contains a list
1040 * Caller is responsible to call of_node_put() on the returned out_args->np
1069 * of_parse_phandle_with_optional_args() - Find a node pointed by phandle in a list
1071 * @list_name: property name that contains a list
1072 * @cells_name: property name that specifies phandles' arguments count
1076 * Same as of_parse_phandle_with_args() except that if the cells_name property
1080 * before and thus doesn't have a '#*-cells' property but is now migrated to
1094 * of_phandle_args_equal() - Compare two of_phandle_args
1101 static inline bool of_phandle_args_equal(const struct of_phandle_args *a1, in of_phandle_args_equal()
1104 return a1->np == a2->np && in of_phandle_args_equal()
1105 a1->args_count == a2->args_count && in of_phandle_args_equal()
1106 !memcmp(a1->args, a2->args, sizeof(a1->args[0]) * a1->args_count); in of_phandle_args_equal()
1110 * of_property_count_u8_elems - Count the number of u8 elements in a property
1112 * @np: device node from which the property value is to be read.
1113 * @propname: name of the property to be searched.
1115 * Search for a property in a device node and count the number of u8 elements
1118 * Return: The number of elements on sucess, -EINVAL if the property does
1119 * not exist or its length does not match a multiple of u8 and -ENODATA if the
1120 * property does not have a value.
1129 * of_property_count_u16_elems - Count the number of u16 elements in a property
1131 * @np: device node from which the property value is to be read.
1132 * @propname: name of the property to be searched.
1134 * Search for a property in a device node and count the number of u16 elements
1137 * Return: The number of elements on sucess, -EINVAL if the property does
1138 * not exist or its length does not match a multiple of u16 and -ENODATA if the
1139 * property does not have a value.
1148 * of_property_count_u32_elems - Count the number of u32 elements in a property
1150 * @np: device node from which the property value is to be read.
1151 * @propname: name of the property to be searched.
1153 * Search for a property in a device node and count the number of u32 elements
1156 * Return: The number of elements on sucess, -EINVAL if the property does
1157 * not exist or its length does not match a multiple of u32 and -ENODATA if the
1158 * property does not have a value.
1167 * of_property_count_u64_elems - Count the number of u64 elements in a property
1169 * @np: device node from which the property value is to be read.
1170 * @propname: name of the property to be searched.
1172 * Search for a property in a device node and count the number of u64 elements
1175 * Return: The number of elements on sucess, -EINVAL if the property does
1176 * not exist or its length does not match a multiple of u64 and -ENODATA if the
1177 * property does not have a value.
1186 * of_property_read_string_array() - Read an array of strings from a multiple
1187 * strings property.
1188 * @np: device node from which the property value is to be read.
1189 * @propname: name of the property to be searched.
1193 * Search for a property in a device tree node and retrieve a list of
1194 * terminated string values (pointer to data, not a copy) in that property.
1196 * Return: If @out_strs is NULL, the number of strings in the property is returned.
1206 * of_property_count_strings() - Find and return the number of strings from a
1207 * multiple strings property.
1208 * @np: device node from which the property value is to be read.
1209 * @propname: name of the property to be searched.
1211 * Search for a property in a device tree node and retrieve the number of null
1214 * Return: The number of strings on success, -EINVAL if the property does not
1215 * exist, -ENODATA if property does not have a value, and -EILSEQ if the string
1216 * is not null-terminated within the length of the property data.
1225 * of_property_read_string_index() - Find and read a string from a multiple
1226 * strings property.
1227 * @np: device node from which the property value is to be read.
1228 * @propname: name of the property to be searched.
1233 * Search for a property in a device tree node and retrieve a null
1235 * contained in that property.
1237 * Return: 0 on success, -EINVAL if the property does not exist, -ENODATA if
1238 * property does not have a value, and -EILSEQ if the string is not
1239 * null-terminated within the length of the property data.
1252 * of_property_present - Test if a property is present in a node
1253 * @np: device node to search for the property.
1254 * @propname: name of the property to be searched.
1256 * Test for a property present in a device node.
1258 * Return: true if the property exists false otherwise.
1260 static inline bool of_property_present(const struct device_node *np, const char *propname) in of_property_present()
1262 struct property *prop = of_find_property(np, propname, NULL); in of_property_present()
1268 * of_property_read_u8_array - Find and read an array of u8 from a property.
1270 * @np: device node from which the property value is to be read.
1271 * @propname: name of the property to be searched.
1275 * Search for a property in a device node and read 8-bit value(s) from
1279 * ``property = /bits/ 8 <0x50 0x60 0x70>;``
1281 * Return: 0 on success, -EINVAL if the property does not exist,
1282 * -ENODATA if property does not have a value, and -EOVERFLOW if the
1283 * property data isn't large enough.
1300 * of_property_read_u16_array - Find and read an array of u16 from a property.
1302 * @np: device node from which the property value is to be read.
1303 * @propname: name of the property to be searched.
1307 * Search for a property in a device node and read 16-bit value(s) from
1311 * ``property = /bits/ 16 <0x5000 0x6000 0x7000>;``
1313 * Return: 0 on success, -EINVAL if the property does not exist,
1314 * -ENODATA if property does not have a value, and -EOVERFLOW if the
1315 * property data isn't large enough.
1332 * of_property_read_u32_array - Find and read an array of 32 bit integers
1333 * from a property.
1335 * @np: device node from which the property value is to be read.
1336 * @propname: name of the property to be searched.
1340 * Search for a property in a device node and read 32-bit value(s) from
1343 * Return: 0 on success, -EINVAL if the property does not exist,
1344 * -ENODATA if property does not have a value, and -EOVERFLOW if the
1345 * property data isn't large enough.
1362 * of_property_read_u64_array - Find and read an array of 64 bit integers
1363 * from a property.
1365 * @np: device node from which the property value is to be read.
1366 * @propname: name of the property to be searched.
1370 * Search for a property in a device node and read 64-bit value(s) from
1373 * Return: 0 on success, -EINVAL if the property does not exist,
1374 * -ENODATA if property does not have a value, and -EOVERFLOW if the
1375 * property data isn't large enough.
1426 for (struct {const struct property *prop; const __be32 *item; } _it = \
1543 * struct of_changeset_entry - Holds a changeset entry
1548 * @prop: pointer to the property affected
1549 * @old_prop: hold a pointer to the original property
1560 struct property *prop;
1561 struct property *old_prop;
1565 * struct of_changeset - changeset tracker structure
1570 * live tree. In case of an error, changes are rolled-back.
1599 struct property *prop);
1614 struct device_node *np, struct property *prop) in of_changeset_add_property()
1620 struct device_node *np, struct property *prop) in of_changeset_remove_property()
1626 struct device_node *np, struct property *prop) in of_changeset_update_property()
1663 return -EINVAL; in of_reconfig_notifier_register()
1667 return -EINVAL; in of_reconfig_notifier_unregister()
1672 return -EINVAL; in of_reconfig_notify()
1677 return -EINVAL; in of_reconfig_get_state_change()
1682 * of_device_is_system_power_controller - Tells if system-power-controller is found for device_node
1687 static inline bool of_device_is_system_power_controller(const struct device_node *np) in of_device_is_system_power_controller()
1689 return of_property_read_bool(np, "system-power-controller"); in of_device_is_system_power_controller()
1693 * of_have_populated_dt() - Has DT been populated by bootloader
1698 static inline bool of_have_populated_dt(void) in of_have_populated_dt()
1723 "pre-apply", in of_overlay_action_name()
1724 "post-apply", in of_overlay_action_name()
1725 "pre-remove", in of_overlay_action_name()
1726 "post-remove", in of_overlay_action_name()
1752 return -ENOTSUPP; in of_overlay_fdt_apply()
1757 return -ENOTSUPP; in of_overlay_remove()
1762 return -ENOTSUPP; in of_overlay_remove_all()