changesets.txt 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. A DT changeset is a method which allows one to apply changes
  2. in the live tree in such a way that either the full set of changes
  3. will be applied, or none of them will be. If an error occurs partway
  4. through applying the changeset, then the tree will be rolled back to the
  5. previous state. A changeset can also be removed after it has been
  6. applied.
  7. When a changeset is applied, all of the changes get applied to the tree
  8. at once before emitting OF_RECONFIG notifiers. This is so that the
  9. receiver sees a complete and consistent state of the tree when it
  10. receives the notifier.
  11. The sequence of a changeset is as follows.
  12. 1. of_changeset_init() - initializes a changeset
  13. 2. A number of DT tree change calls, of_changeset_attach_node(),
  14. of_changeset_detach_node(), of_changeset_add_property(),
  15. of_changeset_remove_property, of_changeset_update_property() to prepare
  16. a set of changes. No changes to the active tree are made at this point.
  17. All the change operations are recorded in the of_changeset 'entries'
  18. list.
  19. 3. mutex_lock(of_mutex) - starts a changeset; The global of_mutex
  20. ensures there can only be one editor at a time.
  21. 4. of_changeset_apply() - Apply the changes to the tree. Either the
  22. entire changeset will get applied, or if there is an error the tree will
  23. be restored to the previous state
  24. 5. mutex_unlock(of_mutex) - All operations complete, release the mutex
  25. If a successfully applied changeset needs to be removed, it can be done
  26. with the following sequence.
  27. 1. mutex_lock(of_mutex)
  28. 2. of_changeset_revert()
  29. 3. mutex_unlock(of_mutex)