[PATCH v2 2/2] clk: ti: composite: resolve parent clocks by DT index, not by name
From: Mathieu Dubois-Briand
Date: Mon Jul 27 2026 - 03:45:52 EST
Resolve parent clocks by their index into the device tree "clocks"
property rather than matching names as strings. This makes it consistent
with other parts of the same driver.
Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@xxxxxxxxxxx>
---
drivers/clk/ti/composite.c | 26 ++++++++++++++------------
1 file changed, 14 insertions(+), 12 deletions(-)
diff --git a/drivers/clk/ti/composite.c b/drivers/clk/ti/composite.c
index c379bbdae25a..01eae8995254 100644
--- a/drivers/clk/ti/composite.c
+++ b/drivers/clk/ti/composite.c
@@ -52,7 +52,7 @@ static const struct clk_ops ti_composite_gate_ops = {
struct component_clk {
int num_parents;
- const char **parent_names;
+ struct clk_parent_data *parent_data;
struct device_node *node;
int type;
struct clk_hw *hw;
@@ -116,7 +116,7 @@ static void __init _register_composite(void *user,
struct clk_hw_omap_comp *cclk = to_clk_hw_comp(hw);
struct component_clk *comp;
int num_parents = 0;
- const char **parent_names = NULL;
+ struct clk_parent_data *parent_data = NULL;
const char *name;
int i;
int ret;
@@ -155,7 +155,7 @@ static void __init _register_composite(void *user,
continue;
if (comp->num_parents) {
num_parents = comp->num_parents;
- parent_names = comp->parent_names;
+ parent_data = comp->parent_data;
break;
}
}
@@ -166,8 +166,8 @@ static void __init _register_composite(void *user,
}
name = ti_dt_clk_name(node);
- clk = clk_register_composite(NULL, name,
- parent_names, num_parents,
+ clk = clk_register_composite_pdata(NULL, name,
+ parent_data, num_parents,
_get_hw(cclk, CLK_COMPONENT_TYPE_MUX),
&ti_clk_mux_ops,
_get_hw(cclk, CLK_COMPONENT_TYPE_DIVIDER),
@@ -190,7 +190,7 @@ static void __init _register_composite(void *user,
if (!cclk->comp_clks[i])
continue;
list_del(&cclk->comp_clks[i]->link);
- kfree(cclk->comp_clks[i]->parent_names);
+ kfree(cclk->comp_clks[i]->parent_data);
kfree(cclk->comp_clks[i]);
}
@@ -237,8 +237,9 @@ int __init ti_clk_add_component(struct device_node *node, struct clk_hw *hw,
int type)
{
unsigned int num_parents;
- const char **parent_names;
+ struct clk_parent_data *parent_data;
struct component_clk *clk;
+ unsigned int i;
num_parents = of_clk_get_parent_count(node);
@@ -247,20 +248,21 @@ int __init ti_clk_add_component(struct device_node *node, struct clk_hw *hw,
return -EINVAL;
}
- parent_names = kcalloc(num_parents, sizeof(char *), GFP_KERNEL);
- if (!parent_names)
+ parent_data = kcalloc(num_parents, sizeof(*parent_data), GFP_KERNEL);
+ if (!parent_data)
return -ENOMEM;
- of_clk_parent_fill(node, parent_names, num_parents);
+ for (i = 0; i < num_parents; i++)
+ parent_data[i].index = i;
clk = kzalloc_obj(*clk);
if (!clk) {
- kfree(parent_names);
+ kfree(parent_data);
return -ENOMEM;
}
clk->num_parents = num_parents;
- clk->parent_names = parent_names;
+ clk->parent_data = parent_data;
clk->hw = hw;
clk->node = node;
clk->type = type;
--
2.47.3