@@ -259,7 +259,7 @@ static int check_get_random_support(struct mox_rwtm *rwtm)
static int mox_hwrng_read(struct hwrng *rng, void *data, size_t max, bool wait)
{
- struct mox_rwtm *rwtm = (struct mox_rwtm *) rng->priv;
+ struct mox_rwtm *rwtm = container_of(rng, struct mox_rwtm, hwrng);
struct armada_37xx_rwtm_tx_msg msg;
int ret;
@@ -487,7 +487,6 @@ static int turris_mox_rwtm_probe(struct platform_device *pdev)
rwtm->hwrng.name = DRIVER_NAME "_hwrng";
rwtm->hwrng.read = mox_hwrng_read;
- rwtm->hwrng.priv = (unsigned long) rwtm;
ret = devm_hwrng_register(dev, &rwtm->hwrng);
if (ret)