Stepan Moskovchenko | ced4eec | 2012-12-06 14:55:41 -0800 | [diff] [blame] | 1 | #ifndef _LINUX_OF_PRIVATE_H |
| 2 | #define _LINUX_OF_PRIVATE_H |
| 3 | /* |
| 4 | * Private symbols used by OF support code |
| 5 | * |
| 6 | * Paul Mackerras August 1996. |
| 7 | * Copyright (C) 1996-2005 Paul Mackerras. |
| 8 | * |
| 9 | * This program is free software; you can redistribute it and/or |
| 10 | * modify it under the terms of the GNU General Public License |
| 11 | * as published by the Free Software Foundation; either version |
| 12 | * 2 of the License, or (at your option) any later version. |
| 13 | */ |
| 14 | |
| 15 | /** |
| 16 | * struct alias_prop - Alias property in 'aliases' node |
| 17 | * @link: List node to link the structure in aliases_lookup list |
| 18 | * @alias: Alias property name |
| 19 | * @np: Pointer to device_node that the alias stands for |
| 20 | * @id: Index value from end of alias name |
| 21 | * @stem: Alias string without the index |
| 22 | * |
| 23 | * The structure represents one alias property of 'aliases' node as |
| 24 | * an entry in aliases_lookup list. |
| 25 | */ |
| 26 | struct alias_prop { |
| 27 | struct list_head link; |
| 28 | const char *alias; |
| 29 | struct device_node *np; |
| 30 | int id; |
| 31 | char stem[0]; |
| 32 | }; |
| 33 | |
Pantelis Antoniou | c05aba2 | 2014-07-04 19:58:03 +0300 | [diff] [blame] | 34 | extern struct mutex of_mutex; |
Stepan Moskovchenko | ced4eec | 2012-12-06 14:55:41 -0800 | [diff] [blame] | 35 | extern struct list_head aliases_lookup; |
Grant Likely | 8a2b22a | 2014-07-23 17:05:06 -0600 | [diff] [blame] | 36 | extern struct kset *of_kset; |
| 37 | |
Grant Likely | 6afc0dc | 2014-06-26 15:40:48 +0100 | [diff] [blame] | 38 | #if defined(CONFIG_OF_DYNAMIC) |
| 39 | extern int of_property_notify(int action, struct device_node *np, |
Grant Likely | 259092a | 2014-07-16 12:48:23 -0600 | [diff] [blame] | 40 | struct property *prop, struct property *old_prop); |
Grant Likely | 6afc0dc | 2014-06-26 15:40:48 +0100 | [diff] [blame] | 41 | extern void of_node_release(struct kobject *kobj); |
Gavin Shan | 1832237 | 2015-11-05 00:12:49 +1100 | [diff] [blame] | 42 | extern int __of_changeset_apply(struct of_changeset *ocs); |
| 43 | extern int __of_changeset_revert(struct of_changeset *ocs); |
Grant Likely | 6afc0dc | 2014-06-26 15:40:48 +0100 | [diff] [blame] | 44 | #else /* CONFIG_OF_DYNAMIC */ |
| 45 | static inline int of_property_notify(int action, struct device_node *np, |
Grant Likely | 259092a | 2014-07-16 12:48:23 -0600 | [diff] [blame] | 46 | struct property *prop, struct property *old_prop) |
Grant Likely | 6afc0dc | 2014-06-26 15:40:48 +0100 | [diff] [blame] | 47 | { |
| 48 | return 0; |
| 49 | } |
| 50 | #endif /* CONFIG_OF_DYNAMIC */ |
| 51 | |
Patrick Daly | fc00691 | 2018-05-18 14:01:34 -0700 | [diff] [blame] | 52 | #if defined(CONFIG_OF_KOBJ) |
| 53 | int of_node_is_attached(struct device_node *node); |
| 54 | int __of_add_property_sysfs(struct device_node *np, struct property *pp); |
| 55 | void __of_remove_property_sysfs(struct device_node *np, struct property *prop); |
| 56 | void __of_update_property_sysfs(struct device_node *np, struct property *newprop, |
| 57 | struct property *oldprop); |
| 58 | int __of_attach_node_sysfs(struct device_node *np); |
| 59 | void __of_detach_node_sysfs(struct device_node *np); |
| 60 | #else |
| 61 | static inline int __of_add_property_sysfs(struct device_node *np, struct property *pp) |
| 62 | { |
| 63 | return 0; |
| 64 | } |
| 65 | static inline void __of_remove_property_sysfs(struct device_node *np, struct property *prop) {} |
| 66 | static inline void __of_update_property_sysfs(struct device_node *np, |
| 67 | struct property *newprop, struct property *oldprop) {} |
| 68 | static inline int __of_attach_node_sysfs(struct device_node *np) |
| 69 | { |
| 70 | return 0; |
| 71 | } |
| 72 | static inline void __of_detach_node_sysfs(struct device_node *np) {} |
| 73 | #endif |
| 74 | |
Pantelis Antoniou | 6984339 | 2014-07-04 19:58:47 +0300 | [diff] [blame] | 75 | /** |
| 76 | * General utilities for working with live trees. |
| 77 | * |
| 78 | * All functions with two leading underscores operate |
| 79 | * without taking node references, so you either have to |
| 80 | * own the devtree lock or work on detached trees only. |
| 81 | */ |
| 82 | struct property *__of_prop_dup(const struct property *prop, gfp_t allocflags); |
Grant Likely | e517958 | 2014-11-17 22:31:32 +0000 | [diff] [blame] | 83 | __printf(2, 3) struct device_node *__of_node_dup(const struct device_node *np, const char *fmt, ...); |
Pantelis Antoniou | 6984339 | 2014-07-04 19:58:47 +0300 | [diff] [blame] | 84 | |
Grant Likely | a25095d | 2014-07-15 23:25:43 -0600 | [diff] [blame] | 85 | extern const void *__of_get_property(const struct device_node *np, |
| 86 | const char *name, int *lenp); |
Pantelis Antoniou | d8c5008 | 2014-07-04 19:58:46 +0300 | [diff] [blame] | 87 | extern int __of_add_property(struct device_node *np, struct property *prop); |
Grant Likely | 8a2b22a | 2014-07-23 17:05:06 -0600 | [diff] [blame] | 88 | extern int __of_add_property_sysfs(struct device_node *np, |
| 89 | struct property *prop); |
Pantelis Antoniou | d8c5008 | 2014-07-04 19:58:46 +0300 | [diff] [blame] | 90 | extern int __of_remove_property(struct device_node *np, struct property *prop); |
Grant Likely | 8a2b22a | 2014-07-23 17:05:06 -0600 | [diff] [blame] | 91 | extern void __of_remove_property_sysfs(struct device_node *np, |
| 92 | struct property *prop); |
Pantelis Antoniou | d8c5008 | 2014-07-04 19:58:46 +0300 | [diff] [blame] | 93 | extern int __of_update_property(struct device_node *np, |
| 94 | struct property *newprop, struct property **oldprop); |
Grant Likely | 8a2b22a | 2014-07-23 17:05:06 -0600 | [diff] [blame] | 95 | extern void __of_update_property_sysfs(struct device_node *np, |
| 96 | struct property *newprop, struct property *oldprop); |
Pantelis Antoniou | d8c5008 | 2014-07-04 19:58:46 +0300 | [diff] [blame] | 97 | |
| 98 | extern void __of_attach_node(struct device_node *np); |
Grant Likely | 8a2b22a | 2014-07-23 17:05:06 -0600 | [diff] [blame] | 99 | extern int __of_attach_node_sysfs(struct device_node *np); |
Pantelis Antoniou | d8c5008 | 2014-07-04 19:58:46 +0300 | [diff] [blame] | 100 | extern void __of_detach_node(struct device_node *np); |
Grant Likely | 8a2b22a | 2014-07-23 17:05:06 -0600 | [diff] [blame] | 101 | extern void __of_detach_node_sysfs(struct device_node *np); |
Pantelis Antoniou | d8c5008 | 2014-07-04 19:58:46 +0300 | [diff] [blame] | 102 | |
Frank Rowand | d9fc880 | 2016-06-16 10:51:46 -0700 | [diff] [blame] | 103 | extern void __of_sysfs_remove_bin_file(struct device_node *np, |
| 104 | struct property *prop); |
| 105 | |
Frank Rowand | f64054b | 2018-02-23 14:23:10 +0530 | [diff] [blame] | 106 | /* illegal phandle value (set when unresolved) */ |
| 107 | #define OF_PHANDLE_ILLEGAL 0xdeadbeef |
| 108 | |
Frank Rowand | e80f6cf | 2018-02-23 14:31:39 +0530 | [diff] [blame] | 109 | extern void __init of_populate_phandle_cache_early(void); |
| 110 | |
Pantelis Antoniou | 201c910 | 2014-07-04 19:58:49 +0300 | [diff] [blame] | 111 | /* iterators for transactions, used for overlays */ |
| 112 | /* forward iterator */ |
| 113 | #define for_each_transaction_entry(_oft, _te) \ |
| 114 | list_for_each_entry(_te, &(_oft)->te_list, node) |
| 115 | |
| 116 | /* reverse iterator */ |
| 117 | #define for_each_transaction_entry_reverse(_oft, _te) \ |
| 118 | list_for_each_entry_reverse(_te, &(_oft)->te_list, node) |
| 119 | |
Stepan Moskovchenko | ced4eec | 2012-12-06 14:55:41 -0800 | [diff] [blame] | 120 | #endif /* _LINUX_OF_PRIVATE_H */ |