diff mbox series

clk: qcom: clk-spmi-pmic-div: convert to use parent_data

Message ID 20221208143945.50279-1-dmitry.baryshkov@linaro.org
State Superseded
Headers show
Series clk: qcom: clk-spmi-pmic-div: convert to use parent_data | expand

Commit Message

Dmitry Baryshkov Dec. 8, 2022, 2:39 p.m. UTC
The clk-spmi-pmic-div driver gets the parent name from the first (and
the only) clock parent. So, use parent data, index 0 to setup the clock.

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
 drivers/clk/qcom/clk-spmi-pmic-div.c | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

Comments

Stephen Boyd Dec. 9, 2022, 1:21 a.m. UTC | #1
Quoting Dmitry Baryshkov (2022-12-08 06:39:45)
> diff --git a/drivers/clk/qcom/clk-spmi-pmic-div.c b/drivers/clk/qcom/clk-spmi-pmic-div.c
> index f2cf55cee2fd..aa015c51ab4f 100644
> --- a/drivers/clk/qcom/clk-spmi-pmic-div.c
> +++ b/drivers/clk/qcom/clk-spmi-pmic-div.c
> @@ -175,6 +175,10 @@ static const struct clk_ops clk_spmi_pmic_div_ops = {
>         .round_rate = clk_spmi_pmic_div_round_rate,
>  };
>  
> +static const struct clk_parent_data clk_spmi_pmic_parent_data = {
> +       .index = 0,
> +};

Why not put this on the stack? clk core should be deep copying.
Dmitry Baryshkov Dec. 10, 2022, 7:10 p.m. UTC | #2
On Fri, 9 Dec 2022 at 04:21, Stephen Boyd <sboyd@kernel.org> wrote:
>
> Quoting Dmitry Baryshkov (2022-12-08 06:39:45)
> > diff --git a/drivers/clk/qcom/clk-spmi-pmic-div.c b/drivers/clk/qcom/clk-spmi-pmic-div.c
> > index f2cf55cee2fd..aa015c51ab4f 100644
> > --- a/drivers/clk/qcom/clk-spmi-pmic-div.c
> > +++ b/drivers/clk/qcom/clk-spmi-pmic-div.c
> > @@ -175,6 +175,10 @@ static const struct clk_ops clk_spmi_pmic_div_ops = {
> >         .round_rate = clk_spmi_pmic_div_round_rate,
> >  };
> >
> > +static const struct clk_parent_data clk_spmi_pmic_parent_data = {
> > +       .index = 0,
> > +};
>
> Why not put this on the stack? clk core should be deep copying.

Thanks, fixed in v2
diff mbox series

Patch

diff --git a/drivers/clk/qcom/clk-spmi-pmic-div.c b/drivers/clk/qcom/clk-spmi-pmic-div.c
index f2cf55cee2fd..aa015c51ab4f 100644
--- a/drivers/clk/qcom/clk-spmi-pmic-div.c
+++ b/drivers/clk/qcom/clk-spmi-pmic-div.c
@@ -175,6 +175,10 @@  static const struct clk_ops clk_spmi_pmic_div_ops = {
 	.round_rate = clk_spmi_pmic_div_round_rate,
 };
 
+static const struct clk_parent_data clk_spmi_pmic_parent_data = {
+	.index = 0,
+};
+
 struct spmi_pmic_div_clk_cc {
 	int		nclks;
 	struct clkdiv	clks[];
@@ -204,7 +208,6 @@  static int spmi_pmic_clkdiv_probe(struct platform_device *pdev)
 	struct regmap *regmap;
 	struct device *dev = &pdev->dev;
 	struct device_node *of_node = dev->of_node;
-	const char *parent_name;
 	int nclks, i, ret, cxo_hz;
 	char name[20];
 	u32 start;
@@ -246,14 +249,8 @@  static int spmi_pmic_clkdiv_probe(struct platform_device *pdev)
 	cxo_hz = clk_get_rate(cxo);
 	clk_put(cxo);
 
-	parent_name = of_clk_get_parent_name(of_node, 0);
-	if (!parent_name) {
-		dev_err(dev, "missing parent clock\n");
-		return -ENODEV;
-	}
-
 	init.name = name;
-	init.parent_names = &parent_name;
+	init.parent_data = &clk_spmi_pmic_parent_data;
 	init.num_parents = 1;
 	init.ops = &clk_spmi_pmic_div_ops;