Lines Matching defs:rng
29 #define to_npcm_rng(p) container_of(p, struct npcm_rng, rng)
33 struct hwrng rng;
36 static int npcm_rng_init(struct hwrng *rng)
38 struct npcm_rng *priv = to_npcm_rng(rng);
46 static void npcm_rng_cleanup(struct hwrng *rng)
48 struct npcm_rng *priv = to_npcm_rng(rng);
53 static int npcm_rng_read(struct hwrng *rng, void *buf, size_t max, bool wait)
55 struct npcm_rng *priv = to_npcm_rng(rng);
59 pm_runtime_get_sync((struct device *)priv->rng.priv);
81 pm_runtime_mark_last_busy((struct device *)priv->rng.priv);
82 pm_runtime_put_sync_autosuspend((struct device *)priv->rng.priv);
106 priv->rng.init = npcm_rng_init;
107 priv->rng.cleanup = npcm_rng_cleanup;
109 priv->rng.name = pdev->name;
110 priv->rng.read = npcm_rng_read;
111 priv->rng.priv = (unsigned long)&pdev->dev;
112 priv->rng.quality = 1000;
116 ret = devm_hwrng_register(&pdev->dev, &priv->rng);
118 dev_err(&pdev->dev, "Failed to register rng device: %d\n",
132 devm_hwrng_unregister(&pdev->dev, &priv->rng);
144 npcm_rng_cleanup(&priv->rng);
153 return npcm_rng_init(&priv->rng);
165 { .compatible = "nuvoton,npcm750-rng", },
172 .name = "npcm-rng",