mirror of
https://github.com/torvalds/linux.git
synced 2024-11-16 17:12:06 +00:00
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>
This commit is contained in:
parent
b14c534517
commit
284e76387c
@ -151,8 +151,15 @@ static int timeriomem_rng_probe(struct platform_device *pdev)
|
|||||||
dev_err(&pdev->dev, "missing period\n");
|
dev_err(&pdev->dev, "missing period\n");
|
||||||
return -EINVAL;
|
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 {
|
} else {
|
||||||
period = pdata->period;
|
period = pdata->period;
|
||||||
|
priv->rng_ops.quality = pdata->quality;
|
||||||
}
|
}
|
||||||
|
|
||||||
priv->period = ns_to_ktime(period * NSEC_PER_USEC);
|
priv->period = ns_to_ktime(period * NSEC_PER_USEC);
|
||||||
|
@ -13,4 +13,7 @@ struct timeriomem_rng_data {
|
|||||||
|
|
||||||
/* measures in usecs */
|
/* measures in usecs */
|
||||||
unsigned int period;
|
unsigned int period;
|
||||||
|
|
||||||
|
/* bits of entropy per 1024 bits read */
|
||||||
|
unsigned int quality;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user