forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-11 04dd17822334871b23ea2862f7798fb0e0007777
kernel/drivers/clk/versatile/clk-vexpress-osc.c
....@@ -1,12 +1,5 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
2
- * This program is free software; you can redistribute it and/or modify
3
- * it under the terms of the GNU General Public License version 2 as
4
- * published by the Free Software Foundation.
5
- *
6
- * This program is distributed in the hope that it will be useful,
7
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
8
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9
- * GNU General Public License for more details.
103 *
114 * Copyright (C) 2012 ARM Limited
125 */
....@@ -14,6 +7,7 @@
147 #include <linux/clkdev.h>
158 #include <linux/clk-provider.h>
169 #include <linux/err.h>
10
+#include <linux/module.h>
1711 #include <linux/of.h>
1812 #include <linux/platform_device.h>
1913 #include <linux/slab.h>
....@@ -70,10 +64,10 @@
7064
7165 static int vexpress_osc_probe(struct platform_device *pdev)
7266 {
73
- struct clk_init_data init = {};
67
+ struct clk_init_data init;
7468 struct vexpress_osc *osc;
75
- struct clk *clk;
7669 u32 range[2];
70
+ int ret;
7771
7872 osc = devm_kzalloc(&pdev->dev, sizeof(*osc), GFP_KERNEL);
7973 if (!osc)
....@@ -99,11 +93,11 @@
9993
10094 osc->hw.init = &init;
10195
102
- clk = clk_register(NULL, &osc->hw);
103
- if (IS_ERR(clk))
104
- return PTR_ERR(clk);
96
+ ret = devm_clk_hw_register(&pdev->dev, &osc->hw);
97
+ if (ret < 0)
98
+ return ret;
10599
106
- of_clk_add_provider(pdev->dev.of_node, of_clk_src_simple_get, clk);
100
+ devm_of_clk_add_hw_provider(&pdev->dev, of_clk_hw_simple_get, &osc->hw);
107101 clk_hw_set_rate_range(&osc->hw, osc->rate_min, osc->rate_max);
108102
109103 dev_dbg(&pdev->dev, "Registered clock '%s'\n", init.name);
....@@ -115,6 +109,7 @@
115109 { .compatible = "arm,vexpress-osc", },
116110 {}
117111 };
112
+MODULE_DEVICE_TABLE(of, vexpress_osc_of_match);
118113
119114 static struct platform_driver vexpress_osc_driver = {
120115 .driver = {
....@@ -123,9 +118,5 @@
123118 },
124119 .probe = vexpress_osc_probe,
125120 };
126
-
127
-static int __init vexpress_osc_init(void)
128
-{
129
- return platform_driver_register(&vexpress_osc_driver);
130
-}
131
-core_initcall(vexpress_osc_init);
121
+module_platform_driver(vexpress_osc_driver);
122
+MODULE_LICENSE("GPL v2");