.. | .. |
---|
63 | 63 | } |
---|
64 | 64 | EXPORT_SYMBOL_GPL(of_reconfig_notifier_unregister); |
---|
65 | 65 | |
---|
66 | | -#ifdef DEBUG |
---|
67 | | -const char *action_names[] = { |
---|
| 66 | +static const char *action_names[] = { |
---|
| 67 | + [0] = "INVALID", |
---|
68 | 68 | [OF_RECONFIG_ATTACH_NODE] = "ATTACH_NODE", |
---|
69 | 69 | [OF_RECONFIG_DETACH_NODE] = "DETACH_NODE", |
---|
70 | 70 | [OF_RECONFIG_ADD_PROPERTY] = "ADD_PROPERTY", |
---|
71 | 71 | [OF_RECONFIG_REMOVE_PROPERTY] = "REMOVE_PROPERTY", |
---|
72 | 72 | [OF_RECONFIG_UPDATE_PROPERTY] = "UPDATE_PROPERTY", |
---|
73 | 73 | }; |
---|
74 | | -#endif |
---|
75 | 74 | |
---|
76 | 75 | int of_reconfig_notify(unsigned long action, struct of_reconfig_data *p) |
---|
77 | 76 | { |
---|
.. | .. |
---|
207 | 206 | |
---|
208 | 207 | if (!of_node_check_flag(np, OF_OVERLAY)) { |
---|
209 | 208 | np->name = __of_get_property(np, "name", NULL); |
---|
210 | | - np->type = __of_get_property(np, "device_type", NULL); |
---|
211 | 209 | if (!np->name) |
---|
212 | 210 | np->name = "<NULL>"; |
---|
213 | | - if (!np->type) |
---|
214 | | - np->type = "<NULL>"; |
---|
215 | 211 | |
---|
216 | 212 | phandle = __of_get_property(np, "phandle", &sz); |
---|
217 | 213 | if (!phandle) |
---|
.. | .. |
---|
279 | 275 | of_node_set_flag(np, OF_DETACHED); |
---|
280 | 276 | |
---|
281 | 277 | /* race with of_find_node_by_phandle() prevented by devtree_lock */ |
---|
282 | | - __of_free_phandle_cache_entry(np->phandle); |
---|
| 278 | + __of_phandle_cache_inv_entry(np->phandle); |
---|
283 | 279 | } |
---|
284 | 280 | |
---|
285 | 281 | /** |
---|
.. | .. |
---|
289 | 285 | { |
---|
290 | 286 | struct of_reconfig_data rd; |
---|
291 | 287 | unsigned long flags; |
---|
292 | | - int rc = 0; |
---|
293 | 288 | |
---|
294 | 289 | memset(&rd, 0, sizeof(rd)); |
---|
295 | 290 | rd.dn = np; |
---|
.. | .. |
---|
304 | 299 | |
---|
305 | 300 | of_reconfig_notify(OF_RECONFIG_DETACH_NODE, &rd); |
---|
306 | 301 | |
---|
307 | | - return rc; |
---|
| 302 | + return 0; |
---|
308 | 303 | } |
---|
309 | 304 | EXPORT_SYMBOL_GPL(of_detach_node); |
---|
310 | 305 | |
---|
.. | .. |
---|
360 | 355 | |
---|
361 | 356 | property_list_free(node->properties); |
---|
362 | 357 | property_list_free(node->deadprops); |
---|
| 358 | + fwnode_links_purge(of_fwnode_handle(node)); |
---|
363 | 359 | |
---|
364 | 360 | kfree(node->full_name); |
---|
365 | 361 | kfree(node->data); |
---|
.. | .. |
---|
593 | 589 | } |
---|
594 | 590 | |
---|
595 | 591 | ret = __of_add_property(ce->np, ce->prop); |
---|
596 | | - if (ret) { |
---|
597 | | - pr_err("changeset: add_property failed @%pOF/%s\n", |
---|
598 | | - ce->np, |
---|
599 | | - ce->prop->name); |
---|
600 | | - break; |
---|
601 | | - } |
---|
602 | 592 | break; |
---|
603 | 593 | case OF_RECONFIG_REMOVE_PROPERTY: |
---|
604 | 594 | ret = __of_remove_property(ce->np, ce->prop); |
---|
605 | | - if (ret) { |
---|
606 | | - pr_err("changeset: remove_property failed @%pOF/%s\n", |
---|
607 | | - ce->np, |
---|
608 | | - ce->prop->name); |
---|
609 | | - break; |
---|
610 | | - } |
---|
611 | 595 | break; |
---|
612 | 596 | |
---|
613 | 597 | case OF_RECONFIG_UPDATE_PROPERTY: |
---|
.. | .. |
---|
621 | 605 | } |
---|
622 | 606 | |
---|
623 | 607 | ret = __of_update_property(ce->np, ce->prop, &old_prop); |
---|
624 | | - if (ret) { |
---|
625 | | - pr_err("changeset: update_property failed @%pOF/%s\n", |
---|
626 | | - ce->np, |
---|
627 | | - ce->prop->name); |
---|
628 | | - break; |
---|
629 | | - } |
---|
630 | 608 | break; |
---|
631 | 609 | default: |
---|
632 | 610 | ret = -EINVAL; |
---|
633 | 611 | } |
---|
634 | 612 | raw_spin_unlock_irqrestore(&devtree_lock, flags); |
---|
635 | 613 | |
---|
636 | | - if (ret) |
---|
| 614 | + if (ret) { |
---|
| 615 | + pr_err("changeset: apply failed: %-15s %pOF:%s\n", |
---|
| 616 | + action_names[ce->action], ce->np, ce->prop->name); |
---|
637 | 617 | return ret; |
---|
| 618 | + } |
---|
638 | 619 | |
---|
639 | 620 | switch (ce->action) { |
---|
640 | 621 | case OF_RECONFIG_ATTACH_NODE: |
---|
.. | .. |
---|
913 | 894 | { |
---|
914 | 895 | struct of_changeset_entry *ce; |
---|
915 | 896 | |
---|
| 897 | + if (WARN_ON(action >= ARRAY_SIZE(action_names))) |
---|
| 898 | + return -EINVAL; |
---|
| 899 | + |
---|
916 | 900 | ce = kzalloc(sizeof(*ce), GFP_KERNEL); |
---|
917 | 901 | if (!ce) |
---|
918 | 902 | return -ENOMEM; |
---|