.. | .. |
---|
22 | 22 | #include <linux/platform_device.h> |
---|
23 | 23 | #include <linux/hw_random.h> |
---|
24 | 24 | #include <linux/delay.h> |
---|
| 25 | +#include <linux/kernel.h> |
---|
25 | 26 | #include <linux/slab.h> |
---|
26 | 27 | #include <linux/pm_runtime.h> |
---|
27 | 28 | #include <linux/of.h> |
---|
.. | .. |
---|
243 | 244 | .cleanup = omap2_rng_cleanup, |
---|
244 | 245 | }; |
---|
245 | 246 | |
---|
246 | | -#if defined(CONFIG_OF) |
---|
247 | 247 | static inline u32 omap4_rng_data_present(struct omap_rng_dev *priv) |
---|
248 | 248 | { |
---|
249 | 249 | return omap_rng_read(priv, RNG_STATUS_REG) & RNG_REG_STATUS_RDY; |
---|
.. | .. |
---|
358 | 358 | .cleanup = omap4_rng_cleanup, |
---|
359 | 359 | }; |
---|
360 | 360 | |
---|
361 | | -static const struct of_device_id omap_rng_of_match[] = { |
---|
| 361 | +static const struct of_device_id omap_rng_of_match[] __maybe_unused = { |
---|
362 | 362 | { |
---|
363 | 363 | .compatible = "ti,omap2-rng", |
---|
364 | 364 | .data = &omap2_rng_pdata, |
---|
.. | .. |
---|
392 | 392 | if (of_device_is_compatible(dev->of_node, "ti,omap4-rng") || |
---|
393 | 393 | of_device_is_compatible(dev->of_node, "inside-secure,safexcel-eip76")) { |
---|
394 | 394 | irq = platform_get_irq(pdev, 0); |
---|
395 | | - if (irq < 0) { |
---|
396 | | - dev_err(dev, "%s: error getting IRQ resource - %d\n", |
---|
397 | | - __func__, irq); |
---|
| 395 | + if (irq < 0) |
---|
398 | 396 | return irq; |
---|
399 | | - } |
---|
400 | 397 | |
---|
401 | 398 | err = devm_request_irq(dev, irq, omap4_rng_irq, |
---|
402 | 399 | IRQF_TRIGGER_NONE, dev_name(dev), priv); |
---|
.. | .. |
---|
421 | 418 | } |
---|
422 | 419 | return 0; |
---|
423 | 420 | } |
---|
424 | | -#else |
---|
425 | | -static int of_get_omap_rng_device_details(struct omap_rng_dev *omap_rng, |
---|
426 | | - struct platform_device *pdev) |
---|
427 | | -{ |
---|
428 | | - return -EINVAL; |
---|
429 | | -} |
---|
430 | | -#endif |
---|
431 | 421 | |
---|
432 | 422 | static int get_omap_rng_device_details(struct omap_rng_dev *omap_rng) |
---|
433 | 423 | { |
---|
.. | .. |
---|
439 | 429 | static int omap_rng_probe(struct platform_device *pdev) |
---|
440 | 430 | { |
---|
441 | 431 | struct omap_rng_dev *priv; |
---|
442 | | - struct resource *res; |
---|
443 | 432 | struct device *dev = &pdev->dev; |
---|
444 | 433 | int ret; |
---|
445 | 434 | |
---|
.. | .. |
---|
456 | 445 | platform_set_drvdata(pdev, priv); |
---|
457 | 446 | priv->dev = dev; |
---|
458 | 447 | |
---|
459 | | - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
---|
460 | | - priv->base = devm_ioremap_resource(dev, res); |
---|
| 448 | + priv->base = devm_platform_ioremap_resource(pdev, 0); |
---|
461 | 449 | if (IS_ERR(priv->base)) { |
---|
462 | 450 | ret = PTR_ERR(priv->base); |
---|
463 | 451 | goto err_ioremap; |
---|
.. | .. |
---|
478 | 466 | } |
---|
479 | 467 | |
---|
480 | 468 | priv->clk = devm_clk_get(&pdev->dev, NULL); |
---|
481 | | - if (IS_ERR(priv->clk) && PTR_ERR(priv->clk) == -EPROBE_DEFER) |
---|
| 469 | + if (PTR_ERR(priv->clk) == -EPROBE_DEFER) |
---|
482 | 470 | return -EPROBE_DEFER; |
---|
483 | 471 | if (!IS_ERR(priv->clk)) { |
---|
484 | 472 | ret = clk_prepare_enable(priv->clk); |
---|
.. | .. |
---|
490 | 478 | } |
---|
491 | 479 | |
---|
492 | 480 | priv->clk_reg = devm_clk_get(&pdev->dev, "reg"); |
---|
493 | | - if (IS_ERR(priv->clk_reg) && PTR_ERR(priv->clk_reg) == -EPROBE_DEFER) |
---|
| 481 | + if (PTR_ERR(priv->clk_reg) == -EPROBE_DEFER) |
---|
494 | 482 | return -EPROBE_DEFER; |
---|
495 | 483 | if (!IS_ERR(priv->clk_reg)) { |
---|
496 | 484 | ret = clk_prepare_enable(priv->clk_reg); |
---|
.. | .. |
---|
507 | 495 | if (ret) |
---|
508 | 496 | goto err_register; |
---|
509 | 497 | |
---|
510 | | - ret = hwrng_register(&priv->rng); |
---|
| 498 | + ret = devm_hwrng_register(&pdev->dev, &priv->rng); |
---|
511 | 499 | if (ret) |
---|
512 | 500 | goto err_register; |
---|
513 | 501 | |
---|
.. | .. |
---|
532 | 520 | { |
---|
533 | 521 | struct omap_rng_dev *priv = platform_get_drvdata(pdev); |
---|
534 | 522 | |
---|
535 | | - hwrng_unregister(&priv->rng); |
---|
536 | 523 | |
---|
537 | 524 | priv->pdata->cleanup(priv); |
---|
538 | 525 | |
---|