Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Sakari Ailus and committed by
Herbert Xu
c2c460c3 695912e6

+5 -4
+5 -4
drivers/char/hw_random/mtk-rng.c
··· 36 36 void __iomem *base; 37 37 struct clk *clk; 38 38 struct hwrng rng; 39 + struct device *dev; 39 40 }; 40 41 41 42 static int mtk_rng_init(struct hwrng *rng) ··· 86 85 struct mtk_rng *priv = to_mtk_rng(rng); 87 86 int retval = 0; 88 87 89 - pm_runtime_get_sync((struct device *)priv->rng.priv); 88 + pm_runtime_get_sync(priv->dev); 90 89 91 90 while (max >= sizeof(u32)) { 92 91 if (!mtk_rng_wait_ready(rng, wait)) ··· 98 97 max -= sizeof(u32); 99 98 } 100 99 101 - pm_runtime_mark_last_busy((struct device *)priv->rng.priv); 102 - pm_runtime_put_sync_autosuspend((struct device *)priv->rng.priv); 100 + pm_runtime_mark_last_busy(priv->dev); 101 + pm_runtime_put_sync_autosuspend(priv->dev); 103 102 104 103 return retval || !wait ? retval : -EIO; 105 104 } ··· 113 112 if (!priv) 114 113 return -ENOMEM; 115 114 115 + priv->dev = &pdev->dev; 116 116 priv->rng.name = pdev->name; 117 117 #ifndef CONFIG_PM 118 118 priv->rng.init = mtk_rng_init; 119 119 priv->rng.cleanup = mtk_rng_cleanup; 120 120 #endif 121 121 priv->rng.read = mtk_rng_read; 122 - priv->rng.priv = (unsigned long)&pdev->dev; 123 122 priv->rng.quality = 900; 124 123 125 124 priv->clk = devm_clk_get(&pdev->dev, "rng");