[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <412f9209637e6eb861cd07e1d6dbc346.sboyd@kernel.org>
Date: Fri, 28 Jul 2023 20:28:38 -0700
From: Stephen Boyd <sboyd@...nel.org>
To: Claudiu Beznea <claudiu.beznea@...on.dev>,
alexandre.belloni@...tlin.com, mripard@...nel.org,
mturquette@...libre.com, nicolas.ferre@...rochip.com
Cc: linux-clk@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
linux-kernel@...r.kernel.org, varshini.rajendran@...rochip.com,
Claudiu Beznea <claudiu.beznea@...on.dev>
Subject: Re: [PATCH 03/42] clk: at91: sam9x60: switch to parent_hw and parent_data
Quoting Claudiu Beznea (2023-07-26 22:31:17)
> @@ -177,31 +178,34 @@ static const struct {
>
> static void __init sam9x60_pmc_setup(struct device_node *np)
> {
> + struct clk_hw *td_slck_hw, *md_slck_hw, *main_xtal_hw, *main_rc_hw, *main_osc_hw;
> + struct clk_hw *parent_hws[6], *hw, *usbck_hw;
> + static struct clk_parent_data parent_data;
> struct clk_range range = CLK_RANGE(0, 0);
> - const char *td_slck_name, *md_slck_name, *mainxtal_name;
> + const char *main_xtal_name = "main_xtal";
> struct pmc_data *sam9x60_pmc;
> - const char *parent_names[6];
> - struct clk_hw *main_osc_hw;
> struct regmap *regmap;
> - struct clk_hw *hw;
> + struct clk *clk;
> int i;
>
> - i = of_property_match_string(np, "clock-names", "td_slck");
> - if (i < 0)
> + clk = of_clk_get_by_name(np, "td_slck");
> + if (IS_ERR(clk))
> return;
> -
> - td_slck_name = of_clk_get_parent_name(np, i);
> -
> - i = of_property_match_string(np, "clock-names", "md_slck");
> - if (i < 0)
> + td_slck_hw = __clk_get_hw(clk);
Don't introduce more usage of __clk_get_hw(). The index for "td_slck"
should be known, and it can be used as the index member in struct
clk_parent_data. This allows the clk framework to lazily find the
parent, instead of requiring the parent to be registered before this
code runs. It also reduces the usage of __clk_get_hw().
Powered by blists - more mailing lists