diff options
Diffstat (limited to 'drivers/clk/clk.c')
-rw-r--r-- | drivers/clk/clk.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index ea2ca9ff2677..a6f079d23eaa 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c | |||
@@ -2496,8 +2496,12 @@ EXPORT_SYMBOL_GPL(of_clk_get_parent_count); | |||
2496 | const char *of_clk_get_parent_name(struct device_node *np, int index) | 2496 | const char *of_clk_get_parent_name(struct device_node *np, int index) |
2497 | { | 2497 | { |
2498 | struct of_phandle_args clkspec; | 2498 | struct of_phandle_args clkspec; |
2499 | struct property *prop; | ||
2499 | const char *clk_name; | 2500 | const char *clk_name; |
2501 | const __be32 *vp; | ||
2502 | u32 pv; | ||
2500 | int rc; | 2503 | int rc; |
2504 | int count; | ||
2501 | 2505 | ||
2502 | if (index < 0) | 2506 | if (index < 0) |
2503 | return NULL; | 2507 | return NULL; |
@@ -2507,8 +2511,22 @@ const char *of_clk_get_parent_name(struct device_node *np, int index) | |||
2507 | if (rc) | 2511 | if (rc) |
2508 | return NULL; | 2512 | return NULL; |
2509 | 2513 | ||
2514 | index = clkspec.args_count ? clkspec.args[0] : 0; | ||
2515 | count = 0; | ||
2516 | |||
2517 | /* if there is an indices property, use it to transfer the index | ||
2518 | * specified into an array offset for the clock-output-names property. | ||
2519 | */ | ||
2520 | of_property_for_each_u32(clkspec.np, "clock-indices", prop, vp, pv) { | ||
2521 | if (index == pv) { | ||
2522 | index = count; | ||
2523 | break; | ||
2524 | } | ||
2525 | count++; | ||
2526 | } | ||
2527 | |||
2510 | if (of_property_read_string_index(clkspec.np, "clock-output-names", | 2528 | if (of_property_read_string_index(clkspec.np, "clock-output-names", |
2511 | clkspec.args_count ? clkspec.args[0] : 0, | 2529 | index, |
2512 | &clk_name) < 0) | 2530 | &clk_name) < 0) |
2513 | clk_name = clkspec.np->name; | 2531 | clk_name = clkspec.np->name; |
2514 | 2532 | ||