Lines Matching refs:ovcs

98 static int build_changeset_next_level(struct overlay_changeset *ovcs,
155 static int overlay_notify(struct overlay_changeset *ovcs, in overlay_notify() argument
161 ovcs->notify_state = action; in overlay_notify()
163 for (i = 0; i < ovcs->count; i++) { in overlay_notify()
164 struct fragment *fragment = &ovcs->fragments[i]; in overlay_notify()
196 struct overlay_changeset *ovcs, const struct property *prop) in dup_and_fixup_symbol_prop() argument
220 fragment_node = __of_find_node_by_path(ovcs->overlay_root, path + 1); in dup_and_fixup_symbol_prop()
225 for (k = 0; k < ovcs->count; k++) { in dup_and_fixup_symbol_prop()
226 fragment = &ovcs->fragments[k]; in dup_and_fixup_symbol_prop()
230 if (k >= ovcs->count) in dup_and_fixup_symbol_prop()
298 static int add_changeset_property(struct overlay_changeset *ovcs, in add_changeset_property() argument
338 new_prop = dup_and_fixup_symbol_prop(ovcs, overlay_prop); in add_changeset_property()
351 ret = of_changeset_add_property(&ovcs->cset, target->np, in add_changeset_property()
354 ret = of_changeset_update_property(&ovcs->cset, target->np, in add_changeset_property()
400 static int add_changeset_node(struct overlay_changeset *ovcs, in add_changeset_node() argument
433 ret = of_changeset_attach_node(&ovcs->cset, tchild); in add_changeset_node()
440 ret = build_changeset_next_level(ovcs, &target_child, node); in add_changeset_node()
450 ret = build_changeset_next_level(ovcs, &target_child, node); in add_changeset_node()
472 static int build_changeset_next_level(struct overlay_changeset *ovcs, in build_changeset_next_level() argument
479 ret = add_changeset_property(ovcs, target, prop, 0); in build_changeset_next_level()
488 ret = add_changeset_node(ovcs, target, child); in build_changeset_next_level()
502 static int build_changeset_symbols_node(struct overlay_changeset *ovcs, in build_changeset_symbols_node() argument
510 ret = add_changeset_property(ovcs, target, prop, 1); in build_changeset_symbols_node()
521 static int find_dup_cset_node_entry(struct overlay_changeset *ovcs, in find_dup_cset_node_entry() argument
533 list_for_each_entry_continue(ce_2, &ovcs->cset.entries, node) { in find_dup_cset_node_entry()
554 static int find_dup_cset_prop(struct overlay_changeset *ovcs, in find_dup_cset_prop() argument
567 list_for_each_entry_continue(ce_2, &ovcs->cset.entries, node) { in find_dup_cset_prop()
600 static int changeset_dup_entry_check(struct overlay_changeset *ovcs) in changeset_dup_entry_check() argument
605 list_for_each_entry(ce_1, &ovcs->cset.entries, node) { in changeset_dup_entry_check()
606 dup_entry |= find_dup_cset_node_entry(ovcs, ce_1); in changeset_dup_entry_check()
607 dup_entry |= find_dup_cset_prop(ovcs, ce_1); in changeset_dup_entry_check()
625 static int build_changeset(struct overlay_changeset *ovcs) in build_changeset() argument
635 if (ovcs->symbols_fragment) in build_changeset()
636 fragments_count = ovcs->count - 1; in build_changeset()
638 fragments_count = ovcs->count; in build_changeset()
641 fragment = &ovcs->fragments[i]; in build_changeset()
645 ret = build_changeset_next_level(ovcs, &target, in build_changeset()
654 if (ovcs->symbols_fragment) { in build_changeset()
655 fragment = &ovcs->fragments[ovcs->count - 1]; in build_changeset()
659 ret = build_changeset_symbols_node(ovcs, &target, in build_changeset()
668 return changeset_dup_entry_check(ovcs); in build_changeset()
737 static int init_overlay_changeset(struct overlay_changeset *ovcs, in init_overlay_changeset() argument
756 if (!of_node_check_flag(ovcs->overlay_root, OF_DYNAMIC)) in init_overlay_changeset()
759 if (!of_node_check_flag(ovcs->overlay_root, OF_DETACHED)) in init_overlay_changeset()
762 if (!of_node_is_root(ovcs->overlay_root)) in init_overlay_changeset()
768 for_each_child_of_node(ovcs->overlay_root, node) { in init_overlay_changeset()
776 node = of_get_child_by_name(ovcs->overlay_root, "__symbols__"); in init_overlay_changeset()
787 ovcs->fragments = fragments; in init_overlay_changeset()
790 for_each_child_of_node(ovcs->overlay_root, node) { in init_overlay_changeset()
812 node = of_get_child_by_name(ovcs->overlay_root, "__symbols__"); in init_overlay_changeset()
814 ovcs->symbols_fragment = 1; in init_overlay_changeset()
835 ovcs->count = cnt; in init_overlay_changeset()
845 static void free_overlay_changeset(struct overlay_changeset *ovcs) in free_overlay_changeset() argument
849 if (ovcs->cset.entries.next) in free_overlay_changeset()
850 of_changeset_destroy(&ovcs->cset); in free_overlay_changeset()
852 if (ovcs->id) { in free_overlay_changeset()
853 idr_remove(&ovcs_idr, ovcs->id); in free_overlay_changeset()
854 list_del(&ovcs->ovcs_list); in free_overlay_changeset()
855 ovcs->id = 0; in free_overlay_changeset()
859 for (i = 0; i < ovcs->count; i++) { in free_overlay_changeset()
860 of_node_put(ovcs->fragments[i].target); in free_overlay_changeset()
861 of_node_put(ovcs->fragments[i].overlay); in free_overlay_changeset()
863 kfree(ovcs->fragments); in free_overlay_changeset()
875 if (ovcs->notify_state == OF_OVERLAY_INIT || in free_overlay_changeset()
876 ovcs->notify_state == OF_OVERLAY_POST_REMOVE) { in free_overlay_changeset()
877 kfree(ovcs->overlay_mem); in free_overlay_changeset()
878 kfree(ovcs->new_fdt); in free_overlay_changeset()
880 kfree(ovcs); in free_overlay_changeset()
912 static int of_overlay_apply(struct overlay_changeset *ovcs, in of_overlay_apply() argument
917 ret = of_resolve_phandles(ovcs->overlay_root); in of_overlay_apply()
921 ret = init_overlay_changeset(ovcs, base); in of_overlay_apply()
925 ret = overlay_notify(ovcs, OF_OVERLAY_PRE_APPLY); in of_overlay_apply()
929 ret = build_changeset(ovcs); in of_overlay_apply()
934 ret = __of_changeset_apply_entries(&ovcs->cset, &ret_revert); in of_overlay_apply()
944 ret = __of_changeset_apply_notify(&ovcs->cset); in of_overlay_apply()
949 ret_tmp = overlay_notify(ovcs, OF_OVERLAY_POST_APPLY); in of_overlay_apply()
988 struct overlay_changeset *ovcs; in of_overlay_fdt_apply() local
1007 ovcs = kzalloc(sizeof(*ovcs), GFP_KERNEL); in of_overlay_fdt_apply()
1008 if (!ovcs) in of_overlay_fdt_apply()
1019 ovcs->id = idr_alloc(&ovcs_idr, ovcs, 1, 0, GFP_KERNEL); in of_overlay_fdt_apply()
1020 if (ovcs->id <= 0) { in of_overlay_fdt_apply()
1021 ret = ovcs->id; in of_overlay_fdt_apply()
1025 INIT_LIST_HEAD(&ovcs->ovcs_list); in of_overlay_fdt_apply()
1026 list_add_tail(&ovcs->ovcs_list, &ovcs_list); in of_overlay_fdt_apply()
1027 of_changeset_init(&ovcs->cset); in of_overlay_fdt_apply()
1038 ovcs->new_fdt = new_fdt; in of_overlay_fdt_apply()
1044 &ovcs->overlay_root); in of_overlay_fdt_apply()
1050 ovcs->overlay_mem = overlay_mem; in of_overlay_fdt_apply()
1052 ret = of_overlay_apply(ovcs, base); in of_overlay_fdt_apply()
1059 *ret_ovcs_id = ovcs->id; in of_overlay_fdt_apply()
1063 free_overlay_changeset(ovcs); in of_overlay_fdt_apply()
1099 struct overlay_changeset *ovcs; in node_overlaps_later_cs() local
1102 list_for_each_entry_reverse(ovcs, &ovcs_list, ovcs_list) { in node_overlaps_later_cs()
1103 if (ovcs == remove_ovcs) in node_overlaps_later_cs()
1106 list_for_each_entry(ce, &ovcs->cset.entries, node) { in node_overlaps_later_cs()
1109 __func__, remove_ovcs->id, ovcs->id, in node_overlaps_later_cs()
1115 __func__, remove_ovcs->id, ovcs->id, in node_overlaps_later_cs()
1185 struct overlay_changeset *ovcs; in of_overlay_remove() local
1196 ovcs = idr_find(&ovcs_idr, *ovcs_id); in of_overlay_remove()
1197 if (!ovcs) { in of_overlay_remove()
1203 if (!overlay_removal_is_ok(ovcs)) { in of_overlay_remove()
1208 ret = overlay_notify(ovcs, OF_OVERLAY_PRE_REMOVE); in of_overlay_remove()
1213 ret = __of_changeset_revert_entries(&ovcs->cset, &ret_apply); in of_overlay_remove()
1220 ret = __of_changeset_revert_notify(&ovcs->cset); in of_overlay_remove()
1232 ret_tmp = overlay_notify(ovcs, OF_OVERLAY_POST_REMOVE); in of_overlay_remove()
1237 free_overlay_changeset(ovcs); in of_overlay_remove()
1263 struct overlay_changeset *ovcs, *ovcs_n; in of_overlay_remove_all() local
1267 list_for_each_entry_safe_reverse(ovcs, ovcs_n, &ovcs_list, ovcs_list) { in of_overlay_remove_all()
1268 ret = of_overlay_remove(&ovcs->id); in of_overlay_remove_all()