mirror of
https://github.com/torvalds/linux.git
synced 2026-05-30 01:53:29 +02:00
hwrng: mtk - Add struct device pointer to device context struct
Add a struct device pointer field to the device's context struct. This makes using the unsigned long priv pointer in struct hwrng unnecessary, so remove that one as well. Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
parent
695912e619
commit
c2c460c30a
|
|
@ -36,6 +36,7 @@ struct mtk_rng {
|
|||
void __iomem *base;
|
||||
struct clk *clk;
|
||||
struct hwrng rng;
|
||||
struct device *dev;
|
||||
};
|
||||
|
||||
static int mtk_rng_init(struct hwrng *rng)
|
||||
|
|
@ -85,7 +86,7 @@ static int mtk_rng_read(struct hwrng *rng, void *buf, size_t max, bool wait)
|
|||
struct mtk_rng *priv = to_mtk_rng(rng);
|
||||
int retval = 0;
|
||||
|
||||
pm_runtime_get_sync((struct device *)priv->rng.priv);
|
||||
pm_runtime_get_sync(priv->dev);
|
||||
|
||||
while (max >= sizeof(u32)) {
|
||||
if (!mtk_rng_wait_ready(rng, wait))
|
||||
|
|
@ -97,8 +98,8 @@ static int mtk_rng_read(struct hwrng *rng, void *buf, size_t max, bool wait)
|
|||
max -= sizeof(u32);
|
||||
}
|
||||
|
||||
pm_runtime_mark_last_busy((struct device *)priv->rng.priv);
|
||||
pm_runtime_put_sync_autosuspend((struct device *)priv->rng.priv);
|
||||
pm_runtime_mark_last_busy(priv->dev);
|
||||
pm_runtime_put_sync_autosuspend(priv->dev);
|
||||
|
||||
return retval || !wait ? retval : -EIO;
|
||||
}
|
||||
|
|
@ -112,13 +113,13 @@ static int mtk_rng_probe(struct platform_device *pdev)
|
|||
if (!priv)
|
||||
return -ENOMEM;
|
||||
|
||||
priv->dev = &pdev->dev;
|
||||
priv->rng.name = pdev->name;
|
||||
#ifndef CONFIG_PM
|
||||
priv->rng.init = mtk_rng_init;
|
||||
priv->rng.cleanup = mtk_rng_cleanup;
|
||||
#endif
|
||||
priv->rng.read = mtk_rng_read;
|
||||
priv->rng.priv = (unsigned long)&pdev->dev;
|
||||
priv->rng.quality = 900;
|
||||
|
||||
priv->clk = devm_clk_get(&pdev->dev, "rng");
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user