diff options
Diffstat (limited to 'include/linux/of.h')
-rw-r--r-- | include/linux/of.h | 87 |
1 files changed, 82 insertions, 5 deletions
diff --git a/include/linux/of.h b/include/linux/of.h index 196b34c1ef4e..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 | ||
77 | extern int of_node_add(struct device_node *node); | ||
78 | |||
79 | /* initialize a node */ | 77 | /* initialize a node */ |
80 | extern struct kobj_type of_node_ktype; | 78 | extern struct kobj_type of_node_ktype; |
81 | static inline void of_node_init(struct device_node *node) | 79 | static inline void of_node_init(struct device_node *node) |
@@ -113,6 +111,7 @@ static inline void of_node_put(struct device_node *node) { } | |||
113 | extern struct device_node *of_allnodes; | 111 | extern struct device_node *of_allnodes; |
114 | extern struct device_node *of_chosen; | 112 | extern struct device_node *of_chosen; |
115 | extern struct device_node *of_aliases; | 113 | extern struct device_node *of_aliases; |
114 | extern struct device_node *of_stdout; | ||
116 | extern raw_spinlock_t devtree_lock; | 115 | extern raw_spinlock_t devtree_lock; |
117 | 116 | ||
118 | static inline bool of_have_populated_dt(void) | 117 | static inline bool of_have_populated_dt(void) |
@@ -204,6 +203,7 @@ static inline unsigned long of_read_ulong(const __be32 *cell, int size) | |||
204 | #define OF_DYNAMIC 1 /* node and properties were allocated via kmalloc */ | 203 | #define OF_DYNAMIC 1 /* node and properties were allocated via kmalloc */ |
205 | #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 */ |
206 | #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 */ | ||
207 | 207 | ||
208 | #define OF_IS_DYNAMIC(x) test_bit(OF_DYNAMIC, &x->_flags) | 208 | #define OF_IS_DYNAMIC(x) test_bit(OF_DYNAMIC, &x->_flags) |
209 | #define OF_MARK_DYNAMIC(x) set_bit(OF_DYNAMIC, &x->_flags) | 209 | #define OF_MARK_DYNAMIC(x) set_bit(OF_DYNAMIC, &x->_flags) |
@@ -322,6 +322,7 @@ extern int of_update_property(struct device_node *np, struct property *newprop); | |||
322 | struct of_prop_reconfig { | 322 | struct of_prop_reconfig { |
323 | struct device_node *dn; | 323 | struct device_node *dn; |
324 | struct property *prop; | 324 | struct property *prop; |
325 | struct property *old_prop; | ||
325 | }; | 326 | }; |
326 | 327 | ||
327 | extern int of_reconfig_notifier_register(struct notifier_block *); | 328 | extern int of_reconfig_notifier_register(struct notifier_block *); |
@@ -352,7 +353,7 @@ const __be32 *of_prop_next_u32(struct property *prop, const __be32 *cur, | |||
352 | */ | 353 | */ |
353 | const char *of_prop_next_string(struct property *prop, const char *cur); | 354 | const char *of_prop_next_string(struct property *prop, const char *cur); |
354 | 355 | ||
355 | int of_device_is_stdout_path(struct device_node *dn); | 356 | bool of_console_check(struct device_node *dn, char *name, int index); |
356 | 357 | ||
357 | #else /* CONFIG_OF */ | 358 | #else /* CONFIG_OF */ |
358 | 359 | ||
@@ -564,9 +565,9 @@ static inline int of_machine_is_compatible(const char *compat) | |||
564 | return 0; | 565 | return 0; |
565 | } | 566 | } |
566 | 567 | ||
567 | static inline int of_device_is_stdout_path(struct device_node *dn) | 568 | static inline bool of_console_check(const struct device_node *dn, const char *name, int index) |
568 | { | 569 | { |
569 | return 0; | 570 | return false; |
570 | } | 571 | } |
571 | 572 | ||
572 | static inline const __be32 *of_prop_next_u32(struct property *prop, | 573 | static inline const __be32 *of_prop_next_u32(struct property *prop, |
@@ -786,4 +787,80 @@ typedef void (*of_init_fn_1)(struct device_node *); | |||
786 | #define OF_DECLARE_2(table, name, compat, fn) \ | 787 | #define OF_DECLARE_2(table, name, compat, fn) \ |
787 | _OF_DECLARE(table, name, compat, fn, of_init_fn_2) | 788 | _OF_DECLARE(table, name, compat, fn, of_init_fn_2) |
788 | 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 | */ | ||
804 | struct 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 | */ | ||
822 | struct of_changeset { | ||
823 | struct list_head entries; | ||
824 | }; | ||
825 | |||
826 | #ifdef CONFIG_OF_DYNAMIC | ||
827 | extern void of_changeset_init(struct of_changeset *ocs); | ||
828 | extern void of_changeset_destroy(struct of_changeset *ocs); | ||
829 | extern int of_changeset_apply(struct of_changeset *ocs); | ||
830 | extern int of_changeset_revert(struct of_changeset *ocs); | ||
831 | extern int of_changeset_action(struct of_changeset *ocs, | ||
832 | unsigned long action, struct device_node *np, | ||
833 | struct property *prop); | ||
834 | |||
835 | static 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 | |||
841 | static 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 | |||
847 | static 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 | |||
853 | static 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 | |||
859 | static 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 | |||
789 | #endif /* _LINUX_OF_H */ | 866 | #endif /* _LINUX_OF_H */ |