049b1fa49f12007ee8e18467b33ef2190fbe5f7b
[openwrt/staging/svanheule.git] /
1 From 8ea9fb841a7e528bc8ae79d726ce951dcf7b46e2 Mon Sep 17 00:00:00 2001
2 From: Christian Marangi <ansuelsmth@gmail.com>
3 Date: Wed, 9 Nov 2022 01:56:30 +0100
4 Subject: [PATCH 5/6] clk: qcom: krait-cc: convert to devm_clk_hw_register
5
6 clk_register is now deprecated. Convert the driver to devm_clk_hw_register.
7
8 Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
9 Signed-off-by: Bjorn Andersson <andersson@kernel.org>
10 Link: https://lore.kernel.org/r/20221109005631.3189-4-ansuelsmth@gmail.com
11 ---
12 drivers/clk/qcom/krait-cc.c | 31 +++++++++++++++++++------------
13 1 file changed, 19 insertions(+), 12 deletions(-)
14
15 --- a/drivers/clk/qcom/krait-cc.c
16 +++ b/drivers/clk/qcom/krait-cc.c
17 @@ -79,8 +79,7 @@ krait_add_div(struct device *dev, int id
18 .flags = CLK_SET_RATE_PARENT,
19 };
20 const char *p_names[1];
21 - struct clk *clk;
22 - int cpu;
23 + int cpu, ret;
24
25 div = devm_kzalloc(dev, sizeof(*div), GFP_KERNEL);
26 if (!div)
27 @@ -103,8 +102,8 @@ krait_add_div(struct device *dev, int id
28 return -ENOMEM;
29 }
30
31 - clk = devm_clk_register(dev, &div->hw);
32 - if (IS_ERR(clk))
33 + ret = devm_clk_hw_register(dev, &div->hw);
34 + if (ret)
35 goto err;
36
37 /* clk-krait ignore any rate change if mux is not flagged as enabled */
38 @@ -118,7 +117,7 @@ err:
39 kfree(p_names[0]);
40 kfree(init.name);
41
42 - return PTR_ERR_OR_ZERO(clk);
43 + return ret;
44 }
45
46 static int
47 @@ -137,7 +136,6 @@ krait_add_sec_mux(struct device *dev, in
48 .ops = &krait_mux_clk_ops,
49 .flags = CLK_SET_RATE_PARENT,
50 };
51 - struct clk *clk;
52
53 mux = devm_kzalloc(dev, sizeof(*mux), GFP_KERNEL);
54 if (!mux)
55 @@ -166,14 +164,16 @@ krait_add_sec_mux(struct device *dev, in
56 if (unique_aux) {
57 sec_mux_list[0] = kasprintf(GFP_KERNEL, "acpu%s_aux", s);
58 if (!sec_mux_list[0]) {
59 - clk = ERR_PTR(-ENOMEM);
60 + ret = -ENOMEM;
61 goto err_aux;
62 }
63 }
64
65 - clk = devm_clk_register(dev, &mux->hw);
66 + ret = devm_clk_hw_register(dev, &mux->hw);
67 + if (ret)
68 + goto unique_aux;
69
70 - ret = krait_notifier_register(dev, clk, mux);
71 + ret = krait_notifier_register(dev, mux->hw.clk, mux);
72 if (ret)
73 goto unique_aux;
74
75 @@ -189,7 +189,7 @@ unique_aux:
76 kfree(sec_mux_list[0]);
77 err_aux:
78 kfree(init.name);
79 - return PTR_ERR_OR_ZERO(clk);
80 + return ret;
81 }
82
83 static struct clk *
84 @@ -241,11 +241,18 @@ krait_add_pri_mux(struct device *dev, in
85 goto err_p2;
86 }
87
88 - clk = devm_clk_register(dev, &mux->hw);
89 + ret = devm_clk_hw_register(dev, &mux->hw);
90 + if (ret) {
91 + clk = ERR_PTR(ret);
92 + goto err_p3;
93 + }
94 +
95 + clk = mux->hw.clk;
96
97 ret = krait_notifier_register(dev, clk, mux);
98 if (ret)
99 - goto err_p3;
100 + clk = ERR_PTR(ret);
101 +
102 err_p3:
103 kfree(p_names[2]);
104 err_p2: