Lines Matching +full:prop +full:-

1 // SPDX-License-Identifier: GPL-2.0
28 * of_node_get() - Increment refcount of a node
37 kobject_get(&node->kobj); in of_node_get()
43 * of_node_put() - Decrement refcount of a node
50 kobject_put(&node->kobj); in of_node_put()
77 #define _do_print(func, prefix, action, node, prop, ...) ({ \ argument
78 func("changeset: " prefix "%-15s %pOF%s%s\n", \
80 prop ? ":" : "", prop ? prop->name : ""); \
90 of_changeset_action_debug("notify: ", action, pr->dn, pr->prop); in of_reconfig_notify()
97 * of_reconfig_get_state_change() - Returns new state of device
98 * @action - action of the of notifier
99 * @arg - argument of the of notifier
109 struct property *prop, *old_prop = NULL; in of_reconfig_get_state_change() local
116 prop = of_find_property(pr->dn, "status", NULL); in of_reconfig_get_state_change()
120 prop = pr->prop; in of_reconfig_get_state_change()
123 prop = pr->prop; in of_reconfig_get_state_change()
124 old_prop = pr->old_prop; in of_reconfig_get_state_change()
131 status_state = -1; in of_reconfig_get_state_change()
132 old_status_state = -1; in of_reconfig_get_state_change()
133 prev_state = -1; in of_reconfig_get_state_change()
134 new_state = -1; in of_reconfig_get_state_change()
136 if (prop && !strcmp(prop->name, "status")) { in of_reconfig_get_state_change()
138 status_state = !strcmp(prop->value, "okay") || in of_reconfig_get_state_change()
139 !strcmp(prop->value, "ok"); in of_reconfig_get_state_change()
141 old_status_state = !strcmp(old_prop->value, "okay") || in of_reconfig_get_state_change()
142 !strcmp(old_prop->value, "ok"); in of_reconfig_get_state_change()
148 /* -1 & 0 status either missing or okay */ in of_reconfig_get_state_change()
152 /* -1 & 0 status either missing or okay */ in of_reconfig_get_state_change()
158 /* no status property -> enabled (legacy) */ in of_reconfig_get_state_change()
166 /* no status property -> enabled (legacy) */ in of_reconfig_get_state_change()
186 struct property *prop, struct property *oldprop) in of_property_notify() argument
195 pr.prop = prop; in of_property_notify()
209 np->name = __of_get_property(np, "name", NULL); in __of_attach_node()
210 if (!np->name) in __of_attach_node()
211 np->name = "<NULL>"; in __of_attach_node()
219 np->phandle = be32_to_cpup(phandle); in __of_attach_node()
221 np->phandle = 0; in __of_attach_node()
224 np->child = NULL; in __of_attach_node()
225 np->sibling = np->parent->child; in __of_attach_node()
226 np->parent->child = np; in __of_attach_node()
228 np->fwnode.flags |= FWNODE_FLAG_NOT_DEVICE; in __of_attach_node()
236 * of_attach_node() - Plug a device node into the tree and global list.
262 parent = np->parent; in __of_detach_node()
268 if (parent->child == np) in __of_detach_node()
269 parent->child = np->sibling; in __of_detach_node()
272 for (prevsib = np->parent->child; in __of_detach_node()
273 prevsib->sibling != np; in __of_detach_node()
274 prevsib = prevsib->sibling) in __of_detach_node()
276 prevsib->sibling = np->sibling; in __of_detach_node()
282 __of_phandle_cache_inv_entry(np->phandle); in __of_detach_node()
290 * of_detach_node() - "Unplug" a node from the device tree.
310 void __of_prop_free(struct property *prop) in __of_prop_free() argument
312 kfree(prop->name); in __of_prop_free()
313 kfree(prop->value); in __of_prop_free()
314 kfree(prop); in __of_prop_free()
319 struct property *prop, *next; in property_list_free() local
321 for (prop = prop_list; prop != NULL; prop = next) { in property_list_free()
322 next = prop->next; in property_list_free()
323 __of_prop_free(prop); in property_list_free()
328 * of_node_release() - release a dynamically allocated node
347 __func__, node->parent, node->full_name); in of_node_release()
356 strcmp(node->parent->full_name, "testcase-data")) { in of_node_release()
358 …e_put() on this node will result in a kobject warning 'refcount_t: underflow; use-after-free.'\n"); in of_node_release()
376 * If node->properties non-empty then properties were added in of_node_release()
378 * yet been removed, or by a non-overlay mechanism. in of_node_release()
380 if (node->properties) in of_node_release()
385 if (node->child) in of_node_release()
387 __func__, node->parent, node->full_name); in of_node_release()
389 property_list_free(node->properties); in of_node_release()
390 property_list_free(node->deadprops); in of_node_release()
393 kfree(node->full_name); in of_node_release()
394 kfree(node->data); in of_node_release()
399 * __of_prop_dup - Copy a property dynamically.
400 * @prop: Property to copy
410 struct property *__of_prop_dup(const struct property *prop, gfp_t allocflags) in __of_prop_dup() argument
424 new->name = kstrdup(prop->name, allocflags); in __of_prop_dup()
425 new->value = kmemdup(prop->value, prop->length, allocflags); in __of_prop_dup()
426 new->length = prop->length; in __of_prop_dup()
427 if (!new->name || !new->value) in __of_prop_dup()
441 * __of_node_dup() - Duplicate or create an empty device node dynamically.
460 node->full_name = kstrdup(full_name, GFP_KERNEL); in __of_node_dup()
461 if (!node->full_name) { in __of_node_dup()
491 * of_changeset_create_node - Dynamically create a device node and attach to
510 np->parent = parent; in of_changeset_create_node()
524 if (ce->action == OF_RECONFIG_ATTACH_NODE && in __of_changeset_entry_destroy()
525 of_node_check_flag(ce->np, OF_OVERLAY)) { in __of_changeset_entry_destroy()
526 if (kref_read(&ce->np->kobj.kref) > 1) { in __of_changeset_entry_destroy()
527 …, expected refcount 1 instead of %d, of_node_get()/of_node_put() unbalanced - destroy cset entry: … in __of_changeset_entry_destroy()
528 kref_read(&ce->np->kobj.kref), ce->np); in __of_changeset_entry_destroy()
530 of_node_set_flag(ce->np, OF_OVERLAY_FREE_CSET); in __of_changeset_entry_destroy()
534 of_node_put(ce->np); in __of_changeset_entry_destroy()
535 list_del(&ce->node); in __of_changeset_entry_destroy()
544 switch (ce->action) { in __of_changeset_entry_invert()
546 rce->action = OF_RECONFIG_DETACH_NODE; in __of_changeset_entry_invert()
549 rce->action = OF_RECONFIG_ATTACH_NODE; in __of_changeset_entry_invert()
552 rce->action = OF_RECONFIG_REMOVE_PROPERTY; in __of_changeset_entry_invert()
555 rce->action = OF_RECONFIG_ADD_PROPERTY; in __of_changeset_entry_invert()
558 rce->old_prop = ce->prop; in __of_changeset_entry_invert()
559 rce->prop = ce->old_prop; in __of_changeset_entry_invert()
561 if (!rce->prop) { in __of_changeset_entry_invert()
562 rce->action = OF_RECONFIG_REMOVE_PROPERTY; in __of_changeset_entry_invert()
563 rce->prop = ce->prop; in __of_changeset_entry_invert()
581 switch (ce->action) { in __of_changeset_entry_notify()
585 rd.dn = ce->np; in __of_changeset_entry_notify()
586 ret = of_reconfig_notify(ce->action, &rd); in __of_changeset_entry_notify()
591 ret = of_property_notify(ce->action, ce->np, ce->prop, ce->old_prop); in __of_changeset_entry_notify()
595 (int)ce->action); in __of_changeset_entry_notify()
596 ret = -EINVAL; in __of_changeset_entry_notify()
600 pr_err("changeset notifier error @%pOF\n", ce->np); in __of_changeset_entry_notify()
608 of_changeset_action_debug("apply: ", ce->action, ce->np, ce->prop); in __of_changeset_entry_apply()
610 switch (ce->action) { in __of_changeset_entry_apply()
612 __of_attach_node(ce->np); in __of_changeset_entry_apply()
615 __of_detach_node(ce->np); in __of_changeset_entry_apply()
618 ret = __of_add_property(ce->np, ce->prop); in __of_changeset_entry_apply()
621 ret = __of_remove_property(ce->np, ce->prop); in __of_changeset_entry_apply()
625 ret = __of_update_property(ce->np, ce->prop, &ce->old_prop); in __of_changeset_entry_apply()
628 ret = -EINVAL; in __of_changeset_entry_apply()
632 of_changeset_action_err("apply failed: ", ce->action, ce->np, ce->prop); in __of_changeset_entry_apply()
648 * of_changeset_init - Initialize a changeset for use
657 INIT_LIST_HEAD(&ocs->entries); in of_changeset_init()
662 * of_changeset_destroy - Destroy a changeset
680 * free any device node that has a non-zero reference count. in of_changeset_destroy()
684 list_for_each_entry_safe_reverse(ce, cen, &ocs->entries, node) in of_changeset_destroy()
705 list_for_each_entry(ce, &ocs->entries, node) { in __of_changeset_apply_entries()
709 list_for_each_entry_continue_reverse(ce, &ocs->entries, in __of_changeset_apply_entries()
737 list_for_each_entry(ce, &ocs->entries, node) { in __of_changeset_apply_notify()
768 * of_changeset_apply - Applies a changeset
773 * Any side-effects of live tree state changes are applied here on
774 * success, like creation/destruction of devices and side-effects
794 * If revert fails, an attempt is made to re-apply the entries that were
797 * If multiple re-apply errors occur then only the final apply error is
809 list_for_each_entry_reverse(ce, &ocs->entries, node) { in __of_changeset_revert_entries()
813 list_for_each_entry_continue(ce, &ocs->entries, node) { in __of_changeset_revert_entries()
838 list_for_each_entry_reverse(ce, &ocs->entries, node) { in __of_changeset_revert_notify()
863 * of_changeset_revert - Reverts an applied changeset
869 * Any side-effects like creation/destruction of devices and
887 * of_changeset_action - Add an action to the tail of the changeset list
892 * @prop: Pointer to property
904 struct device_node *np, struct property *prop) in of_changeset_action() argument
909 return -EINVAL; in of_changeset_action()
913 return -ENOMEM; in of_changeset_action()
916 ce->action = action; in of_changeset_action()
917 ce->np = of_node_get(np); in of_changeset_action()
918 ce->prop = prop; in of_changeset_action()
921 list_add_tail(&ce->node, &ocs->entries); in of_changeset_action()
935 return -ENOMEM; in of_changeset_add_prop_helper()
945 * of_changeset_add_prop_string - Add a string property to a changeset
960 struct property prop; in of_changeset_add_prop_string() local
962 prop.name = (char *)prop_name; in of_changeset_add_prop_string()
963 prop.length = strlen(str) + 1; in of_changeset_add_prop_string()
964 prop.value = (void *)str; in of_changeset_add_prop_string()
966 return of_changeset_add_prop_helper(ocs, np, &prop); in of_changeset_add_prop_string()
971 * of_changeset_add_prop_string_array - Add a string list property to
989 struct property prop; in of_changeset_add_prop_string_array() local
993 prop.name = (char *)prop_name; in of_changeset_add_prop_string_array()
995 prop.length = 0; in of_changeset_add_prop_string_array()
997 prop.length += strlen(str_array[i]) + 1; in of_changeset_add_prop_string_array()
999 prop.value = kmalloc(prop.length, GFP_KERNEL); in of_changeset_add_prop_string_array()
1000 if (!prop.value) in of_changeset_add_prop_string_array()
1001 return -ENOMEM; in of_changeset_add_prop_string_array()
1003 vp = prop.value; in of_changeset_add_prop_string_array()
1005 vp += snprintf(vp, (char *)prop.value + prop.length - vp, "%s", in of_changeset_add_prop_string_array()
1008 ret = of_changeset_add_prop_helper(ocs, np, &prop); in of_changeset_add_prop_string_array()
1009 kfree(prop.value); in of_changeset_add_prop_string_array()
1016 * of_changeset_add_prop_u32_array - Add a property of 32 bit integers
1034 struct property prop; in of_changeset_add_prop_u32_array() local
1039 return -ENOMEM; in of_changeset_add_prop_u32_array()
1043 prop.name = (char *)prop_name; in of_changeset_add_prop_u32_array()
1044 prop.length = sizeof(u32) * sz; in of_changeset_add_prop_u32_array()
1045 prop.value = (void *)val; in of_changeset_add_prop_u32_array()
1047 return of_changeset_add_prop_helper(ocs, np, &prop); in of_changeset_add_prop_u32_array()
1052 * of_changeset_add_prop_bool - Add a boolean property (i.e. a property without
1066 struct property prop; in of_changeset_add_prop_bool() local
1068 prop.name = (char *)prop_name; in of_changeset_add_prop_bool()
1069 prop.length = 0; in of_changeset_add_prop_bool()
1070 prop.value = NULL; in of_changeset_add_prop_bool()
1072 return of_changeset_add_prop_helper(ocs, np, &prop); in of_changeset_add_prop_bool()
1085 return -ENOMEM; in of_changeset_update_prop_helper()
1095 * of_changeset_update_prop_string - Add a string property update to a changeset
1110 struct property prop = { in of_changeset_update_prop_string() local
1116 return of_changeset_update_prop_helper(ocs, np, &prop); in of_changeset_update_prop_string()