aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrank Rowand <frank.rowand@sony.com>2017-10-17 19:36:23 -0400
committerRob Herring <robh@kernel.org>2017-10-17 21:46:17 -0400
commit0290c4ca2536a35e55c53cfb9058465b1f987b17 (patch)
tree310203536e1dafb5cf6c0b8287e2ed83de0876ec
parentbbed8794d53b7043d7989e22bc2e1e399da305eb (diff)
of: overlay: rename identifiers to more reflect what they do
This patch is aimed primarily at drivers/of/overlay.c, but those changes also have a small impact in a few other files. overlay.c is difficult to read and maintain. Improve readability: - Rename functions, types and variables to better reflect what they do and to be consistent with names in other places, such as the device tree overlay FDT (flattened device tree), and make the algorithms more clear - Use the same names consistently throughout the file - Update comments for name changes - Fix incorrect comments This patch is intended to not introduce any functional change. Signed-off-by: Frank Rowand <frank.rowand@sony.com> Signed-off-by: Rob Herring <robh@kernel.org>
-rw-r--r--Documentation/devicetree/overlay-notes.txt12
-rw-r--r--drivers/gpu/drm/tilcdc/tilcdc_slave_compat.c5
-rw-r--r--drivers/of/dynamic.c2
-rw-r--r--drivers/of/overlay.c530
-rw-r--r--drivers/of/unittest.c20
-rw-r--r--include/linux/of.h12
6 files changed, 310 insertions, 271 deletions
diff --git a/Documentation/devicetree/overlay-notes.txt b/Documentation/devicetree/overlay-notes.txt
index eb7f2685fda1..c4aa0adf13ec 100644
--- a/Documentation/devicetree/overlay-notes.txt
+++ b/Documentation/devicetree/overlay-notes.txt
@@ -87,15 +87,15 @@ Overlay in-kernel API
87 87
88The API is quite easy to use. 88The API is quite easy to use.
89 89
901. Call of_overlay_create() to create and apply an overlay. The return value 901. Call of_overlay_apply() to create and apply an overlay changeset. The return
91is a cookie identifying this overlay. 91value is an error or a cookie identifying this overlay.
92 92
932. Call of_overlay_destroy() to remove and cleanup the overlay previously 932. Call of_overlay_remove() to remove and cleanup the overlay changeset
94created via the call to of_overlay_create(). Removal of an overlay that 94previously created via the call to of_overlay_apply(). Removal of an overlay
95is stacked by another will not be permitted. 95changeset that is stacked by another will not be permitted.
96 96
97Finally, if you need to remove all overlays in one-go, just call 97Finally, if you need to remove all overlays in one-go, just call
98of_overlay_destroy_all() which will remove every single one in the correct 98of_overlay_remove_all() which will remove every single one in the correct
99order. 99order.
100 100
101Overlay DTS Format 101Overlay DTS Format
diff --git a/drivers/gpu/drm/tilcdc/tilcdc_slave_compat.c b/drivers/gpu/drm/tilcdc/tilcdc_slave_compat.c
index 623a9140493c..5f5b7ba35f1d 100644
--- a/drivers/gpu/drm/tilcdc/tilcdc_slave_compat.c
+++ b/drivers/gpu/drm/tilcdc/tilcdc_slave_compat.c
@@ -247,9 +247,10 @@ static void __init tilcdc_convert_slave_node(void)
247 247
248 tilcdc_node_disable(slave); 248 tilcdc_node_disable(slave);
249 249
250 ret = of_overlay_create(overlay); 250 ret = of_overlay_apply(overlay);
251 if (ret) 251 if (ret)
252 pr_err("%s: Creating overlay failed: %d\n", __func__, ret); 252 pr_err("%s: Applying overlay changeset failed: %d\n",
253 __func__, ret);
253 else 254 else
254 pr_info("%s: ti,tilcdc,slave node successfully converted\n", 255 pr_info("%s: ti,tilcdc,slave node successfully converted\n",
255 __func__); 256 __func__);
diff --git a/drivers/of/dynamic.c b/drivers/of/dynamic.c
index 39e8cf731764..4bc96af4d8e2 100644
--- a/drivers/of/dynamic.c
+++ b/drivers/of/dynamic.c
@@ -758,7 +758,7 @@ int of_changeset_revert(struct of_changeset *ocs)
758EXPORT_SYMBOL_GPL(of_changeset_revert); 758EXPORT_SYMBOL_GPL(of_changeset_revert);
759 759
760/** 760/**
761 * of_changeset_action - Perform a changeset action 761 * of_changeset_action - Add an action to the tail of the changeset list
762 * 762 *
763 * @ocs: changeset pointer 763 * @ocs: changeset pointer
764 * @action: action to perform 764 * @action: action to perform
diff --git a/drivers/of/overlay.c b/drivers/of/overlay.c
index d3f4a5974a11..69610637af88 100644
--- a/drivers/of/overlay.c
+++ b/drivers/of/overlay.c
@@ -25,67 +25,63 @@
25#include "of_private.h" 25#include "of_private.h"
26 26
27/** 27/**
28 * struct of_overlay_info - Holds a single overlay info 28 * struct fragment - info about fragment nodes in overlay expanded device tree
29 * @target: target of the overlay operation 29 * @target: target of the overlay operation
30 * @overlay: pointer to the overlay contents node 30 * @overlay: pointer to the __overlay__ node
31 *
32 * Holds a single overlay state, including all the overlay logs &
33 * records.
34 */ 31 */
35struct of_overlay_info { 32struct fragment {
36 struct device_node *target; 33 struct device_node *target;
37 struct device_node *overlay; 34 struct device_node *overlay;
38 bool is_symbols_node; 35 bool is_symbols_node;
39}; 36};
40 37
41/** 38/**
42 * struct of_overlay - Holds a complete overlay transaction 39 * struct overlay_changeset
43 * @node: List on which we are located 40 * @ovcs_list: list on which we are located
44 * @count: Count of ovinfo structures 41 * @count: count of @fragments structures
45 * @ovinfo_tab: Overlay info table (count sized) 42 * @fragments: info about fragment nodes in overlay expanded device tree
46 * @cset: Changeset to be used 43 * @cset: changeset to apply fragments to live device tree
47 *
48 * Holds a complete overlay transaction
49 */ 44 */
50struct of_overlay { 45struct overlay_changeset {
51 int id; 46 int id;
52 struct list_head node; 47 struct list_head ovcs_list;
53 int count; 48 int count;
54 struct of_overlay_info *ovinfo_tab; 49 struct fragment *fragments;
55 struct of_changeset cset; 50 struct of_changeset cset;
56}; 51};
57 52
58static int of_overlay_apply_one(struct of_overlay *ov, 53static int build_changeset_next_level(struct overlay_changeset *ovcs,
59 struct device_node *target, const struct device_node *overlay, 54 struct device_node *target_node,
55 const struct device_node *overlay_node,
60 bool is_symbols_node); 56 bool is_symbols_node);
61 57
62static BLOCKING_NOTIFIER_HEAD(of_overlay_chain); 58static BLOCKING_NOTIFIER_HEAD(overlay_notify_chain);
63 59
64int of_overlay_notifier_register(struct notifier_block *nb) 60int of_overlay_notifier_register(struct notifier_block *nb)
65{ 61{
66 return blocking_notifier_chain_register(&of_overlay_chain, nb); 62 return blocking_notifier_chain_register(&overlay_notify_chain, nb);
67} 63}
68EXPORT_SYMBOL_GPL(of_overlay_notifier_register); 64EXPORT_SYMBOL_GPL(of_overlay_notifier_register);
69 65
70int of_overlay_notifier_unregister(struct notifier_block *nb) 66int of_overlay_notifier_unregister(struct notifier_block *nb)
71{ 67{
72 return blocking_notifier_chain_unregister(&of_overlay_chain, nb); 68 return blocking_notifier_chain_unregister(&overlay_notify_chain, nb);
73} 69}
74EXPORT_SYMBOL_GPL(of_overlay_notifier_unregister); 70EXPORT_SYMBOL_GPL(of_overlay_notifier_unregister);
75 71
76static int of_overlay_notify(struct of_overlay *ov, 72static int overlay_notify(struct overlay_changeset *ovcs,
77 enum of_overlay_notify_action action) 73 enum of_overlay_notify_action action)
78{ 74{
79 struct of_overlay_notify_data nd; 75 struct of_overlay_notify_data nd;
80 int i, ret; 76 int i, ret;
81 77
82 for (i = 0; i < ov->count; i++) { 78 for (i = 0; i < ovcs->count; i++) {
83 struct of_overlay_info *ovinfo = &ov->ovinfo_tab[i]; 79 struct fragment *fragment = &ovcs->fragments[i];
84 80
85 nd.target = ovinfo->target; 81 nd.target = fragment->target;
86 nd.overlay = ovinfo->overlay; 82 nd.overlay = fragment->overlay;
87 83
88 ret = blocking_notifier_call_chain(&of_overlay_chain, 84 ret = blocking_notifier_call_chain(&overlay_notify_chain,
89 action, &nd); 85 action, &nd);
90 if (ret) 86 if (ret)
91 return notifier_to_errno(ret); 87 return notifier_to_errno(ret);
@@ -94,10 +90,10 @@ static int of_overlay_notify(struct of_overlay *ov,
94 return 0; 90 return 0;
95} 91}
96 92
97static struct property *dup_and_fixup_symbol_prop(struct of_overlay *ov, 93static struct property *dup_and_fixup_symbol_prop(
98 const struct property *prop) 94 struct overlay_changeset *ovcs, const struct property *prop)
99{ 95{
100 struct of_overlay_info *ovinfo; 96 struct fragment *fragment;
101 struct property *new; 97 struct property *new;
102 const char *overlay_name; 98 const char *overlay_name;
103 char *label_path; 99 char *label_path;
@@ -116,18 +112,18 @@ static struct property *dup_and_fixup_symbol_prop(struct of_overlay *ov,
116 if (!new) 112 if (!new)
117 return NULL; 113 return NULL;
118 114
119 for (k = 0; k < ov->count; k++) { 115 for (k = 0; k < ovcs->count; k++) {
120 ovinfo = &ov->ovinfo_tab[k]; 116 fragment = &ovcs->fragments[k];
121 overlay_name = ovinfo->overlay->full_name; 117 overlay_name = fragment->overlay->full_name;
122 overlay_name_len = strlen(overlay_name); 118 overlay_name_len = strlen(overlay_name);
123 if (!strncasecmp(symbol_path, overlay_name, overlay_name_len)) 119 if (!strncasecmp(symbol_path, overlay_name, overlay_name_len))
124 break; 120 break;
125 } 121 }
126 122
127 if (k >= ov->count) 123 if (k >= ovcs->count)
128 goto err_free; 124 goto err_free;
129 125
130 target_path = ovinfo->target->full_name; 126 target_path = fragment->target->full_name;
131 target_path_len = strlen(target_path); 127 target_path_len = strlen(target_path);
132 128
133 label_path = symbol_path + overlay_name_len; 129 label_path = symbol_path + overlay_name_len;
@@ -156,82 +152,119 @@ static struct property *dup_and_fixup_symbol_prop(struct of_overlay *ov,
156 152
157} 153}
158 154
159/* 155/**
156 * add_changeset_property() - add @overlay_prop to overlay changeset
157 * @ovcs: overlay changeset
158 * @target_node: where to place @overlay_prop in live tree
159 * @overlay_prop: property to add or update, from overlay tree
160 * is_symbols_node: 1 if @target_node is "/__symbols__"
161 *
162 * If @overlay_prop does not already exist in @target_node, add changeset entry
163 * to add @overlay_prop in @target_node, else add changeset entry to update
164 * value of @overlay_prop.
165 *
160 * Some special properties are not updated (no error returned). 166 * Some special properties are not updated (no error returned).
167 *
161 * Update of property in symbols node is not allowed. 168 * Update of property in symbols node is not allowed.
169 *
170 * Returns 0 on success, -ENOMEM if memory allocation failure, or -EINVAL if
171 * invalid @overlay.
162 */ 172 */
163static int of_overlay_apply_single_property(struct of_overlay *ov, 173static int add_changeset_property(struct overlay_changeset *ovcs,
164 struct device_node *target, struct property *prop, 174 struct device_node *target_node,
175 struct property *overlay_prop,
165 bool is_symbols_node) 176 bool is_symbols_node)
166{ 177{
167 struct property *propn = NULL, *tprop; 178 struct property *new_prop = NULL, *prop;
168 int ret = 0; 179 int ret = 0;
169 180
170 tprop = of_find_property(target, prop->name, NULL); 181 prop = of_find_property(target_node, overlay_prop->name, NULL);
171 182
172 if (!of_prop_cmp(prop->name, "name") || 183 if (!of_prop_cmp(overlay_prop->name, "name") ||
173 !of_prop_cmp(prop->name, "phandle") || 184 !of_prop_cmp(overlay_prop->name, "phandle") ||
174 !of_prop_cmp(prop->name, "linux,phandle")) 185 !of_prop_cmp(overlay_prop->name, "linux,phandle"))
175 return 0; 186 return 0;
176 187
177 if (is_symbols_node) { 188 if (is_symbols_node) {
178 if (tprop) 189 if (prop)
179 return -EINVAL; 190 return -EINVAL;
180 propn = dup_and_fixup_symbol_prop(ov, prop); 191 new_prop = dup_and_fixup_symbol_prop(ovcs, overlay_prop);
181 } else { 192 } else {
182 propn = __of_prop_dup(prop, GFP_KERNEL); 193 new_prop = __of_prop_dup(overlay_prop, GFP_KERNEL);
183 } 194 }
184 195
185 if (!propn) 196 if (!new_prop)
186 return -ENOMEM; 197 return -ENOMEM;
187 198
188 if (!tprop) 199 if (!prop)
189 ret = of_changeset_add_property(&ov->cset, target, propn); 200 ret = of_changeset_add_property(&ovcs->cset, target_node,
201 new_prop);
190 else 202 else
191 ret = of_changeset_update_property(&ov->cset, target, propn); 203 ret = of_changeset_update_property(&ovcs->cset, target_node,
204 new_prop);
192 205
193 if (ret) { 206 if (ret) {
194 kfree(propn->name); 207 kfree(new_prop->name);
195 kfree(propn->value); 208 kfree(new_prop->value);
196 kfree(propn); 209 kfree(new_prop);
197 } 210 }
198 return ret; 211 return ret;
199} 212}
200 213
201static int of_overlay_apply_single_device_node(struct of_overlay *ov, 214/**
202 struct device_node *target, struct device_node *child) 215 * add_changeset_node() - add @node (and children) to overlay changeset
216 * @ovcs: overlay changeset
217 * @target_node: where to place @node in live tree
218 * @node: node from within overlay device tree fragment
219 *
220 * If @node does not already exist in @target_node, add changeset entry
221 * to add @node in @target_node.
222 *
223 * If @node already exists in @target_node, and the existing node has
224 * a phandle, the overlay node is not allowed to have a phandle.
225 *
226 * If @node has child nodes, add the children recursively via
227 * build_changeset_next_level().
228 *
229 * NOTE: Multiple mods of created nodes not supported.
230 *
231 * Returns 0 on success, -ENOMEM if memory allocation failure, or -EINVAL if
232 * invalid @overlay.
233 */
234static int add_changeset_node(struct overlay_changeset *ovcs,
235 struct device_node *target_node, struct device_node *node)
203{ 236{
204 const char *cname; 237 const char *node_kbasename;
205 struct device_node *tchild; 238 struct device_node *tchild;
206 int ret = 0; 239 int ret = 0;
207 240
208 cname = kbasename(child->full_name); 241 node_kbasename = kbasename(node->full_name);
209 if (!cname) 242 if (!node_kbasename)
210 return -ENOMEM; 243 return -ENOMEM;
211 244
212 for_each_child_of_node(target, tchild) 245 for_each_child_of_node(target_node, tchild)
213 if (!of_node_cmp(cname, kbasename(tchild->full_name))) 246 if (!of_node_cmp(node_kbasename, kbasename(tchild->full_name)))
214 break; 247 break;
215 248
216 if (tchild) { 249 if (tchild) {
217 if (child->phandle) 250 if (node->phandle)
218 return -EINVAL; 251 return -EINVAL;
219 252
220 /* apply overlay recursively */ 253 ret = build_changeset_next_level(ovcs, tchild, node, 0);
221 ret = of_overlay_apply_one(ov, tchild, child, 0);
222 of_node_put(tchild); 254 of_node_put(tchild);
223 } else { 255 } else {
224 tchild = __of_node_dup(child, "%pOF/%s", target, cname); 256 tchild = __of_node_dup(node, "%pOF/%s",
257 target_node, node_kbasename);
225 if (!tchild) 258 if (!tchild)
226 return -ENOMEM; 259 return -ENOMEM;
227 260
228 tchild->parent = target; 261 tchild->parent = target_node;
229 262
230 ret = of_changeset_attach_node(&ov->cset, tchild); 263 ret = of_changeset_attach_node(&ovcs->cset, tchild);
231 if (ret) 264 if (ret)
232 return ret; 265 return ret;
233 266
234 ret = of_overlay_apply_one(ov, tchild, child, 0); 267 ret = build_changeset_next_level(ovcs, tchild, node, 0);
235 if (ret) 268 if (ret)
236 return ret; 269 return ret;
237 } 270 }
@@ -239,29 +272,37 @@ static int of_overlay_apply_single_device_node(struct of_overlay *ov,
239 return ret; 272 return ret;
240} 273}
241 274
242/* 275/**
243 * Apply a single overlay node recursively. 276 * build_changeset_next_level() - add level of overlay changeset
277 * @ovcs: overlay changeset
278 * @target_node: where to place @overlay_node in live tree
279 * @overlay_node: node from within an overlay device tree fragment
280 * @is_symbols_node: @overlay_node is node "/__symbols__"
244 * 281 *
245 * Note that the in case of an error the target node is left 282 * Add the properties (if any) and nodes (if any) from @overlay_node to the
246 * in a inconsistent state. Error recovery should be performed 283 * @ovcs->cset changeset. If an added node has child nodes, they will
247 * by using the changeset. 284 * be added recursively.
248 * 285 *
249 * Do not allow symbols node to have any children. 286 * Do not allow symbols node to have any children.
287 *
288 * Returns 0 on success, -ENOMEM if memory allocation failure, or -EINVAL if
289 * invalid @overlay_node.
250 */ 290 */
251static int of_overlay_apply_one(struct of_overlay *ov, 291static int build_changeset_next_level(struct overlay_changeset *ovcs,
252 struct device_node *target, const struct device_node *overlay, 292 struct device_node *target_node,
293 const struct device_node *overlay_node,
253 bool is_symbols_node) 294 bool is_symbols_node)
254{ 295{
255 struct device_node *child; 296 struct device_node *child;
256 struct property *prop; 297 struct property *prop;
257 int ret; 298 int ret;
258 299
259 for_each_property_of_node(overlay, prop) { 300 for_each_property_of_node(overlay_node, prop) {
260 ret = of_overlay_apply_single_property(ov, target, prop, 301 ret = add_changeset_property(ovcs, target_node, prop,
261 is_symbols_node); 302 is_symbols_node);
262 if (ret) { 303 if (ret) {
263 pr_err("Failed to apply prop @%pOF/%s\n", 304 pr_err("Failed to apply prop @%pOF/%s\n",
264 target, prop->name); 305 target_node, prop->name);
265 return ret; 306 return ret;
266 } 307 }
267 } 308 }
@@ -269,11 +310,11 @@ static int of_overlay_apply_one(struct of_overlay *ov,
269 if (is_symbols_node) 310 if (is_symbols_node)
270 return 0; 311 return 0;
271 312
272 for_each_child_of_node(overlay, child) { 313 for_each_child_of_node(overlay_node, child) {
273 ret = of_overlay_apply_single_device_node(ov, target, child); 314 ret = add_changeset_node(ovcs, target_node, child);
274 if (ret) { 315 if (ret) {
275 pr_err("Failed to apply single node @%pOF/%s\n", 316 pr_err("Failed to apply node @%pOF/%s\n",
276 target, child->name); 317 target_node, child->name);
277 of_node_put(child); 318 of_node_put(child);
278 return ret; 319 return ret;
279 } 320 }
@@ -283,26 +324,30 @@ static int of_overlay_apply_one(struct of_overlay *ov,
283} 324}
284 325
285/** 326/**
286 * of_overlay_apply() - Apply @count overlays pointed at by @ovinfo_tab 327 * build_changeset() - populate overlay changeset in @ovcs from @ovcs->fragments
287 * @ov: Overlay to apply 328 * @ovcs: Overlay changeset
288 * 329 *
289 * Applies the overlays given, while handling all error conditions 330 * Create changeset @ovcs->cset to contain the nodes and properties of the
290 * appropriately. Either the operation succeeds, or if it fails the 331 * overlay device tree fragments in @ovcs->fragments[]. If an error occurs,
291 * live tree is reverted to the state before the attempt. 332 * any portions of the changeset that were successfully created will remain
292 * Returns 0, or an error if the overlay attempt failed. 333 * in @ovcs->cset.
334 *
335 * Returns 0 on success, -ENOMEM if memory allocation failure, or -EINVAL if
336 * invalid overlay in @ovcs->fragments[].
293 */ 337 */
294static int of_overlay_apply(struct of_overlay *ov) 338static int build_changeset(struct overlay_changeset *ovcs)
295{ 339{
296 int i, err; 340 int i, ret;
297 341
298 for (i = 0; i < ov->count; i++) { 342 for (i = 0; i < ovcs->count; i++) {
299 struct of_overlay_info *ovinfo = &ov->ovinfo_tab[i]; 343 struct fragment *fragment = &ovcs->fragments[i];
300 344
301 err = of_overlay_apply_one(ov, ovinfo->target, ovinfo->overlay, 345 ret = build_changeset_next_level(ovcs, fragment->target,
302 ovinfo->is_symbols_node); 346 fragment->overlay,
303 if (err) { 347 fragment->is_symbols_node);
304 pr_err("apply failed '%pOF'\n", ovinfo->target); 348 if (ret) {
305 return err; 349 pr_err("apply failed '%pOF'\n", fragment->target);
350 return ret;
306 } 351 }
307 } 352 }
308 353
@@ -350,45 +395,46 @@ static struct device_node *find_target_node(struct device_node *info_node)
350 * 395 *
351 * Returns 0 on success, or a negative error value. 396 * Returns 0 on success, or a negative error value.
352 */ 397 */
353static int of_fill_overlay_info(struct of_overlay *ov, 398static int of_fill_overlay_info(struct overlay_changeset *ovcset,
354 struct device_node *info_node, struct of_overlay_info *ovinfo) 399 struct device_node *info_node, struct fragment *fragment)
355{ 400{
356 ovinfo->overlay = of_get_child_by_name(info_node, "__overlay__"); 401 fragment->overlay = of_get_child_by_name(info_node, "__overlay__");
357 if (!ovinfo->overlay) 402 if (!fragment->overlay)
358 goto err_fail; 403 goto err_fail;
359 404
360 ovinfo->target = find_target_node(info_node); 405 fragment->target = find_target_node(info_node);
361 if (!ovinfo->target) 406 if (!fragment->target)
362 goto err_fail; 407 goto err_fail;
363 408
364 return 0; 409 return 0;
365 410
366err_fail: 411err_fail:
367 of_node_put(ovinfo->target); 412 of_node_put(fragment->target);
368 of_node_put(ovinfo->overlay); 413 of_node_put(fragment->overlay);
369 414
370 memset(ovinfo, 0, sizeof(*ovinfo)); 415 memset(fragment, 0, sizeof(*fragment));
371 return -EINVAL; 416 return -EINVAL;
372} 417}
373 418
374/** 419/**
375 * of_build_overlay_info() - Build an overlay info array 420 * init_overlay_changeset() - initialize overlay changeset from overlay tree
376 * @ov Overlay to build 421 * @ovcs Overlay changeset to build
377 * @tree: Device node containing all the overlays 422 * @tree: Contains all the overlay fragments and overlay fixup nodes
378 * 423 *
379 * Helper function that given a tree containing overlay information, 424 * Initialize @ovcs. Populate @ovcs->fragments with node information from
380 * allocates and builds an overlay info array containing it, ready 425 * the top level of @tree. The relevant top level nodes are the fragment
381 * for use using of_overlay_apply. 426 * nodes and the __symbols__ node. Any other top level node will be ignored.
382 * 427 *
383 * Returns 0 on success with the @cntp @ovinfop pointers valid, 428 * Returns 0 on success, -ENOMEM if memory allocation failure, -EINVAL if error
384 * while on error a negative error value is returned. 429 * detected in @tree, or -ENODEV if no valid nodes found.
385 */ 430 */
386static int of_build_overlay_info(struct of_overlay *ov, 431static int init_overlay_changeset(struct overlay_changeset *ovcs,
387 struct device_node *tree) 432 struct device_node *tree)
388{ 433{
389 struct device_node *node; 434 struct device_node *node;
390 struct of_overlay_info *ovinfo; 435 struct fragment *fragment;
391 int cnt, err; 436 struct fragment *fragments;
437 int cnt, ret;
392 438
393 cnt = 0; 439 cnt = 0;
394 for_each_child_of_node(tree, node) 440 for_each_child_of_node(tree, node)
@@ -397,24 +443,25 @@ static int of_build_overlay_info(struct of_overlay *ov,
397 if (of_get_child_by_name(tree, "__symbols__")) 443 if (of_get_child_by_name(tree, "__symbols__"))
398 cnt++; 444 cnt++;
399 445
400 ovinfo = kcalloc(cnt, sizeof(*ovinfo), GFP_KERNEL); 446 fragments = kcalloc(cnt, sizeof(*fragments), GFP_KERNEL);
401 if (!ovinfo) 447 if (!fragments)
402 return -ENOMEM; 448 return -ENOMEM;
403 449
404 cnt = 0; 450 cnt = 0;
405 for_each_child_of_node(tree, node) { 451 for_each_child_of_node(tree, node) {
406 err = of_fill_overlay_info(ov, node, &ovinfo[cnt]); 452 ret = of_fill_overlay_info(ovcs, node, &fragments[cnt]);
407 if (!err) 453 if (!ret)
408 cnt++; 454 cnt++;
409 } 455 }
410 456
411 node = of_get_child_by_name(tree, "__symbols__"); 457 node = of_get_child_by_name(tree, "__symbols__");
412 if (node) { 458 if (node) {
413 ovinfo[cnt].overlay = node; 459 fragment = &fragments[cnt];
414 ovinfo[cnt].target = of_find_node_by_path("/__symbols__"); 460 fragment->overlay = node;
415 ovinfo[cnt].is_symbols_node = 1; 461 fragment->target = of_find_node_by_path("/__symbols__");
462 fragment->is_symbols_node = 1;
416 463
417 if (!ovinfo[cnt].target) { 464 if (!fragment->target) {
418 pr_err("no symbols in root of device tree.\n"); 465 pr_err("no symbols in root of device tree.\n");
419 return -EINVAL; 466 return -EINVAL;
420 } 467 }
@@ -423,137 +470,127 @@ static int of_build_overlay_info(struct of_overlay *ov,
423 } 470 }
424 471
425 if (!cnt) { 472 if (!cnt) {
426 kfree(ovinfo); 473 kfree(fragments);
427 return -ENODEV; 474 return -ENODEV;
428 } 475 }
429 476
430 ov->count = cnt; 477 ovcs->count = cnt;
431 ov->ovinfo_tab = ovinfo; 478 ovcs->fragments = fragments;
432 479
433 return 0; 480 return 0;
434} 481}
435 482
436/** 483/**
437 * of_free_overlay_info() - Free an overlay info array 484 * free_overlay_fragments() - Free a fragments array
438 * @ov Overlay to free the overlay info from 485 * @ovcs Overlay to free the overlay info from
439 * @ovinfo_tab: Array of overlay_info's to free
440 * 486 *
441 * Releases the memory of a previously allocated ovinfo array 487 * Frees the memory of an ovcs->fragments[] array.
442 * by of_build_overlay_info.
443 * Returns 0, or an error if the arguments are bogus.
444 */ 488 */
445static int of_free_overlay_info(struct of_overlay *ov) 489static void free_overlay_fragments(struct overlay_changeset *ovcs)
446{ 490{
447 struct of_overlay_info *ovinfo;
448 int i; 491 int i;
449 492
450 /* do it in reverse */ 493 /* do it in reverse */
451 for (i = ov->count - 1; i >= 0; i--) { 494 for (i = ovcs->count - 1; i >= 0; i--) {
452 ovinfo = &ov->ovinfo_tab[i]; 495 of_node_put(ovcs->fragments[i].target);
453 496 of_node_put(ovcs->fragments[i].overlay);
454 of_node_put(ovinfo->target);
455 of_node_put(ovinfo->overlay);
456 } 497 }
457 kfree(ov->ovinfo_tab);
458 498
459 return 0; 499 kfree(ovcs->fragments);
460} 500}
461 501
462static LIST_HEAD(ov_list); 502static LIST_HEAD(ovcs_list);
463static DEFINE_IDR(ov_idr); 503static DEFINE_IDR(ovcs_idr);
464 504
465/** 505/**
466 * of_overlay_create() - Create and apply an overlay 506 * of_overlay_apply() - Create and apply an overlay changeset
467 * @tree: Device node containing all the overlays 507 * @tree: Expanded overlay device tree
468 * 508 *
469 * Creates and applies an overlay while also keeping track 509 * Creates and applies an overlay changeset. If successful, the overlay
470 * of the overlay in a list. This list can be used to prevent 510 * changeset is added to the overlay changeset list.
471 * illegal overlay removals.
472 * 511 *
473 * Returns the id of the created overlay, or a negative error number 512 * Returns the id of the created overlay changeset, or a negative error number
474 */ 513 */
475int of_overlay_create(struct device_node *tree) 514int of_overlay_apply(struct device_node *tree)
476{ 515{
477 struct of_overlay *ov; 516 struct overlay_changeset *ovcs;
478 int err, id; 517 int id, ret;
479 518
480 ov = kzalloc(sizeof(*ov), GFP_KERNEL); 519 ovcs = kzalloc(sizeof(*ovcs), GFP_KERNEL);
481 if (!ov) 520 if (!ovcs)
482 return -ENOMEM; 521 return -ENOMEM;
483 ov->id = -1; 522 ovcs->id = -1;
484 523
485 INIT_LIST_HEAD(&ov->node); 524 INIT_LIST_HEAD(&ovcs->ovcs_list);
486 525
487 of_changeset_init(&ov->cset); 526 of_changeset_init(&ovcs->cset);
488 527
489 mutex_lock(&of_mutex); 528 mutex_lock(&of_mutex);
490 529
491 id = idr_alloc(&ov_idr, ov, 0, 0, GFP_KERNEL); 530 id = idr_alloc(&ovcs_idr, ovcs, 0, 0, GFP_KERNEL);
492 if (id < 0) { 531 if (id < 0) {
493 err = id; 532 ret = id;
494 goto err_destroy_trans; 533 goto err_destroy_trans;
495 } 534 }
496 ov->id = id; 535 ovcs->id = id;
497 536
498 err = of_build_overlay_info(ov, tree); 537 ret = init_overlay_changeset(ovcs, tree);
499 if (err) { 538 if (ret) {
500 pr_err("of_build_overlay_info() failed for tree@%pOF\n", 539 pr_err("init_overlay_changeset() failed for tree@%pOF\n",
501 tree); 540 tree);
502 goto err_free_idr; 541 goto err_free_idr;
503 } 542 }
504 543
505 err = of_overlay_notify(ov, OF_OVERLAY_PRE_APPLY); 544 ret = overlay_notify(ovcs, OF_OVERLAY_PRE_APPLY);
506 if (err < 0) { 545 if (ret < 0) {
507 pr_err("%s: Pre-apply notifier failed (err=%d)\n", 546 pr_err("%s: Pre-apply notifier failed (ret=%d)\n",
508 __func__, err); 547 __func__, ret);
509 goto err_free_idr; 548 goto err_free_overlay_fragments;
510 } 549 }
511 550
512 err = of_overlay_apply(ov); 551 ret = build_changeset(ovcs);
513 if (err) 552 if (ret)
514 goto err_abort_trans; 553 goto err_free_overlay_fragments;
515
516 err = __of_changeset_apply(&ov->cset);
517 if (err)
518 goto err_revert_overlay;
519 554
555 ret = __of_changeset_apply(&ovcs->cset);
556 if (ret)
557 goto err_free_overlay_fragments;
520 558
521 list_add_tail(&ov->node, &ov_list); 559 list_add_tail(&ovcs->ovcs_list, &ovcs_list);
522 560
523 of_overlay_notify(ov, OF_OVERLAY_POST_APPLY); 561 overlay_notify(ovcs, OF_OVERLAY_POST_APPLY);
524 562
525 mutex_unlock(&of_mutex); 563 mutex_unlock(&of_mutex);
526 564
527 return id; 565 return id;
528 566
529err_revert_overlay: 567err_free_overlay_fragments:
530err_abort_trans: 568 free_overlay_fragments(ovcs);
531 of_free_overlay_info(ov);
532err_free_idr: 569err_free_idr:
533 idr_remove(&ov_idr, ov->id); 570 idr_remove(&ovcs_idr, ovcs->id);
534err_destroy_trans: 571err_destroy_trans:
535 of_changeset_destroy(&ov->cset); 572 of_changeset_destroy(&ovcs->cset);
536 kfree(ov); 573 kfree(ovcs);
537 mutex_unlock(&of_mutex); 574 mutex_unlock(&of_mutex);
538 575
539 return err; 576 return ret;
540} 577}
541EXPORT_SYMBOL_GPL(of_overlay_create); 578EXPORT_SYMBOL_GPL(of_overlay_apply);
542 579
543/* 580/*
544 * check whether the given node, lies under the given tree 581 * Find @np in @tree.
545 * return 1 if under tree, else 0 582 *
583 * Returns 1 if @np is @tree or is contained in @tree, else 0
546 */ 584 */
547static int overlay_subtree_check(struct device_node *tree, 585static int find_node(struct device_node *tree, struct device_node *np)
548 struct device_node *dn)
549{ 586{
550 struct device_node *child; 587 struct device_node *child;
551 588
552 if (tree == dn) 589 if (tree == np)
553 return 1; 590 return 1;
554 591
555 for_each_child_of_node(tree, child) { 592 for_each_child_of_node(tree, child) {
556 if (overlay_subtree_check(child, dn)) { 593 if (find_node(child, np)) {
557 of_node_put(child); 594 of_node_put(child);
558 return 1; 595 return 1;
559 } 596 }
@@ -563,30 +600,32 @@ static int overlay_subtree_check(struct device_node *tree,
563} 600}
564 601
565/* 602/*
566 * check whether this overlay is the topmost 603 * Is @remove_ce_np a child of or the same as any
567 * return 1 if topmost, else 0 604 * node in an overlay changeset more topmost than @remove_ovcs?
605 *
606 * Returns 1 if found, else 0
568 */ 607 */
569static int overlay_is_topmost(struct of_overlay *ov, struct device_node *dn) 608static int node_in_later_cs(struct overlay_changeset *remove_ovcs,
609 struct device_node *remove_ce_np)
570{ 610{
571 struct of_overlay *ovt; 611 struct overlay_changeset *ovcs;
572 struct of_changeset_entry *ce; 612 struct of_changeset_entry *ce;
573 613
574 list_for_each_entry_reverse(ovt, &ov_list, node) { 614 list_for_each_entry_reverse(ovcs, &ovcs_list, ovcs_list) {
575 /* if we hit ourselves, we're done */ 615 if (ovcs == remove_ovcs)
576 if (ovt == ov)
577 break; 616 break;
578 617
579 /* check against each subtree affected by this overlay */ 618 list_for_each_entry(ce, &ovcs->cset.entries, node) {
580 list_for_each_entry(ce, &ovt->cset.entries, node) { 619 if (find_node(ce->np, remove_ce_np)) {
581 if (overlay_subtree_check(ce->np, dn)) {
582 pr_err("%s: #%d clashes #%d @%pOF\n", 620 pr_err("%s: #%d clashes #%d @%pOF\n",
583 __func__, ov->id, ovt->id, dn); 621 __func__, remove_ovcs->id, ovcs->id,
584 return 0; 622 remove_ce_np);
623 return 1;
585 } 624 }
586 } 625 }
587 } 626 }
588 627
589 return 1; 628 return 0;
590} 629}
591 630
592/* 631/*
@@ -599,13 +638,13 @@ static int overlay_is_topmost(struct of_overlay *ov, struct device_node *dn)
599 * the one closest to the tail. If another overlay has affected this 638 * the one closest to the tail. If another overlay has affected this
600 * device node and is closest to the tail, then removal is not permited. 639 * device node and is closest to the tail, then removal is not permited.
601 */ 640 */
602static int overlay_removal_is_ok(struct of_overlay *ov) 641static int overlay_removal_is_ok(struct overlay_changeset *remove_ovcs)
603{ 642{
604 struct of_changeset_entry *ce; 643 struct of_changeset_entry *remove_ce;
605 644
606 list_for_each_entry(ce, &ov->cset.entries, node) { 645 list_for_each_entry(remove_ce, &remove_ovcs->cset.entries, node) {
607 if (!overlay_is_topmost(ov, ce->np)) { 646 if (node_in_later_cs(remove_ovcs, remove_ce->np)) {
608 pr_err("overlay #%d is not topmost\n", ov->id); 647 pr_err("overlay #%d is not topmost\n", remove_ovcs->id);
609 return 0; 648 return 0;
610 } 649 }
611 } 650 }
@@ -614,74 +653,73 @@ static int overlay_removal_is_ok(struct of_overlay *ov)
614} 653}
615 654
616/** 655/**
617 * of_overlay_destroy() - Removes an overlay 656 * of_overlay_remove() - Revert and free an overlay changeset
618 * @id: Overlay id number returned by a previous call to of_overlay_create 657 * @ovcs_id: Overlay changeset id number
619 * 658 *
620 * Removes an overlay if it is permissible. 659 * Removes an overlay if it is permissible. ovcs_id was previously returned
660 * by of_overlay_apply().
621 * 661 *
622 * Returns 0 on success, or a negative error number 662 * Returns 0 on success, or a negative error number
623 */ 663 */
624int of_overlay_destroy(int id) 664int of_overlay_remove(int ovcs_id)
625{ 665{
626 struct of_overlay *ov; 666 struct overlay_changeset *ovcs;
627 int err; 667 int ret = 0;
628 668
629 mutex_lock(&of_mutex); 669 mutex_lock(&of_mutex);
630 670
631 ov = idr_find(&ov_idr, id); 671 ovcs = idr_find(&ovcs_idr, ovcs_id);
632 if (!ov) { 672 if (!ovcs) {
633 err = -ENODEV; 673 ret = -ENODEV;
634 pr_err("destroy: Could not find overlay #%d\n", id); 674 pr_err("remove: Could not find overlay #%d\n", ovcs_id);
635 goto out; 675 goto out;
636 } 676 }
637 677
638 if (!overlay_removal_is_ok(ov)) { 678 if (!overlay_removal_is_ok(ovcs)) {
639 err = -EBUSY; 679 ret = -EBUSY;
640 goto out; 680 goto out;
641 } 681 }
642 682
643 of_overlay_notify(ov, OF_OVERLAY_PRE_REMOVE); 683 overlay_notify(ovcs, OF_OVERLAY_PRE_REMOVE);
644 list_del(&ov->node); 684 list_del(&ovcs->ovcs_list);
645 __of_changeset_revert(&ov->cset); 685 __of_changeset_revert(&ovcs->cset);
646 of_overlay_notify(ov, OF_OVERLAY_POST_REMOVE); 686 overlay_notify(ovcs, OF_OVERLAY_POST_REMOVE);
647 of_free_overlay_info(ov); 687 free_overlay_fragments(ovcs);
648 idr_remove(&ov_idr, id); 688 idr_remove(&ovcs_idr, ovcs_id);
649 of_changeset_destroy(&ov->cset); 689 of_changeset_destroy(&ovcs->cset);
650 kfree(ov); 690 kfree(ovcs);
651
652 err = 0;
653 691
654out: 692out:
655 mutex_unlock(&of_mutex); 693 mutex_unlock(&of_mutex);
656 694
657 return err; 695 return ret;
658} 696}
659EXPORT_SYMBOL_GPL(of_overlay_destroy); 697EXPORT_SYMBOL_GPL(of_overlay_remove);
660 698
661/** 699/**
662 * of_overlay_destroy_all() - Removes all overlays from the system 700 * of_overlay_remove_all() - Reverts and frees all overlay changesets
663 * 701 *
664 * Removes all overlays from the system in the correct order. 702 * Removes all overlays from the system in the correct order.
665 * 703 *
666 * Returns 0 on success, or a negative error number 704 * Returns 0 on success, or a negative error number
667 */ 705 */
668int of_overlay_destroy_all(void) 706int of_overlay_remove_all(void)
669{ 707{
670 struct of_overlay *ov, *ovn; 708 struct overlay_changeset *ovcs, *ovcs_n;
671 709
672 mutex_lock(&of_mutex); 710 mutex_lock(&of_mutex);
673 711
674 /* the tail of list is guaranteed to be safe to remove */ 712 /* the tail of list is guaranteed to be safe to remove */
675 list_for_each_entry_safe_reverse(ov, ovn, &ov_list, node) { 713 list_for_each_entry_safe_reverse(ovcs, ovcs_n, &ovcs_list, ovcs_list) {
676 list_del(&ov->node); 714 list_del(&ovcs->ovcs_list);
677 __of_changeset_revert(&ov->cset); 715 __of_changeset_revert(&ovcs->cset);
678 of_free_overlay_info(ov); 716 free_overlay_fragments(ovcs);
679 idr_remove(&ov_idr, ov->id); 717 idr_remove(&ovcs_idr, ovcs->id);
680 kfree(ov); 718 kfree(ovcs);
681 } 719 }
682 720
683 mutex_unlock(&of_mutex); 721 mutex_unlock(&of_mutex);
684 722
685 return 0; 723 return 0;
686} 724}
687EXPORT_SYMBOL_GPL(of_overlay_destroy_all); 725EXPORT_SYMBOL_GPL(of_overlay_remove_all);
diff --git a/drivers/of/unittest.c b/drivers/of/unittest.c
index add02cfbfb88..bbdaf5606820 100644
--- a/drivers/of/unittest.c
+++ b/drivers/of/unittest.c
@@ -1230,7 +1230,7 @@ static void of_unittest_destroy_tracked_overlays(void)
1230 if (!(overlay_id_bits[BIT_WORD(id)] & BIT_MASK(id))) 1230 if (!(overlay_id_bits[BIT_WORD(id)] & BIT_MASK(id)))
1231 continue; 1231 continue;
1232 1232
1233 ret = of_overlay_destroy(id + overlay_first_id); 1233 ret = of_overlay_remove(id + overlay_first_id);
1234 if (ret == -ENODEV) { 1234 if (ret == -ENODEV) {
1235 pr_warn("%s: no overlay to destroy for #%d\n", 1235 pr_warn("%s: no overlay to destroy for #%d\n",
1236 __func__, id + overlay_first_id); 1236 __func__, id + overlay_first_id);
@@ -1262,7 +1262,7 @@ static int of_unittest_apply_overlay(int overlay_nr, int unittest_nr,
1262 goto out; 1262 goto out;
1263 } 1263 }
1264 1264
1265 ret = of_overlay_create(np); 1265 ret = of_overlay_apply(np);
1266 if (ret < 0) { 1266 if (ret < 0) {
1267 unittest(0, "could not create overlay from \"%s\"\n", 1267 unittest(0, "could not create overlay from \"%s\"\n",
1268 overlay_path(overlay_nr)); 1268 overlay_path(overlay_nr));
@@ -1347,7 +1347,7 @@ static int of_unittest_apply_revert_overlay_check(int overlay_nr,
1347 return -EINVAL; 1347 return -EINVAL;
1348 } 1348 }
1349 1349
1350 ret = of_overlay_destroy(ov_id); 1350 ret = of_overlay_remove(ov_id);
1351 if (ret != 0) { 1351 if (ret != 0) {
1352 unittest(0, "overlay @\"%s\" failed to be destroyed @\"%s\"\n", 1352 unittest(0, "overlay @\"%s\" failed to be destroyed @\"%s\"\n",
1353 overlay_path(overlay_nr), 1353 overlay_path(overlay_nr),
@@ -1476,7 +1476,7 @@ static void of_unittest_overlay_6(void)
1476 return; 1476 return;
1477 } 1477 }
1478 1478
1479 ret = of_overlay_create(np); 1479 ret = of_overlay_apply(np);
1480 if (ret < 0) { 1480 if (ret < 0) {
1481 unittest(0, "could not create overlay from \"%s\"\n", 1481 unittest(0, "could not create overlay from \"%s\"\n",
1482 overlay_path(overlay_nr + i)); 1482 overlay_path(overlay_nr + i));
@@ -1500,7 +1500,7 @@ static void of_unittest_overlay_6(void)
1500 } 1500 }
1501 1501
1502 for (i = 1; i >= 0; i--) { 1502 for (i = 1; i >= 0; i--) {
1503 ret = of_overlay_destroy(ov_id[i]); 1503 ret = of_overlay_remove(ov_id[i]);
1504 if (ret != 0) { 1504 if (ret != 0) {
1505 unittest(0, "overlay @\"%s\" failed destroy @\"%s\"\n", 1505 unittest(0, "overlay @\"%s\" failed destroy @\"%s\"\n",
1506 overlay_path(overlay_nr + i), 1506 overlay_path(overlay_nr + i),
@@ -1546,7 +1546,7 @@ static void of_unittest_overlay_8(void)
1546 return; 1546 return;
1547 } 1547 }
1548 1548
1549 ret = of_overlay_create(np); 1549 ret = of_overlay_apply(np);
1550 if (ret < 0) { 1550 if (ret < 0) {
1551 unittest(0, "could not create overlay from \"%s\"\n", 1551 unittest(0, "could not create overlay from \"%s\"\n",
1552 overlay_path(overlay_nr + i)); 1552 overlay_path(overlay_nr + i));
@@ -1557,7 +1557,7 @@ static void of_unittest_overlay_8(void)
1557 } 1557 }
1558 1558
1559 /* now try to remove first overlay (it should fail) */ 1559 /* now try to remove first overlay (it should fail) */
1560 ret = of_overlay_destroy(ov_id[0]); 1560 ret = of_overlay_remove(ov_id[0]);
1561 if (ret == 0) { 1561 if (ret == 0) {
1562 unittest(0, "overlay @\"%s\" was destroyed @\"%s\"\n", 1562 unittest(0, "overlay @\"%s\" was destroyed @\"%s\"\n",
1563 overlay_path(overlay_nr + 0), 1563 overlay_path(overlay_nr + 0),
@@ -1568,7 +1568,7 @@ static void of_unittest_overlay_8(void)
1568 1568
1569 /* removing them in order should work */ 1569 /* removing them in order should work */
1570 for (i = 1; i >= 0; i--) { 1570 for (i = 1; i >= 0; i--) {
1571 ret = of_overlay_destroy(ov_id[i]); 1571 ret = of_overlay_remove(ov_id[i]);
1572 if (ret != 0) { 1572 if (ret != 0) {
1573 unittest(0, "overlay @\"%s\" not destroyed @\"%s\"\n", 1573 unittest(0, "overlay @\"%s\" not destroyed @\"%s\"\n",
1574 overlay_path(overlay_nr + i), 1574 overlay_path(overlay_nr + i),
@@ -2149,9 +2149,9 @@ static int __init overlay_data_add(int onum)
2149 goto out_free_np_overlay; 2149 goto out_free_np_overlay;
2150 } 2150 }
2151 2151
2152 ret = of_overlay_create(info->np_overlay); 2152 ret = of_overlay_apply(info->np_overlay);
2153 if (ret < 0) { 2153 if (ret < 0) {
2154 pr_err("of_overlay_create() (ret=%d), %d\n", ret, onum); 2154 pr_err("of_overlay_apply() (ret=%d), %d\n", ret, onum);
2155 goto out_free_np_overlay; 2155 goto out_free_np_overlay;
2156 } else { 2156 } else {
2157 info->overlay_id = ret; 2157 info->overlay_id = ret;
diff --git a/include/linux/of.h b/include/linux/of.h
index 7b0f17be7830..7569e9cc45de 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -1312,26 +1312,26 @@ struct of_overlay_notify_data {
1312#ifdef CONFIG_OF_OVERLAY 1312#ifdef CONFIG_OF_OVERLAY
1313 1313
1314/* ID based overlays; the API for external users */ 1314/* ID based overlays; the API for external users */
1315int of_overlay_create(struct device_node *tree); 1315int of_overlay_apply(struct device_node *tree);
1316int of_overlay_destroy(int id); 1316int of_overlay_remove(int id);
1317int of_overlay_destroy_all(void); 1317int of_overlay_remove_all(void);
1318 1318
1319int of_overlay_notifier_register(struct notifier_block *nb); 1319int of_overlay_notifier_register(struct notifier_block *nb);
1320int of_overlay_notifier_unregister(struct notifier_block *nb); 1320int of_overlay_notifier_unregister(struct notifier_block *nb);
1321 1321
1322#else 1322#else
1323 1323
1324static inline int of_overlay_create(struct device_node *tree) 1324static inline int of_overlay_apply(struct device_node *tree)
1325{ 1325{
1326 return -ENOTSUPP; 1326 return -ENOTSUPP;
1327} 1327}
1328 1328
1329static inline int of_overlay_destroy(int id) 1329static inline int of_overlay_remove(int id)
1330{ 1330{
1331 return -ENOTSUPP; 1331 return -ENOTSUPP;
1332} 1332}
1333 1333
1334static inline int of_overlay_destroy_all(void) 1334static inline int of_overlay_remove_all(void)
1335{ 1335{
1336 return -ENOTSUPP; 1336 return -ENOTSUPP;
1337} 1337}