1. 18 Oct, 2017 11 commits
    • Frank Rowand's avatar
      of: overlay: remove a dependency on device node full_name · e0a58f3e
      Frank Rowand authored
      The "%pOF" printf format was recently added to print the
      full name of a device tree node, with the intent of changing
      the node full_name field to contain only the node name instead
      of the full path of the node.
      
      dup_and_fixup_symbol_prop() duplicates a property from the
      "/__symbols__" node of an overlay device tree.  The value
      of each duplicated property must be fixed up to include
      the full path of a node in the live device tree.  The
      current code uses the node's full_name for that purpose.
      Update the code to use the "%pOF" printf format to
      determine the node's full path.
      Signed-off-by: default avatarFrank Rowand <frank.rowand@sony.com>
      Signed-off-by: default avatarRob Herring <robh@kernel.org>
      e0a58f3e
    • Frank Rowand's avatar
      of: overlay: simplify applying symbols from an overlay · 3912b791
      Frank Rowand authored
      The code to apply symbols from an overlay to the live device tree
      was implemented with the intent to be minimally intrusive on the
      existing code.  After recent restructuring of the overlay apply
      code, it is easier to disintangle the code that applies the
      symbols, and to make the overlay changeset creation code more
      straight forward and understandable.
      
      Remove the extra complexity, and make the code more obvious.
      Signed-off-by: default avatarFrank Rowand <frank.rowand@sony.com>
      Signed-off-by: default avatarRob Herring <robh@kernel.org>
      3912b791
    • Frank Rowand's avatar
      of: overlay: avoid race condition between applying multiple overlays · f948d6d8
      Frank Rowand authored
      The process of applying an overlay consists of:
        - unflatten an overlay FDT (flattened device tree) into an
          EDT (expanded device tree)
        - fixup the phandle values in the overlay EDT to fit in a
          range above the phandle values in the live device tree
        - create the overlay changeset to reflect the contents of
          the overlay EDT
        - apply the overlay changeset, to modify the live device tree,
          potentially changing the maximum phandle value in the live
          device tree
      
      There is currently no protection against two overlay applies
      concurrently determining what range of phandle values are in use
      in the live device tree, and subsequently changing that range.
      Add a mutex to prevent multiple overlay applies from occurring
      simultaneously.
      
      Move of_resolve_phandles() into of_overlay_apply() so that it does not
      have to be duplicated by each caller of of_overlay_apply().
      
      The test in of_resolve_phandles() that the overlay tree is detached is
      temporarily disabled so that old style overlay unittests do not fail.
      Signed-off-by: default avatarFrank Rowand <frank.rowand@sony.com>
      Signed-off-by: default avatarRob Herring <robh@kernel.org>
      f948d6d8
    • Frank Rowand's avatar
      of: overlay: loosen overly strict phandle clash check · 6d0f5470
      Frank Rowand authored
      When an overlay contains a node that already exists in
      the live device tree, the overlay node is not allowed
      to change the phandle of the existing node.
      
      The existing check refused to allow an overlay node to
      set the node phandle even when the existing node did
      not have a phandle.  Relax the check to allow an
      overlay node to set the phandle value if the existing
      node does not have a phandle.
      Signed-off-by: default avatarFrank Rowand <frank.rowand@sony.com>
      Signed-off-by: default avatarRob Herring <robh@kernel.org>
      6d0f5470
    • Frank Rowand's avatar
      of: overlay: expand check of whether overlay changeset can be removed · 87f242c1
      Frank Rowand authored
      The test of whether it is safe to remove an overlay changeset
      looked at whether any node in the overlay changeset was in a
      subtree rooted at any more recently applied overlay changeset
      node.
      
      The test failed to determine whether any node in the overlay
      changeset was the root of a subtree that contained a more
      recently applied overlay changeset node.  Add this additional
      check to the test.
      
      The test is still lacking any check for any phandle dependencies.
      Signed-off-by: default avatarFrank Rowand <frank.rowand@sony.com>
      Signed-off-by: default avatarRob Herring <robh@kernel.org>
      87f242c1
    • Frank Rowand's avatar
      of: overlay: detect cases where device tree may become corrupt · 24789c5c
      Frank Rowand authored
      When an attempt to apply an overlay changeset fails, an effort
      is made to revert any partial application of the changeset.
      When an attempt to remove an overlay changeset fails, an effort
      is made to re-apply any partial reversion of the changeset.
      
      The existing code does not check for failure to recover a failed
      overlay changeset application or overlay changeset revert.
      
      Add the missing checks and flag the devicetree as corrupt if the
      state of the devicetree can not be determined.
      
      Improve and expand the returned errors to more fully reflect the
      result of the effort to undo the partial effects of a failed attempt
      to apply or remove an overlay changeset.
      
      If the device tree might be corrupt, do not allow further attempts
      to apply or remove an overlay changeset.
      
      When creating an overlay changeset from an overlay device tree,
      add some additional warnings if the state of the overlay device
      tree is not as expected.
      Signed-off-by: default avatarFrank Rowand <frank.rowand@sony.com>
      Signed-off-by: default avatarRob Herring <robh@kernel.org>
      24789c5c
    • Frank Rowand's avatar
      of: overlay: minor restructuring · 61b4de4e
      Frank Rowand authored
      Continue improving the readability of overlay.c.  The previous patches
      renamed identifiers.  This patch is split out from the previous patches
      to make the previous patches easier to review.
      
      Changes are:
        - minor code restructuring
        - some initialization of an overlay changeset occurred outside of
          init_overlay_changeset(), move that into init_overlay_changeset()
        - consolidate freeing an overlay changeset into free_overlay_changeset()
      
      This patch is intended to not introduce any functional change.
      Signed-off-by: default avatarFrank Rowand <frank.rowand@sony.com>
      Signed-off-by: default avatarRob Herring <robh@kernel.org>
      61b4de4e
    • Frank Rowand's avatar
      of: overlay: rename identifiers in dup_and_fixup_symbol_prop() · 42b2e94f
      Frank Rowand authored
      More renaming of identifiers to better reflect what they do.
      Signed-off-by: default avatarFrank Rowand <frank.rowand@sony.com>
      Signed-off-by: default avatarRob Herring <robh@kernel.org>
      42b2e94f
    • Frank Rowand's avatar
      of: overlay: rename identifiers to more reflect what they do · 0290c4ca
      Frank Rowand authored
      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: default avatarFrank Rowand <frank.rowand@sony.com>
      Signed-off-by: default avatarRob Herring <robh@kernel.org>
      0290c4ca
    • Frank Rowand's avatar
      of: overlay.c: Convert comparisons to zero or NULL to logical expressions · bbed8794
      Frank Rowand authored
      Use normal shorthand for comparing a variable to zero.
      For variable "XXX":
         convert (XXX == 0) to (!XXX)
         convert (XXX != 0) to (XXX)
      Signed-off-by: default avatarFrank Rowand <frank.rowand@sony.com>
      Signed-off-by: default avatarRob Herring <robh@kernel.org>
      bbed8794
    • Frank Rowand's avatar
      of: overlay.c: Remove comments that state the obvious, to reduce clutter · 646afc4a
      Frank Rowand authored
      Follows recommendations in Documentation/process/coding-style.rst,
      section 8, Commenting.
      
      Some in function comments are promoted to function header comments.
      Signed-off-by: default avatarFrank Rowand <frank.rowand@sony.com>
      Signed-off-by: default avatarRob Herring <robh@kernel.org>
      646afc4a
  2. 17 Oct, 2017 2 commits
  3. 16 Oct, 2017 12 commits
  4. 13 Oct, 2017 2 commits
  5. 05 Oct, 2017 7 commits
  6. 03 Oct, 2017 5 commits
    • Rob Herring's avatar
      scripts/dtc: Update to upstream version v1.4.5-3-gb1a60033c110 · 4201d057
      Rob Herring authored
      This adds the following commits from upstream:
      
      b1a60033c110 tests: Add a test for overlays syntactic sugar
      737b2df39cc8 overlay: Add syntactic sugar version of overlays
      497432fd2131 checks: Use proper format modifier for size_t
      22a65c5331c2 dtc: Bump version to v1.4.5
      c575d8059fff Add fdtoverlay to .gitignore
      b6a6f9490d19 fdtoverlay: Sanity check blob size
      8c1eb1526d2d pylibfdt: Use Python2 explicitly
      ee3d26f6960b checks: add interrupts property check
      c1e7738988f5 checks: add gpio binding properties check
      b3bbac02d5e3 checks: add phandle with arg property checks
      fe50bd1ecc1d fdtget: Split out cell list display into a new function
      62d812308d11 README: Add a note about test_tree1.dts
      5bed86aee9e8 pylibfdt: Add support for fdt_subnode_offset()
      46f31b65b3b3 pylibfdt: Add support for fdt_node_offset_by_phandle()
      a3ae43723687 pylibfdt: Add support for fdt_parent_offset()
      a198af80344c pylibfdt: Add support for fdt_get_phandle()
      b9eba92ea50f tests: Return a failure code when any tests fail
      155faf6cc209 pylibfdt: Use local pylibfdt module
      50e5cd07f325 pylibfdt: Add a test for use of uint32_t
      ab78860f09f5 pylibfdt: Add stdint include to fix uint32_t
      36f511fb1113 tests: Add stacked overlay tests on fdtoverlay
      1bb00655d3e5 fdt: Allow stacked overlays phandle references
      a33c2247ac8d Introduce fdt_setprop_placeholder() method
      0016f8c2aa32 dtc: change default phandles to ePAPR style instead of both
      e3b9a9588a35 tests: fdtoverlay unit test
      42409146f2db fdtoverlay: A tool that applies overlays
      aae22722fc8d manual: Document missing options
      13ce6e1c2fc4 dtc: fix sprintf() format string error, again
      d990b8013889 Makefile: Fix build on MSYS2 and Cygwin
      51f56dedf8ea Clean up shared library compile/link options
      21a2bc896e3d Suppress expected error message in fdtdump test
      2a42b14d0d03 dtc: check.c fix compile error
      a10cb3c818d3 Fix get_node_by_path string equality check
      548aea2c436a fdtdump: Discourage use of fdtdump
      c2258841a785 fdtdump: Fix over-zealous version check
      9067ee4be0e6 Fix a few whitespace and style nits
      e56f2b07be38 pylibfdt: Use setup.py to build the swig file
      896f1c133265 pylibfdt: Use Makefile constructs to implement NO_PYTHON
      90db6d9989ca pylibfdt: Allow setup.py to operate stand-alone
      e20d9658cd8f Add Coverity Scan support
      b04a2cf08862 pylibfdt: Fix code style in setup.py
      1c5170d3a466 pylibfdt: Rename libfdt.swig to libfdt.i
      580a9f6c2880 Add a libfdt function to write a property placeholder
      ab15256d8d02 pylibfdt: Use the call function to simplify the Makefile
      9f2e3a3a1f19 pylibfdt: Use the correct libfdt version in the module
      e91c652af215 pylibfdt: Enable installation of Python module
      8a892fd85d94 pylibfdt: Allow building to be disabled
      741cdff85d3e .travis.yml: Add builds with and without Python library prerequisites
      14c4171f4f9a pylibfdt: Use package_dir to set the package directory
      89a5062ab231 pylibfdt: Use environment to pass C flags and files
      4e0e0d049757 pylibfdt: Allow pkg-config to be supplied in the environment
      6afd7d9688f5 Correct typo: s/pylibgfdt/pylibfdt/
      Signed-off-by: default avatarRob Herring <robh@kernel.org>
      4201d057
    • Rob Herring's avatar
      scripts/dtc: add fdt_overlay.c and fdt_addresses.c to sync script · 43223230
      Rob Herring authored
      libfdt has gained some new files. We need to include them in the
      kernel's copy.
      Reported-by: default avatarKyle Yan <kyan@codeaurora.org>
      Signed-off-by: default avatarRob Herring <robh@kernel.org>
      43223230
    • Rob Herring's avatar
      Merge branch 'dt-printf-v2' into HEAD · 6448c097
      Rob Herring authored
      6448c097
    • Rob Herring's avatar
      of/fdt: only store the device node basename in full_name · a7e4cfb0
      Rob Herring authored
      With dependencies on a statically allocated full path name converted to
      use %pOF format specifier, we can store just the basename of node, and
      the unflattening of the FDT can be simplified.
      
      This commit will affect the remaining users of full_name. After
      analyzing these users, the remaining cases should only change some print
      messages. The main users of full_name are providing a name for struct
      resource. The resource names shouldn't be important other than providing
      /proc/iomem names.
      
      We no longer distinguish between pre and post 0x10 dtb formats as either
      a full path or basename will work. However, less than 0x10 formats have
      been broken since the conversion to use libfdt (and no one has cared).
      The conversion of the unflattening code to be non-recursive also broke
      pre 0x10 formats as the populate_node function would return 0 in that
      case.
      Signed-off-by: default avatarRob Herring <robh@kernel.org>
      a7e4cfb0
    • Rob Herring's avatar
      powerpc: pseries: only store the device node basename in full_name · 06665989
      Rob Herring authored
      With dependencies on full_name containing the entire device node path
      removed, stop storing the full_name in nodes created by
      dlpar_configure_connector() and pSeries_reconfig_add_node().
      Signed-off-by: default avatarRob Herring <robh@kernel.org>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: linuxppc-dev@lists.ozlabs.org
      06665989
  7. 19 Sep, 2017 1 commit