hc
2023-12-11 d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d
kernel/drivers/clk/at91/clk-h32mx.c
....@@ -1,15 +1,10 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * clk-h32mx.c
34 *
45 * Copyright (C) 2014 Atmel
56 *
67 * Alexandre Belloni <alexandre.belloni@free-electrons.com>
7
- *
8
- * This program is free software; you can redistribute it and/or modify
9
- * it under the terms of the GNU General Public License as published by
10
- * the Free Software Foundation; either version 2 of the License, or
11
- * (at your option) any later version.
12
- *
138 */
149
1510 #include <linux/clk-provider.h>
....@@ -86,25 +81,19 @@
8681 .set_rate = clk_sama5d4_h32mx_set_rate,
8782 };
8883
89
-static void __init of_sama5d4_clk_h32mx_setup(struct device_node *np)
84
+struct clk_hw * __init
85
+at91_clk_register_h32mx(struct regmap *regmap, const char *name,
86
+ const char *parent_name)
9087 {
9188 struct clk_sama5d4_h32mx *h32mxclk;
92
- struct clk_init_data init = {};
93
- const char *parent_name;
94
- struct regmap *regmap;
89
+ struct clk_init_data init;
9590 int ret;
96
-
97
- regmap = syscon_node_to_regmap(of_get_parent(np));
98
- if (IS_ERR(regmap))
99
- return;
10091
10192 h32mxclk = kzalloc(sizeof(*h32mxclk), GFP_KERNEL);
10293 if (!h32mxclk)
103
- return;
94
+ return ERR_PTR(-ENOMEM);
10495
105
- parent_name = of_clk_get_parent_name(np, 0);
106
-
107
- init.name = np->name;
96
+ init.name = name;
10897 init.ops = &h32mx_ops;
10998 init.parent_names = parent_name ? &parent_name : NULL;
11099 init.num_parents = parent_name ? 1 : 0;
....@@ -116,10 +105,8 @@
116105 ret = clk_hw_register(NULL, &h32mxclk->hw);
117106 if (ret) {
118107 kfree(h32mxclk);
119
- return;
108
+ return ERR_PTR(ret);
120109 }
121110
122
- of_clk_add_hw_provider(np, of_clk_hw_simple_get, &h32mxclk->hw);
111
+ return &h32mxclk->hw;
123112 }
124
-CLK_OF_DECLARE(of_sama5d4_clk_h32mx_setup, "atmel,sama5d4-clk-h32mx",
125
- of_sama5d4_clk_h32mx_setup);