clk: Make of_clk_get_parent_name() robust with #clock-cells = 1
authorStephen Boyd <sboyd@codeaurora.org>
Wed, 14 Oct 2015 21:03:07 +0000 (14:03 -0700)
committerStephen Boyd <sboyd@codeaurora.org>
Thu, 15 Oct 2015 23:17:03 +0000 (16:17 -0700)
commit0a4807c2f9a4a1afc2163089176abdc7ee4a361a
treec61a4f77029b38602dd1a29539b68b00644e8d8b
parent087a920d4a3e33285f93a0ae7607f71095ffe601
clk: Make of_clk_get_parent_name() robust with #clock-cells = 1

If a clock provider has #clock-cells = 1 and we call
of_clk_get_parent_name() on it we may end up returning the name
of the provider node if the provider doesn't have a
clock-output-names property. This doesn't make sense, especially
when you consider that calling of_clk_get_parent_name() on such a
node with different indices will return the same name each time.

Let's try getting the clock from the framework via of_clk_get()
instead, and only fallback to the node name if we have a provider
with #clock-cells = 0. This way, we can't hand out the same name
for different clocks when we don't actually know their names.

Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
drivers/clk/clk.c