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()
300 static int add_changeset_property(struct overlay_changeset *ovcs, in add_changeset_property() argument
340 new_prop = dup_and_fixup_symbol_prop(ovcs, overlay_prop); in add_changeset_property()
353 ret = of_changeset_add_property(&ovcs->cset, target->np, in add_changeset_property()
356 ret = of_changeset_update_property(&ovcs->cset, target->np, in add_changeset_property()
405 static int add_changeset_node(struct overlay_changeset *ovcs, in add_changeset_node() argument
438 ret = of_changeset_attach_node(&ovcs->cset, tchild); in add_changeset_node()
445 ret = build_changeset_next_level(ovcs, &target_child, node); in add_changeset_node()
455 ret = build_changeset_next_level(ovcs, &target_child, node); in add_changeset_node()
477 static int build_changeset_next_level(struct overlay_changeset *ovcs, in build_changeset_next_level() argument
485 ret = add_changeset_property(ovcs, target, prop, 0); in build_changeset_next_level()
494 ret = add_changeset_node(ovcs, target, child); in build_changeset_next_level()
509 static int build_changeset_symbols_node(struct overlay_changeset *ovcs, in build_changeset_symbols_node() argument
517 ret = add_changeset_property(ovcs, target, prop, 1); in build_changeset_symbols_node()
528 static int find_dup_cset_node_entry(struct overlay_changeset *ovcs, in find_dup_cset_node_entry() argument
540 list_for_each_entry_continue(ce_2, &ovcs->cset.entries, node) { in find_dup_cset_node_entry()
561 static int find_dup_cset_prop(struct overlay_changeset *ovcs, in find_dup_cset_prop() argument
574 list_for_each_entry_continue(ce_2, &ovcs->cset.entries, node) { in find_dup_cset_prop()
607 static int changeset_dup_entry_check(struct overlay_changeset *ovcs) in changeset_dup_entry_check() argument
612 list_for_each_entry(ce_1, &ovcs->cset.entries, node) { in changeset_dup_entry_check()
613 dup_entry |= find_dup_cset_node_entry(ovcs, ce_1); in changeset_dup_entry_check()
614 dup_entry |= find_dup_cset_prop(ovcs, ce_1); in changeset_dup_entry_check()
632 static int build_changeset(struct overlay_changeset *ovcs) in build_changeset() argument
642 if (ovcs->symbols_fragment) in build_changeset()
643 fragments_count = ovcs->count - 1; in build_changeset()
645 fragments_count = ovcs->count; in build_changeset()
648 fragment = &ovcs->fragments[i]; in build_changeset()
652 ret = build_changeset_next_level(ovcs, &target, in build_changeset()
661 if (ovcs->symbols_fragment) { in build_changeset()
662 fragment = &ovcs->fragments[ovcs->count - 1]; in build_changeset()
666 ret = build_changeset_symbols_node(ovcs, &target, in build_changeset()
675 return changeset_dup_entry_check(ovcs); in build_changeset()
744 static int init_overlay_changeset(struct overlay_changeset *ovcs, in init_overlay_changeset() argument
763 if (!of_node_check_flag(ovcs->overlay_root, OF_DYNAMIC)) in init_overlay_changeset()
766 if (!of_node_check_flag(ovcs->overlay_root, OF_DETACHED)) in init_overlay_changeset()
769 if (!of_node_is_root(ovcs->overlay_root)) in init_overlay_changeset()
775 for_each_child_of_node(ovcs->overlay_root, node) { in init_overlay_changeset()
783 node = of_get_child_by_name(ovcs->overlay_root, "__symbols__"); in init_overlay_changeset()
794 ovcs->fragments = fragments; in init_overlay_changeset()
797 for_each_child_of_node(ovcs->overlay_root, node) { in init_overlay_changeset()
819 node = of_get_child_by_name(ovcs->overlay_root, "__symbols__"); in init_overlay_changeset()
821 ovcs->symbols_fragment = 1; in init_overlay_changeset()
842 ovcs->count = cnt; in init_overlay_changeset()
852 static void free_overlay_changeset(struct overlay_changeset *ovcs) in free_overlay_changeset() argument
856 if (ovcs->cset.entries.next) in free_overlay_changeset()
857 of_changeset_destroy(&ovcs->cset); in free_overlay_changeset()
859 if (ovcs->id) { in free_overlay_changeset()
860 idr_remove(&ovcs_idr, ovcs->id); in free_overlay_changeset()
861 list_del(&ovcs->ovcs_list); in free_overlay_changeset()
862 ovcs->id = 0; in free_overlay_changeset()
866 for (i = 0; i < ovcs->count; i++) { in free_overlay_changeset()
867 of_node_put(ovcs->fragments[i].target); in free_overlay_changeset()
868 of_node_put(ovcs->fragments[i].overlay); in free_overlay_changeset()
870 kfree(ovcs->fragments); in free_overlay_changeset()
882 if (ovcs->notify_state == OF_OVERLAY_INIT || in free_overlay_changeset()
883 ovcs->notify_state == OF_OVERLAY_POST_REMOVE) { in free_overlay_changeset()
884 kfree(ovcs->overlay_mem); in free_overlay_changeset()
885 kfree(ovcs->new_fdt); in free_overlay_changeset()
887 kfree(ovcs); in free_overlay_changeset()
919 static int of_overlay_apply(struct overlay_changeset *ovcs, in of_overlay_apply() argument
924 ret = of_resolve_phandles(ovcs->overlay_root); in of_overlay_apply()
928 ret = init_overlay_changeset(ovcs, base); in of_overlay_apply()
932 ret = overlay_notify(ovcs, OF_OVERLAY_PRE_APPLY); in of_overlay_apply()
936 ret = build_changeset(ovcs); in of_overlay_apply()
941 ret = __of_changeset_apply_entries(&ovcs->cset, &ret_revert); in of_overlay_apply()
951 ret = __of_changeset_apply_notify(&ovcs->cset); in of_overlay_apply()
956 ret_tmp = overlay_notify(ovcs, OF_OVERLAY_POST_APPLY); in of_overlay_apply()
995 struct overlay_changeset *ovcs; in of_overlay_fdt_apply() local
1014 ovcs = kzalloc(sizeof(*ovcs), GFP_KERNEL); in of_overlay_fdt_apply()
1015 if (!ovcs) in of_overlay_fdt_apply()
1026 ovcs->id = idr_alloc(&ovcs_idr, ovcs, 1, 0, GFP_KERNEL); in of_overlay_fdt_apply()
1027 if (ovcs->id <= 0) { in of_overlay_fdt_apply()
1028 ret = ovcs->id; in of_overlay_fdt_apply()
1032 INIT_LIST_HEAD(&ovcs->ovcs_list); in of_overlay_fdt_apply()
1033 list_add_tail(&ovcs->ovcs_list, &ovcs_list); in of_overlay_fdt_apply()
1034 of_changeset_init(&ovcs->cset); in of_overlay_fdt_apply()
1045 ovcs->new_fdt = new_fdt; in of_overlay_fdt_apply()
1051 &ovcs->overlay_root); in of_overlay_fdt_apply()
1057 ovcs->overlay_mem = overlay_mem; in of_overlay_fdt_apply()
1059 ret = of_overlay_apply(ovcs, base); in of_overlay_fdt_apply()
1066 *ret_ovcs_id = ovcs->id; in of_overlay_fdt_apply()
1070 free_overlay_changeset(ovcs); in of_overlay_fdt_apply()
1110 struct overlay_changeset *ovcs; in node_overlaps_later_cs() local
1113 list_for_each_entry_reverse(ovcs, &ovcs_list, ovcs_list) { in node_overlaps_later_cs()
1114 if (ovcs == remove_ovcs) in node_overlaps_later_cs()
1117 list_for_each_entry(ce, &ovcs->cset.entries, node) { in node_overlaps_later_cs()
1120 __func__, remove_ovcs->id, ovcs->id, in node_overlaps_later_cs()
1126 __func__, remove_ovcs->id, ovcs->id, in node_overlaps_later_cs()
1196 struct overlay_changeset *ovcs; in of_overlay_remove() local
1207 ovcs = idr_find(&ovcs_idr, *ovcs_id); in of_overlay_remove()
1208 if (!ovcs) { in of_overlay_remove()
1214 if (!overlay_removal_is_ok(ovcs)) { in of_overlay_remove()
1219 ret = overlay_notify(ovcs, OF_OVERLAY_PRE_REMOVE); in of_overlay_remove()
1224 ret = __of_changeset_revert_entries(&ovcs->cset, &ret_apply); in of_overlay_remove()
1231 ret = __of_changeset_revert_notify(&ovcs->cset); in of_overlay_remove()
1243 ret_tmp = overlay_notify(ovcs, OF_OVERLAY_POST_REMOVE); in of_overlay_remove()
1248 free_overlay_changeset(ovcs); in of_overlay_remove()
1274 struct overlay_changeset *ovcs, *ovcs_n; in of_overlay_remove_all() local
1278 list_for_each_entry_safe_reverse(ovcs, ovcs_n, &ovcs_list, ovcs_list) { in of_overlay_remove_all()
1279 ret = of_overlay_remove(&ovcs->id); in of_overlay_remove_all()