hc
2023-12-09 b22da3d8526a935aa31e086e63f60ff3246cb61c
kernel/drivers/char/hw_random/xgene-rng.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * APM X-Gene SoC RNG Driver
34 *
....@@ -5,20 +6,6 @@
56 * Author: Rameshwar Prasad Sahu <rsahu@apm.com>
67 * Shamal Winchurkar <swinchurkar@apm.com>
78 * Feng Kan <fkan@apm.com>
8
- *
9
- * This program is free software; you can redistribute it and/or modify it
10
- * under the terms of the GNU General Public License as published by the
11
- * Free Software Foundation; either version 2 of the License, or (at your
12
- * option) any later version.
13
- *
14
- * This program is distributed in the hope that it will be useful,
15
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
- * GNU General Public License for more details.
18
- *
19
- * You should have received a copy of the GNU General Public License
20
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
21
- *
229 */
2310
2411 #include <linux/acpi.h>
....@@ -326,7 +313,6 @@
326313
327314 static int xgene_rng_probe(struct platform_device *pdev)
328315 {
329
- struct resource *res;
330316 struct xgene_rng_dev *ctx;
331317 int rc = 0;
332318
....@@ -337,16 +323,13 @@
337323 ctx->dev = &pdev->dev;
338324 platform_set_drvdata(pdev, ctx);
339325
340
- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
341
- ctx->csr_base = devm_ioremap_resource(&pdev->dev, res);
326
+ ctx->csr_base = devm_platform_ioremap_resource(pdev, 0);
342327 if (IS_ERR(ctx->csr_base))
343328 return PTR_ERR(ctx->csr_base);
344329
345330 rc = platform_get_irq(pdev, 0);
346
- if (rc < 0) {
347
- dev_err(&pdev->dev, "No IRQ resource\n");
331
+ if (rc < 0)
348332 return rc;
349
- }
350333 ctx->irq = rc;
351334
352335 dev_dbg(&pdev->dev, "APM X-Gene RNG BASE %p ALARM IRQ %d",
....@@ -374,7 +357,7 @@
374357
375358 xgene_rng_func.priv = (unsigned long) ctx;
376359
377
- rc = hwrng_register(&xgene_rng_func);
360
+ rc = devm_hwrng_register(&pdev->dev, &xgene_rng_func);
378361 if (rc) {
379362 dev_err(&pdev->dev, "RNG registering failed error %d\n", rc);
380363 if (!IS_ERR(ctx->clk))
....@@ -388,7 +371,6 @@
388371 rc);
389372 if (!IS_ERR(ctx->clk))
390373 clk_disable_unprepare(ctx->clk);
391
- hwrng_unregister(&xgene_rng_func);
392374 return rc;
393375 }
394376
....@@ -405,7 +387,6 @@
405387 dev_err(&pdev->dev, "RNG init wakeup failed error %d\n", rc);
406388 if (!IS_ERR(ctx->clk))
407389 clk_disable_unprepare(ctx->clk);
408
- hwrng_unregister(&xgene_rng_func);
409390
410391 return rc;
411392 }