提交 ed0bd721 编写于 作者: D Daniel Thompson 提交者: Herbert Xu

hwrng: core - Improve description of the ->read() interface

Currently, very few RNG drivers support single byte reads using the
->read() interface. Of the 14 drivers in drivers/char/hw_random that
support this interface only three of these actually support max == 1.
The other behaviours vary between return 0, return 2, return 4 and return
-EIO).

This is not a problem in practice because the core hw_random code never
performs a read shorter than 16 bytes. The documentation for this function
already contrains the alignment of the buffer pointer, so let's also
guarantee that the buffer is at least as large as its alignment.

This constraint is intended to be the weakest guarantee neccessary to
allow driver writers to safely simplify their code.
Signed-off-by: NDaniel Thompson <daniel.thompson@linaro.org>
Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
上级 f12e4ed8
...@@ -29,7 +29,9 @@ ...@@ -29,7 +29,9 @@
* Returns the number of lower random bytes in "data". * Returns the number of lower random bytes in "data".
* Must not be NULL. *OBSOLETE* * Must not be NULL. *OBSOLETE*
* @read: New API. drivers can fill up to max bytes of data * @read: New API. drivers can fill up to max bytes of data
* into the buffer. The buffer is aligned for any type. * into the buffer. The buffer is aligned for any type
* and max is guaranteed to be >= to that alignment
* (either 4 or 8 depending on architecture).
* @priv: Private data, for use by the RNG driver. * @priv: Private data, for use by the RNG driver.
* @quality: Estimation of true entropy in RNG's bitstream * @quality: Estimation of true entropy in RNG's bitstream
* (per mill). * (per mill).
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册