forked from ~ljy/RK356X_SDK_RELEASE

hc
2023-12-09 b22da3d8526a935aa31e086e63f60ff3246cb61c
kernel/drivers/char/hw_random/st-rng.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * ST Random Number Generator Driver ST's Platforms
34 *
....@@ -5,16 +6,13 @@
56 * Lee Jones <lee.jones@linaro.org>
67 *
78 * Copyright (C) 2015 STMicroelectronics (R&D) Limited
8
- *
9
- * This program is free software; you can redistribute it and/or modify
10
- * it under the terms of the GNU General Public License version 2 as
11
- * published by the Free Software Foundation.
129 */
1310
1411 #include <linux/clk.h>
1512 #include <linux/delay.h>
1613 #include <linux/hw_random.h>
1714 #include <linux/io.h>
15
+#include <linux/kernel.h>
1816 #include <linux/module.h>
1917 #include <linux/of.h>
2018 #include <linux/platform_device.h>
....@@ -75,7 +73,6 @@
7573 static int st_rng_probe(struct platform_device *pdev)
7674 {
7775 struct st_rng_data *ddata;
78
- struct resource *res;
7976 struct clk *clk;
8077 void __iomem *base;
8178 int ret;
....@@ -84,8 +81,7 @@
8481 if (!ddata)
8582 return -ENOMEM;
8683
87
- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
88
- base = devm_ioremap_resource(&pdev->dev, res);
84
+ base = devm_platform_ioremap_resource(pdev, 0);
8985 if (IS_ERR(base))
9086 return PTR_ERR(base);
9187
....@@ -105,7 +101,7 @@
105101
106102 dev_set_drvdata(&pdev->dev, ddata);
107103
108
- ret = hwrng_register(&ddata->ops);
104
+ ret = devm_hwrng_register(&pdev->dev, &ddata->ops);
109105 if (ret) {
110106 dev_err(&pdev->dev, "Failed to register HW RNG\n");
111107 clk_disable_unprepare(clk);
....@@ -121,14 +117,12 @@
121117 {
122118 struct st_rng_data *ddata = dev_get_drvdata(&pdev->dev);
123119
124
- hwrng_unregister(&ddata->ops);
125
-
126120 clk_disable_unprepare(ddata->clk);
127121
128122 return 0;
129123 }
130124
131
-static const struct of_device_id st_rng_match[] = {
125
+static const struct of_device_id st_rng_match[] __maybe_unused = {
132126 { .compatible = "st,rng" },
133127 {},
134128 };