• Frank Rowand's avatar
    of: overlay: add overlay symbols to live device tree · d1651b03
    Frank Rowand authored
    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: default avatarFrank Rowand <frank.rowand@sony.com>
    Signed-off-by: default avatarRob Herring <robh@kernel.org>
    d1651b03
overlay.c 16.2 KB