aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorGrant Likely <grant.likely@linaro.org>2014-08-11 09:06:23 -0400
committerGrant Likely <grant.likely@linaro.org>2014-08-11 09:06:23 -0400
commit663d3f7c2e5e1b018a4c53277ccfde40329d98ca (patch)
treea3afcc2d8fe682bdcc4c2e39b47ab3987b38c69a /include
parentb775e642bf958a02210ac4d4edd1a1b7067c49fa (diff)
parentb6ae5dc54b0a5c542d06d46b9083ceb70bf7e083 (diff)
Merge branch 'devicetree/next-overlay' into devicetree/next
Conflicts: drivers/of/testcase-data/testcases.dts
Diffstat (limited to 'include')
-rw-r--r--include/linux/of.h80
-rw-r--r--include/linux/of_platform.h7
2 files changed, 80 insertions, 7 deletions
diff --git a/include/linux/of.h b/include/linux/of.h
index f0d256273c83..6c4363b8ddc3 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -74,8 +74,6 @@ struct of_phandle_args {
74 uint32_t args[MAX_PHANDLE_ARGS]; 74 uint32_t args[MAX_PHANDLE_ARGS];
75}; 75};
76 76
77extern int of_node_add(struct device_node *node);
78
79/* initialize a node */ 77/* initialize a node */
80extern struct kobj_type of_node_ktype; 78extern struct kobj_type of_node_ktype;
81static inline void of_node_init(struct device_node *node) 79static inline void of_node_init(struct device_node *node)
@@ -205,6 +203,7 @@ static inline unsigned long of_read_ulong(const __be32 *cell, int size)
205#define OF_DYNAMIC 1 /* node and properties were allocated via kmalloc */ 203#define OF_DYNAMIC 1 /* node and properties were allocated via kmalloc */
206#define OF_DETACHED 2 /* node has been detached from the device tree */ 204#define OF_DETACHED 2 /* node has been detached from the device tree */
207#define OF_POPULATED 3 /* device already created for the node */ 205#define OF_POPULATED 3 /* device already created for the node */
206#define OF_POPULATED_BUS 4 /* of_platform_populate recursed to children of this node */
208 207
209#define OF_IS_DYNAMIC(x) test_bit(OF_DYNAMIC, &x->_flags) 208#define OF_IS_DYNAMIC(x) test_bit(OF_DYNAMIC, &x->_flags)
210#define OF_MARK_DYNAMIC(x) set_bit(OF_DYNAMIC, &x->_flags) 209#define OF_MARK_DYNAMIC(x) set_bit(OF_DYNAMIC, &x->_flags)
@@ -323,6 +322,7 @@ extern int of_update_property(struct device_node *np, struct property *newprop);
323struct of_prop_reconfig { 322struct of_prop_reconfig {
324 struct device_node *dn; 323 struct device_node *dn;
325 struct property *prop; 324 struct property *prop;
325 struct property *old_prop;
326}; 326};
327 327
328extern int of_reconfig_notifier_register(struct notifier_block *); 328extern int of_reconfig_notifier_register(struct notifier_block *);
@@ -787,4 +787,80 @@ typedef void (*of_init_fn_1)(struct device_node *);
787#define OF_DECLARE_2(table, name, compat, fn) \ 787#define OF_DECLARE_2(table, name, compat, fn) \
788 _OF_DECLARE(table, name, compat, fn, of_init_fn_2) 788 _OF_DECLARE(table, name, compat, fn, of_init_fn_2)
789 789
790/**
791 * struct of_changeset_entry - Holds a changeset entry
792 *
793 * @node: list_head for the log list
794 * @action: notifier action
795 * @np: pointer to the device node affected
796 * @prop: pointer to the property affected
797 * @old_prop: hold a pointer to the original property
798 *
799 * Every modification of the device tree during a changeset
800 * is held in a list of of_changeset_entry structures.
801 * That way we can recover from a partial application, or we can
802 * revert the changeset
803 */
804struct of_changeset_entry {
805 struct list_head node;
806 unsigned long action;
807 struct device_node *np;
808 struct property *prop;
809 struct property *old_prop;
810};
811
812/**
813 * struct of_changeset - changeset tracker structure
814 *
815 * @entries: list_head for the changeset entries
816 *
817 * changesets are a convenient way to apply bulk changes to the
818 * live tree. In case of an error, changes are rolled-back.
819 * changesets live on after initial application, and if not
820 * destroyed after use, they can be reverted in one single call.
821 */
822struct of_changeset {
823 struct list_head entries;
824};
825
826#ifdef CONFIG_OF_DYNAMIC
827extern void of_changeset_init(struct of_changeset *ocs);
828extern void of_changeset_destroy(struct of_changeset *ocs);
829extern int of_changeset_apply(struct of_changeset *ocs);
830extern int of_changeset_revert(struct of_changeset *ocs);
831extern int of_changeset_action(struct of_changeset *ocs,
832 unsigned long action, struct device_node *np,
833 struct property *prop);
834
835static inline int of_changeset_attach_node(struct of_changeset *ocs,
836 struct device_node *np)
837{
838 return of_changeset_action(ocs, OF_RECONFIG_ATTACH_NODE, np, NULL);
839}
840
841static inline int of_changeset_detach_node(struct of_changeset *ocs,
842 struct device_node *np)
843{
844 return of_changeset_action(ocs, OF_RECONFIG_DETACH_NODE, np, NULL);
845}
846
847static inline int of_changeset_add_property(struct of_changeset *ocs,
848 struct device_node *np, struct property *prop)
849{
850 return of_changeset_action(ocs, OF_RECONFIG_ADD_PROPERTY, np, prop);
851}
852
853static inline int of_changeset_remove_property(struct of_changeset *ocs,
854 struct device_node *np, struct property *prop)
855{
856 return of_changeset_action(ocs, OF_RECONFIG_REMOVE_PROPERTY, np, prop);
857}
858
859static inline int of_changeset_update_property(struct of_changeset *ocs,
860 struct device_node *np, struct property *prop)
861{
862 return of_changeset_action(ocs, OF_RECONFIG_UPDATE_PROPERTY, np, prop);
863}
864#endif
865
790#endif /* _LINUX_OF_H */ 866#endif /* _LINUX_OF_H */
diff --git a/include/linux/of_platform.h b/include/linux/of_platform.h
index d96e1badbee0..c2b0627a2317 100644
--- a/include/linux/of_platform.h
+++ b/include/linux/of_platform.h
@@ -72,7 +72,7 @@ extern int of_platform_populate(struct device_node *root,
72 const struct of_device_id *matches, 72 const struct of_device_id *matches,
73 const struct of_dev_auxdata *lookup, 73 const struct of_dev_auxdata *lookup,
74 struct device *parent); 74 struct device *parent);
75extern int of_platform_depopulate(struct device *parent); 75extern void of_platform_depopulate(struct device *parent);
76#else 76#else
77static inline int of_platform_populate(struct device_node *root, 77static inline int of_platform_populate(struct device_node *root,
78 const struct of_device_id *matches, 78 const struct of_device_id *matches,
@@ -81,10 +81,7 @@ static inline int of_platform_populate(struct device_node *root,
81{ 81{
82 return -ENODEV; 82 return -ENODEV;
83} 83}
84static inline int of_platform_depopulate(struct device *parent) 84static inline void of_platform_depopulate(struct device *parent) { }
85{
86 return -ENODEV;
87}
88#endif 85#endif
89 86
90#endif /* _LINUX_OF_PLATFORM_H */ 87#endif /* _LINUX_OF_PLATFORM_H */