forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-11 04dd17822334871b23ea2862f7798fb0e0007777
kernel/drivers/clk/imx/clk-busy.c
....@@ -1,15 +1,10 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * Copyright 2012 Freescale Semiconductor, Inc.
34 * Copyright 2012 Linaro Ltd.
4
- *
5
- * The code contained herein is licensed under the GNU General Public
6
- * License. You may obtain a copy of the GNU General Public License
7
- * Version 2 or later at the following locations:
8
- *
9
- * http://www.opensource.org/licenses/gpl-license.html
10
- * http://www.gnu.org/copyleft/gpl.html
115 */
126
7
+#include <linux/bits.h>
138 #include <linux/clk.h>
149 #include <linux/clk-provider.h>
1510 #include <linux/io.h>
....@@ -78,13 +73,14 @@
7873 .set_rate = clk_busy_divider_set_rate,
7974 };
8075
81
-struct clk *imx_clk_busy_divider(const char *name, const char *parent_name,
76
+struct clk_hw *imx_clk_hw_busy_divider(const char *name, const char *parent_name,
8277 void __iomem *reg, u8 shift, u8 width,
8378 void __iomem *busy_reg, u8 busy_shift)
8479 {
8580 struct clk_busy_divider *busy;
86
- struct clk *clk;
87
- struct clk_init_data init = {};
81
+ struct clk_hw *hw;
82
+ struct clk_init_data init;
83
+ int ret;
8884
8985 busy = kzalloc(sizeof(*busy), GFP_KERNEL);
9086 if (!busy)
....@@ -107,11 +103,15 @@
107103
108104 busy->div.hw.init = &init;
109105
110
- clk = clk_register(NULL, &busy->div.hw);
111
- if (IS_ERR(clk))
112
- kfree(busy);
106
+ hw = &busy->div.hw;
113107
114
- return clk;
108
+ ret = clk_hw_register(NULL, hw);
109
+ if (ret) {
110
+ kfree(busy);
111
+ return ERR_PTR(ret);
112
+ }
113
+
114
+ return hw;
115115 }
116116
117117 struct clk_busy_mux {
....@@ -152,13 +152,14 @@
152152 .set_parent = clk_busy_mux_set_parent,
153153 };
154154
155
-struct clk *imx_clk_busy_mux(const char *name, void __iomem *reg, u8 shift,
155
+struct clk_hw *imx_clk_hw_busy_mux(const char *name, void __iomem *reg, u8 shift,
156156 u8 width, void __iomem *busy_reg, u8 busy_shift,
157157 const char * const *parent_names, int num_parents)
158158 {
159159 struct clk_busy_mux *busy;
160
- struct clk *clk;
161
- struct clk_init_data init = {};
160
+ struct clk_hw *hw;
161
+ struct clk_init_data init;
162
+ int ret;
162163
163164 busy = kzalloc(sizeof(*busy), GFP_KERNEL);
164165 if (!busy)
....@@ -181,9 +182,13 @@
181182
182183 busy->mux.hw.init = &init;
183184
184
- clk = clk_register(NULL, &busy->mux.hw);
185
- if (IS_ERR(clk))
186
- kfree(busy);
185
+ hw = &busy->mux.hw;
187186
188
- return clk;
187
+ ret = clk_hw_register(NULL, hw);
188
+ if (ret) {
189
+ kfree(busy);
190
+ return ERR_PTR(ret);
191
+ }
192
+
193
+ return hw;
189194 }