diff options
author | Pantelis Antoniou <pantelis.antoniou@konsulko.com> | 2014-07-04 12:58:49 -0400 |
---|---|---|
committer | Grant Likely <grant.likely@linaro.org> | 2014-07-23 19:29:15 -0400 |
commit | 201c910bd6898d81d4ac6685d0f421b7e10f3c5d (patch) | |
tree | aec8c406908e71c7ad89750c6e9f4f8d0c094747 /include/linux/of.h | |
parent | 259092a35c7e11f1d4616b0f5b3ba7b851fe4fa6 (diff) |
of: Transactional DT support.
Introducing DT transactional support.
A DT transaction is a method which allows one to apply changes
in the live tree, in such a way that either the full set of changes
take effect, or the state of the tree can be rolled-back to the
state it was before it was attempted. An applied transaction
can be rolled-back at any time.
Documentation is in
Documentation/devicetree/changesets.txt
Signed-off-by: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
[glikely: Removed device notifiers and reworked to be more consistent]
Signed-off-by: Grant Likely <grant.likely@linaro.org>
Diffstat (limited to 'include/linux/of.h')
-rw-r--r-- | include/linux/of.h | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/include/linux/of.h b/include/linux/of.h index 400f18cb4fff..bc91fbb13ce8 100644 --- a/include/linux/of.h +++ b/include/linux/of.h | |||
@@ -786,4 +786,80 @@ typedef void (*of_init_fn_1)(struct device_node *); | |||
786 | #define OF_DECLARE_2(table, name, compat, fn) \ | 786 | #define OF_DECLARE_2(table, name, compat, fn) \ |
787 | _OF_DECLARE(table, name, compat, fn, of_init_fn_2) | 787 | _OF_DECLARE(table, name, compat, fn, of_init_fn_2) |
788 | 788 | ||
789 | /** | ||
790 | * struct of_changeset_entry - Holds a changeset entry | ||
791 | * | ||
792 | * @node: list_head for the log list | ||
793 | * @action: notifier action | ||
794 | * @np: pointer to the device node affected | ||
795 | * @prop: pointer to the property affected | ||
796 | * @old_prop: hold a pointer to the original property | ||
797 | * | ||
798 | * Every modification of the device tree during a changeset | ||
799 | * is held in a list of of_changeset_entry structures. | ||
800 | * That way we can recover from a partial application, or we can | ||
801 | * revert the changeset | ||
802 | */ | ||
803 | struct of_changeset_entry { | ||
804 | struct list_head node; | ||
805 | unsigned long action; | ||
806 | struct device_node *np; | ||
807 | struct property *prop; | ||
808 | struct property *old_prop; | ||
809 | }; | ||
810 | |||
811 | /** | ||
812 | * struct of_changeset - changeset tracker structure | ||
813 | * | ||
814 | * @entries: list_head for the changeset entries | ||
815 | * | ||
816 | * changesets are a convenient way to apply bulk changes to the | ||
817 | * live tree. In case of an error, changes are rolled-back. | ||
818 | * changesets live on after initial application, and if not | ||
819 | * destroyed after use, they can be reverted in one single call. | ||
820 | */ | ||
821 | struct of_changeset { | ||
822 | struct list_head entries; | ||
823 | }; | ||
824 | |||
825 | #ifdef CONFIG_OF_DYNAMIC | ||
826 | extern void of_changeset_init(struct of_changeset *ocs); | ||
827 | extern void of_changeset_destroy(struct of_changeset *ocs); | ||
828 | extern int of_changeset_apply(struct of_changeset *ocs); | ||
829 | extern int of_changeset_revert(struct of_changeset *ocs); | ||
830 | extern int of_changeset_action(struct of_changeset *ocs, | ||
831 | unsigned long action, struct device_node *np, | ||
832 | struct property *prop); | ||
833 | |||
834 | static inline int of_changeset_attach_node(struct of_changeset *ocs, | ||
835 | struct device_node *np) | ||
836 | { | ||
837 | return of_changeset_action(ocs, OF_RECONFIG_ATTACH_NODE, np, NULL); | ||
838 | } | ||
839 | |||
840 | static inline int of_changeset_detach_node(struct of_changeset *ocs, | ||
841 | struct device_node *np) | ||
842 | { | ||
843 | return of_changeset_action(ocs, OF_RECONFIG_DETACH_NODE, np, NULL); | ||
844 | } | ||
845 | |||
846 | static inline int of_changeset_add_property(struct of_changeset *ocs, | ||
847 | struct device_node *np, struct property *prop) | ||
848 | { | ||
849 | return of_changeset_action(ocs, OF_RECONFIG_ADD_PROPERTY, np, prop); | ||
850 | } | ||
851 | |||
852 | static inline int of_changeset_remove_property(struct of_changeset *ocs, | ||
853 | struct device_node *np, struct property *prop) | ||
854 | { | ||
855 | return of_changeset_action(ocs, OF_RECONFIG_REMOVE_PROPERTY, np, prop); | ||
856 | } | ||
857 | |||
858 | static inline int of_changeset_update_property(struct of_changeset *ocs, | ||
859 | struct device_node *np, struct property *prop) | ||
860 | { | ||
861 | return of_changeset_action(ocs, OF_RECONFIG_UPDATE_PROPERTY, np, prop); | ||
862 | } | ||
863 | #endif | ||
864 | |||
789 | #endif /* _LINUX_OF_H */ | 865 | #endif /* _LINUX_OF_H */ |