Skip to content
  • Andres Salomon's avatar
    of/promtree: allow DT device matching by fixing 'name' brokenness (v5) · a74ea43d
    Andres Salomon authored
    Commit e2f2a93b
    
    , "of/promtree: add package-to-path support to pdt"
    changed dp->name from using the 'name' property to using
    package-to-path.  This fixed /proc/device-tree creation by eliminating
    conflicts between names (the 'name' property provides names like
    'battery', whereas package-to-path provides names like
    '/foo/bar/battery@0', which we stripped to 'battery@0').  However, it
    also breaks of_device_id table matching.
    
    The fix that we _really_ wanted was to keep dp->name based upon
    the name property ('battery'), but based dp->full_name upon
    package-to-path ('battery@0').  This patch does just that.
    
    This changes all users (except SPARC) of promtree to use the full
    result from package-to-path for full_name, rather than stripping the
    directory out.  In practice, the strings end up being exactly the
    same; this change saves time, code, and memory.
    
    SPARC continues to use the existing build_path_component() code.
    
    v2: combine two patches and revert of_pdt_node_name to original version
    v3: use dp->phandle instead of passing around node
    v4: warn/bail out for non-sparc archs if pkg2path is not set
    v5: split of_pdt_build_full_name into sparc & non-sparc versions
    v6: Pass NULL to pkg2path before buf gets assigned.
        Drop check for pkg2path hook on each and every node.
    v7: Don't BUG() when unable to get the full_path; create a
        known-unique name instead.
    
    Signed-off-by: default avatarAndres Salomon <dilinger@queued.net>
    Signed-off-by: default avatarGrant Likely <grant.likely@secretlab.ca>
    a74ea43d