forked from ~ljy/RK356X_SDK_RELEASE

hc
2023-12-09 95099d4622f8cb224d94e314c7a8e0df60b13f87
kernel/drivers/clk/imx/clk-fixup-div.c
....@@ -1,12 +1,6 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * Copyright (C) 2013 Freescale Semiconductor, Inc.
3
- *
4
- * The code contained herein is licensed under the GNU General Public
5
- * License. You may obtain a copy of the GNU General Public License
6
- * Version 2 or later at the following locations:
7
- *
8
- * http://www.opensource.org/licenses/gpl-license.html
9
- * http://www.gnu.org/copyleft/gpl.html
104 */
115
126 #include <linux/clk-provider.h>
....@@ -61,7 +55,7 @@
6155 struct clk_fixup_div *fixup_div = to_clk_fixup_div(hw);
6256 struct clk_divider *div = to_clk_divider(hw);
6357 unsigned int divider, value;
64
- unsigned long flags = 0;
58
+ unsigned long flags;
6559 u32 val;
6660
6761 divider = parent_rate / rate;
....@@ -91,13 +85,14 @@
9185 .set_rate = clk_fixup_div_set_rate,
9286 };
9387
94
-struct clk *imx_clk_fixup_divider(const char *name, const char *parent,
88
+struct clk_hw *imx_clk_hw_fixup_divider(const char *name, const char *parent,
9589 void __iomem *reg, u8 shift, u8 width,
9690 void (*fixup)(u32 *val))
9791 {
9892 struct clk_fixup_div *fixup_div;
99
- struct clk *clk;
100
- struct clk_init_data init = {};
93
+ struct clk_hw *hw;
94
+ struct clk_init_data init;
95
+ int ret;
10196
10297 if (!fixup)
10398 return ERR_PTR(-EINVAL);
....@@ -120,9 +115,13 @@
120115 fixup_div->ops = &clk_divider_ops;
121116 fixup_div->fixup = fixup;
122117
123
- clk = clk_register(NULL, &fixup_div->divider.hw);
124
- if (IS_ERR(clk))
125
- kfree(fixup_div);
118
+ hw = &fixup_div->divider.hw;
126119
127
- return clk;
120
+ ret = clk_hw_register(NULL, hw);
121
+ if (ret) {
122
+ kfree(fixup_div);
123
+ return ERR_PTR(ret);
124
+ }
125
+
126
+ return hw;
128127 }