.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
---|
1 | 2 | /* |
---|
2 | 3 | * APM X-Gene SoC RNG Driver |
---|
3 | 4 | * |
---|
.. | .. |
---|
5 | 6 | * Author: Rameshwar Prasad Sahu <rsahu@apm.com> |
---|
6 | 7 | * Shamal Winchurkar <swinchurkar@apm.com> |
---|
7 | 8 | * 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 | | - * |
---|
22 | 9 | */ |
---|
23 | 10 | |
---|
24 | 11 | #include <linux/acpi.h> |
---|
.. | .. |
---|
326 | 313 | |
---|
327 | 314 | static int xgene_rng_probe(struct platform_device *pdev) |
---|
328 | 315 | { |
---|
329 | | - struct resource *res; |
---|
330 | 316 | struct xgene_rng_dev *ctx; |
---|
331 | 317 | int rc = 0; |
---|
332 | 318 | |
---|
.. | .. |
---|
337 | 323 | ctx->dev = &pdev->dev; |
---|
338 | 324 | platform_set_drvdata(pdev, ctx); |
---|
339 | 325 | |
---|
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); |
---|
342 | 327 | if (IS_ERR(ctx->csr_base)) |
---|
343 | 328 | return PTR_ERR(ctx->csr_base); |
---|
344 | 329 | |
---|
345 | 330 | rc = platform_get_irq(pdev, 0); |
---|
346 | | - if (rc < 0) { |
---|
347 | | - dev_err(&pdev->dev, "No IRQ resource\n"); |
---|
| 331 | + if (rc < 0) |
---|
348 | 332 | return rc; |
---|
349 | | - } |
---|
350 | 333 | ctx->irq = rc; |
---|
351 | 334 | |
---|
352 | 335 | dev_dbg(&pdev->dev, "APM X-Gene RNG BASE %p ALARM IRQ %d", |
---|
.. | .. |
---|
374 | 357 | |
---|
375 | 358 | xgene_rng_func.priv = (unsigned long) ctx; |
---|
376 | 359 | |
---|
377 | | - rc = hwrng_register(&xgene_rng_func); |
---|
| 360 | + rc = devm_hwrng_register(&pdev->dev, &xgene_rng_func); |
---|
378 | 361 | if (rc) { |
---|
379 | 362 | dev_err(&pdev->dev, "RNG registering failed error %d\n", rc); |
---|
380 | 363 | if (!IS_ERR(ctx->clk)) |
---|
.. | .. |
---|
388 | 371 | rc); |
---|
389 | 372 | if (!IS_ERR(ctx->clk)) |
---|
390 | 373 | clk_disable_unprepare(ctx->clk); |
---|
391 | | - hwrng_unregister(&xgene_rng_func); |
---|
392 | 374 | return rc; |
---|
393 | 375 | } |
---|
394 | 376 | |
---|
.. | .. |
---|
405 | 387 | dev_err(&pdev->dev, "RNG init wakeup failed error %d\n", rc); |
---|
406 | 388 | if (!IS_ERR(ctx->clk)) |
---|
407 | 389 | clk_disable_unprepare(ctx->clk); |
---|
408 | | - hwrng_unregister(&xgene_rng_func); |
---|
409 | 390 | |
---|
410 | 391 | return rc; |
---|
411 | 392 | } |
---|