• Stephen Boyd's avatar
    clk: Cache core in clk_fetch_parent_index() without names · 1a079560
    Stephen Boyd authored
    If a clk has specified parents via clk_hw pointers it won't specify the
    globally unique names for the parents. Without the unique names, we
    can't fallback to comparing them against the name of the 'parent'
    pointer here. Therefore, do a pointer comparison against the clk_hw
    pointers too and cache the clk_core structure if they match. This fixes
    parent lookup code for clks that only specify clk_hw pointers and
    nothing else, like muxes that are purely inside a clk controller.
    
    Similarly, if the parent pointer isn't cached after trying to match
    clk_core or clk_hw pointers, lookup the pointer from DT or via clkdev
    lookups instead of relying purely on the globally unique clk name match.
    This should allow us to move away from having to specify global names
    for clk parents entirely.
    
    While we're in the area, add some comments so it's clearer what's going
    on. The if statements don't lend themselves to much clarity in their raw
    form.
    
    Fixes: fc0c209c ("clk: Allow parents to be specified without string names")
    Reported-by: default avatarCharles Keepax <ckeepax@opensource.cirrus.com>
    Signed-off-by: default avatarStephen Boyd <sboyd@kernel.org>
    1a079560
clk.c 114 KB