Back to home page

OSCL-LXR

 
 

    


0001 .. SPDX-License-Identifier: GPL-2.0
0002 
0003 =====================
0004 Devicetree Changesets
0005 =====================
0006 
0007 A Devicetree changeset is a method which allows one to apply changes
0008 in the live tree in such a way that either the full set of changes
0009 will be applied, or none of them will be. If an error occurs partway
0010 through applying the changeset, then the tree will be rolled back to the
0011 previous state. A changeset can also be removed after it has been
0012 applied.
0013 
0014 When a changeset is applied, all of the changes get applied to the tree
0015 at once before emitting OF_RECONFIG notifiers. This is so that the
0016 receiver sees a complete and consistent state of the tree when it
0017 receives the notifier.
0018 
0019 The sequence of a changeset is as follows.
0020 
0021 1. of_changeset_init() - initializes a changeset
0022 
0023 2. A number of DT tree change calls, of_changeset_attach_node(),
0024    of_changeset_detach_node(), of_changeset_add_property(),
0025    of_changeset_remove_property, of_changeset_update_property() to prepare
0026    a set of changes. No changes to the active tree are made at this point.
0027    All the change operations are recorded in the of_changeset 'entries'
0028    list.
0029 
0030 3. of_changeset_apply() - Apply the changes to the tree. Either the
0031    entire changeset will get applied, or if there is an error the tree will
0032    be restored to the previous state. The core ensures proper serialization
0033    through locking. An unlocked version __of_changeset_apply is available,
0034    if needed.
0035 
0036 If a successfully applied changeset needs to be removed, it can be done
0037 with of_changeset_revert().