18c2ecf20Sopenharmony_ci.. SPDX-License-Identifier: GPL-2.0
28c2ecf20Sopenharmony_ci
38c2ecf20Sopenharmony_ci=============
48c2ecf20Sopenharmony_ciDT Changesets
58c2ecf20Sopenharmony_ci=============
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_ciA DT changeset is a method which allows one to apply changes
88c2ecf20Sopenharmony_ciin the live tree in such a way that either the full set of changes
98c2ecf20Sopenharmony_ciwill be applied, or none of them will be. If an error occurs partway
108c2ecf20Sopenharmony_cithrough applying the changeset, then the tree will be rolled back to the
118c2ecf20Sopenharmony_ciprevious state. A changeset can also be removed after it has been
128c2ecf20Sopenharmony_ciapplied.
138c2ecf20Sopenharmony_ci
148c2ecf20Sopenharmony_ciWhen a changeset is applied, all of the changes get applied to the tree
158c2ecf20Sopenharmony_ciat once before emitting OF_RECONFIG notifiers. This is so that the
168c2ecf20Sopenharmony_cireceiver sees a complete and consistent state of the tree when it
178c2ecf20Sopenharmony_cireceives the notifier.
188c2ecf20Sopenharmony_ci
198c2ecf20Sopenharmony_ciThe sequence of a changeset is as follows.
208c2ecf20Sopenharmony_ci
218c2ecf20Sopenharmony_ci1. of_changeset_init() - initializes a changeset
228c2ecf20Sopenharmony_ci
238c2ecf20Sopenharmony_ci2. A number of DT tree change calls, of_changeset_attach_node(),
248c2ecf20Sopenharmony_ci   of_changeset_detach_node(), of_changeset_add_property(),
258c2ecf20Sopenharmony_ci   of_changeset_remove_property, of_changeset_update_property() to prepare
268c2ecf20Sopenharmony_ci   a set of changes. No changes to the active tree are made at this point.
278c2ecf20Sopenharmony_ci   All the change operations are recorded in the of_changeset 'entries'
288c2ecf20Sopenharmony_ci   list.
298c2ecf20Sopenharmony_ci
308c2ecf20Sopenharmony_ci3. of_changeset_apply() - Apply the changes to the tree. Either the
318c2ecf20Sopenharmony_ci   entire changeset will get applied, or if there is an error the tree will
328c2ecf20Sopenharmony_ci   be restored to the previous state. The core ensures proper serialization
338c2ecf20Sopenharmony_ci   through locking. An unlocked version __of_changeset_apply is available,
348c2ecf20Sopenharmony_ci   if needed.
358c2ecf20Sopenharmony_ci
368c2ecf20Sopenharmony_ciIf a successfully applied changeset needs to be removed, it can be done
378c2ecf20Sopenharmony_ciwith of_changeset_revert().
38