summaryrefslogtreecommitdiff
path: root/drivers/char/hw_random/timeriomem-rng.c
diff options
context:
space:
mode:
authorRick Altherr <raltherr@google.com>2017-05-23 00:12:24 +0300
committerHerbert Xu <herbert@gondor.apana.org.au>2017-06-01 07:55:58 +0300
commit284e76387c38260e834c99b010a68d75fc46b394 (patch)
treed2558a6b59909e0ee71a276d09101a33cb124e9f /drivers/char/hw_random/timeriomem-rng.c
parentb14c53451719dc6ec8e6387e5be3be23294a6f1d (diff)
downloadlinux-284e76387c38260e834c99b010a68d75fc46b394.tar.xz
hw_random: timeriomem_rng: Allow setting RNG quality from platform data
When a hw_random device's quality is non-zero, it will automatically be used to fill the kernel's entropy pool. Since timeriomem_rng is used by many different devices, the quality needs to be provided by platform data or device tree. Signed-off-by: Rick Altherr <raltherr@google.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers/char/hw_random/timeriomem-rng.c')
-rw-r--r--drivers/char/hw_random/timeriomem-rng.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/char/hw_random/timeriomem-rng.c b/drivers/char/hw_random/timeriomem-rng.c
index a0faa5f05deb..03ff5483d865 100644
--- a/drivers/char/hw_random/timeriomem-rng.c
+++ b/drivers/char/hw_random/timeriomem-rng.c
@@ -151,8 +151,15 @@ static int timeriomem_rng_probe(struct platform_device *pdev)
dev_err(&pdev->dev, "missing period\n");
return -EINVAL;
}
+
+ if (!of_property_read_u32(pdev->dev.of_node,
+ "quality", &i))
+ priv->rng_ops.quality = i;
+ else
+ priv->rng_ops.quality = 0;
} else {
period = pdata->period;
+ priv->rng_ops.quality = pdata->quality;
}
priv->period = ns_to_ktime(period * NSEC_PER_USEC);