Lines Matching refs:rng
30 #define to_npcm_rng(p) container_of(p, struct npcm_rng, rng)
34 struct hwrng rng;
38 static int npcm_rng_init(struct hwrng *rng)
40 struct npcm_rng *priv = to_npcm_rng(rng);
47 static void npcm_rng_cleanup(struct hwrng *rng)
49 struct npcm_rng *priv = to_npcm_rng(rng);
54 static int npcm_rng_read(struct hwrng *rng, void *buf, size_t max, bool wait)
56 struct npcm_rng *priv = to_npcm_rng(rng);
60 pm_runtime_get_sync((struct device *)priv->rng.priv);
82 pm_runtime_mark_last_busy((struct device *)priv->rng.priv);
83 pm_runtime_put_sync_autosuspend((struct device *)priv->rng.priv);
107 priv->rng.init = npcm_rng_init;
108 priv->rng.cleanup = npcm_rng_cleanup;
110 priv->rng.name = pdev->name;
111 priv->rng.read = npcm_rng_read;
112 priv->rng.priv = (unsigned long)&pdev->dev;
117 ret = devm_hwrng_register(&pdev->dev, &priv->rng);
119 dev_err(&pdev->dev, "Failed to register rng device: %d\n",
133 devm_hwrng_unregister(&pdev->dev, &priv->rng);
145 npcm_rng_cleanup(&priv->rng);
154 return npcm_rng_init(&priv->rng);
166 { .compatible = "nuvoton,npcm750-rng",
168 { .compatible = "nuvoton,npcm845-rng",
176 .name = "npcm-rng",