From 1a537f625773fe3e5f124a933b2dffdfc947f9e0 Mon Sep 17 00:00:00 2001 From: Claudiu Beznea Date: Thu, 15 Jun 2023 12:32:22 +0300 Subject: clk: at91: clk-system: add support for parent_hw Add support for parent_hw in system clock drivers. With this parent-child relation is described with pointers rather than strings making registration a bit faster. All the SoC based drivers that rely on clk-system were adapted to the new API change. The switch itself for SoCs will be done in subsequent patches. Signed-off-by: Claudiu Beznea Reviewed-by: Maxime Ripard Link: https://lore.kernel.org/r/20230615093227.576102-7-claudiu.beznea@microchip.com --- drivers/clk/at91/clk-system.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'drivers/clk/at91/clk-system.c') diff --git a/drivers/clk/at91/clk-system.c b/drivers/clk/at91/clk-system.c index 10193650429e..90eed39d0785 100644 --- a/drivers/clk/at91/clk-system.c +++ b/drivers/clk/at91/clk-system.c @@ -105,14 +105,15 @@ static const struct clk_ops system_ops = { struct clk_hw * __init at91_clk_register_system(struct regmap *regmap, const char *name, - const char *parent_name, u8 id, unsigned long flags) + const char *parent_name, struct clk_hw *parent_hw, u8 id, + unsigned long flags) { struct clk_system *sys; struct clk_hw *hw; - struct clk_init_data init; + struct clk_init_data init = {}; int ret; - if (!parent_name || id > SYSTEM_MAX_ID) + if (!(parent_name || parent_hw) || id > SYSTEM_MAX_ID) return ERR_PTR(-EINVAL); sys = kzalloc(sizeof(*sys), GFP_KERNEL); @@ -121,7 +122,10 @@ at91_clk_register_system(struct regmap *regmap, const char *name, init.name = name; init.ops = &system_ops; - init.parent_names = &parent_name; + if (parent_hw) + init.parent_hws = (const struct clk_hw **)&parent_hw; + else + init.parent_names = &parent_name; init.num_parents = 1; init.flags = CLK_SET_RATE_PARENT | flags; -- cgit v1.2.3-59-g8ed1b