aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/of/overlay.c (follow)
AgeCommit message (Collapse)AuthorFilesLines
2017-07-20of: overlay: add overlay symbols to live device treeFrank Rowand1-9/+107
Add overlay __symbols__ properties to live tree when an overlay is added to the live tree so that the symbols are available to subsequent overlays. Expected test result is new __symbols__ entries for labels from the overlay after this commit. Before this commit: Console error message near end of unittest: ### dt-test ### FAIL of_unittest_overlay_high_level():2296 Adding overlay 'overlay_bad_symbol' failed ### dt-test ### end of unittest - 190 passed, 1 failed The new unittest "fails" because the expected result of loading the new overlay is an error instead of success. $ # node hvac-medium-2 exists because the overlay loaded $ # since the duplicate symbol was not detected $ cd /proc/device-tree/testcase-data-2/substation@100/ $ ls compatible hvac-medium-2 motor-8 reg hvac-large-1 linux,phandle name status hvac-medium-1 motor-1 phandle $ cd /proc/device-tree/__symbols__/ $ ls electric_1 lights_1 name rides_1 spin_ctrl_2 hvac_1 lights_2 retail_1 spin_ctrl_1 After this commit: Previous console error message no longer occurs, but expected error occurs: OF: overlay: Failed to apply prop @/__symbols__/hvac_1 OF: overlay: apply failed '/__symbols__' ### dt-test ### end of unittest - 191 passed, 0 failed $ # node hvac-medium-2 does not exist because the overlay $ # properly failed to load due to the duplicate symbol $ cd /proc/device-tree/testcase-data-2/substation@100/ $ ls compatible hvac-medium-1 motor-1 name reg hvac-large-1 linux,phandle motor-8 phandle status $ cd /proc/device-tree/__symbols__/ $ ls electric_1 lights_1 retail_1 ride_200_right spin_ctrl_2 hvac_1 lights_2 ride_200 rides_1 hvac_2 name ride_200_left spin_ctrl_1 $ cat ride_200; echo /testcase-data-2/fairway-1/ride@200 $ cat ride_200_left ; echo /testcase-data-2/fairway-1/ride@200/track@10 $ cat ride_200_right ; echo /testcase-data-2/fairway-1/ride@200/track@20 Signed-off-by: Frank Rowand <frank.rowand@sony.com> Signed-off-by: Rob Herring <robh@kernel.org>
2017-07-20of: overlay: correctly apply overlay node with unit-addressFrank Rowand1-1/+4
Correct existing node name detection when overlay node name has a unit-address. Expected test result is overlay will update the nodes and properties for /testcase-data-2/fairway-1/ride@100/ after this commit. Before this commit: Console error message near end of unittest: OF: Duplicate name in fairway-1, renamed to "ride@100#1" $ cd /proc/device-tree/testcase-data-2/fairway-1/ $ # extra node: ride@100#1 $ ls #address-cells linux,phandle phandle ride@200 #size-cells name ride@100 status compatible orientation ride@100#1 $ cd /proc/device-tree/testcase-data-2/fairway-1/ride@100/ $ ls track@30/incline-up ls: track@30/incline-up: No such file or directory $ ls track@40/incline-up ls: track@40/incline-up: No such file or directory After this commit: Console error message no longer occurs $ cd /proc/device-tree/testcase-data-2/fairway-1/ $ # no extra node: ride@100#1 $ ls #address-cells compatible name phandle ride@200 #size-cells linux,phandle orientation ride@100 status $ cd /proc/device-tree/testcase-data-2/fairway-1/ride@100/ $ ls track@30/incline-up track@30/incline-up $ ls track@40/incline-up track@40/incline-up Signed-off-by: Frank Rowand <frank.rowand@sony.com> Signed-off-by: Rob Herring <robh@kernel.org>
2017-07-18of: Convert to using %pOF instead of full_nameRob Herring1-11/+10
Now that we have a custom printf format specifier, convert users of full_name to use %pOF instead. This is preparation to remove storing of the full path string for each node. Signed-off-by: Rob Herring <robh@kernel.org>
2017-06-22of: detect invalid phandle in overlayFrank Rowand1-0/+4
Overlays are not allowed to modify phandle values of previously existing nodes because there is no information available to allow fixup up properties that use the previously existing phandle. Signed-off-by: Frank Rowand <frank.rowand@sony.com> Signed-off-by: Rob Herring <robh@kernel.org>
2017-01-09of: remove redundant memset in overlayXuYing1-1/+0
memset in of_build_overlay_info is redundant, the ovinfo has been zeroed in of_fill_overlay_info when error. Signed-off-by: YiPing Xu <xuyiping@hisilicon.com> Signed-off-by: Rob Herring <robh@kernel.org>
2017-01-04of: drop duplicate headersGeliang Tang1-1/+0
Drop duplicate headers string.h and of_platform.h. Signed-off-by: Geliang Tang <geliangtang@gmail.com> Signed-off-by: Rob Herring <robh@kernel.org>
2016-11-10of/overlay: add of overlay notificationsAlan Tull1-1/+46
This patch add of overlay notifications. When DT overlays are being added, some drivers/subsystems need to see device tree overlays before the changes go into the live tree. This is distinct from reconfig notifiers that are post-apply or post-remove and which issue very granular notifications without providing access to the context of a whole overlay. The following 4 notificatons are issued: OF_OVERLAY_PRE_APPLY OF_OVERLAY_POST_APPLY OF_OVERLAY_PRE_REMOVE OF_OVERLAY_POST_REMOVE In the case of pre-apply notification, if the notifier returns error, the overlay will be rejected. This patch exports two functions for registering/unregistering notifications: of_overlay_notifier_register(struct notifier_block *nb) of_overlay_notifier_unregister(struct notifier_block *nb) The of_mutex is held during these notifications. The notification data includes pointers to the overlay target and the overlay: struct of_overlay_notify_data { struct device_node *overlay; struct device_node *target; }; Signed-off-by: Alan Tull <atull@opensource.altera.com> Acked-by: Rob Herring <robh@kernel.org> Acked-by: Moritz Fischer <moritz.fischer@ettus.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-07-18of: use pr_fmt prefix for all console printingRob Herring1-27/+16
Clean-up all the DT printk functions to use common pr_fmt prefix. Some print statements such as kmalloc errors were redundant, so just drop those. Cc: Frank Rowand <frowand.list@gmail.com> Cc: Pantelis Antoniou <pantelis.antoniou@konsulko.com> Reviewed-by: Frank Rowand <frank.rowand@am.sony.com> Signed-off-by: Rob Herring <robh@kernel.org>
2016-01-13drivers/of: Export OF changeset functionsGavin Shan1-4/+4
The PowerNV PCI hotplug driver is going to use the OF changeset to manage the changed device sub-tree. This exports those OF changeset functions for that. Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com> Acked-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Tested-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Signed-off-by: Rob Herring <robh@kernel.org>
2015-10-22of/overlay: add missing of_node_putJulia Lawall1-1/+4
for_each_child_of_node performs an of_node_get on each iteration, so a break out of the loop requires an of_node_put. A simplified version of the semantic patch that fixes this problem is as follows (http://coccinelle.lip6.fr): // <smpl> @@ expression root,e; local idexpression child; @@ for_each_child_of_node(root, child) { ... when != of_node_put(child) when != e = child ( return child; | + of_node_put(child); ? return ...; ) ... } // </smpl> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Signed-off-by: Rob Herring <robh@kernel.org>
2015-05-28of/overlay: Grammar s/an negative/a negative/Geert Uytterhoeven1-3/+3
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Signed-off-by: Rob Herring <robh@kernel.org>
2015-03-10of/overlay: Remove unused variableFabio Estevam1-1/+1
Commit 3e7f7626fd49a ("of/overlay: Do not generate duplicate nodes") removed the only use of the 'grandchild' variable, which leads to the following build warning: drivers/of/overlay.c: In function 'of_overlay_apply_single_device_node': drivers/of/overlay.c:89:31: warning: unused variable 'grandchild' [-Wunused-variable] struct device_node *tchild, *grandchild; ^ Remove this unused variable. Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Signed-off-by: Rob Herring <robh@kernel.org>
2015-03-02of/overlay: Directly include idr.hMark Brown1-0/+1
The overlay code uses IDRs but does not explicitly include the header providing the interface, instead relying on an implicit inclusion. Make the dependency explicit to avoid potential future build issues if the implicit inclusion goes away. Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Rob Herring <robh@kernel.org>
2015-01-22of/overlay: Do not generate duplicate nodesPantelis Antoniou1-11/+0
During the course of the rewrites a bug sneaked in when dealing with children nodes of overlays, which ends up duplicating sub nodes. Simply remove the duplicate traversal of child nodes to fix. Signed-off-by: Pantelis Antoniou <pantelis.antoniou@konsulko.com> Signed-off-by: Grant Likely <grant.likely@linaro.org>
2014-11-24of/overlay: Introduce DT overlay supportPantelis Antoniou1-0/+562
Overlays are a method to dynamically modify part of the kernel's device tree with dynamically loaded data. Add the core functionality to parse, apply and remove an overlay changeset. The core functionality takes care of managing the overlay data format and performing the add and remove. Drivers are expected to use the overlay functionality to support custom expansion busses commonly found on consumer development boards like the BeagleBone or Raspberry Pi. The overlay code uses CONFIG_OF_DYNAMIC changesets to perform the low level work of modifying the devicetree. Documentation about internal and APIs is provided in Documentation/devicetree/overlay-notes.txt v2: - Switch from __of_node_alloc() to __of_node_dup() - Documentation fixups - Remove 2-pass processing of properties - Remove separate ov_lock; just use the DT mutex. v1: - Drop delete capability using '-' prefix. The '-' prefixed names are valid properties and nodes and there is no need for it just yet. - Do not update special properties - name & phandle ones. - Change order of node attachment, so that the special property update works. Signed-off-by: Pantelis Antoniou <pantelis.antoniou@konsulko.com> Signed-off-by: Grant Likely <grant.likely@linaro.org>