"Das U-Boot" Source Tree

doc: random number generation

Add random number generation APIs to the HTML documentation.
Fix style issues.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

+40 -11
+1
MAINTAINERS
··· 877 877 R: Heinrich Schuchardt <xypron.glpk@gmx.de> 878 878 S: Maintained 879 879 F: cmd/rng.c 880 + F: doc/api/rng.rst 880 881 F: drivers/rng/ 881 882 F: drivers/virtio/virtio_rng.c 882 883 F: include/rng.h
+1
doc/api/index.rst
··· 9 9 dfu 10 10 efi 11 11 linker_lists 12 + rng 12 13 serial 13 14 unicode
+17
doc/api/rng.rst
··· 1 + .. SPDX-License-Identifier: GPL-2.0+ 2 + .. Copyright (c) 2018 Heinrich Schuchardt 3 + 4 + Random number generation 5 + ======================== 6 + 7 + Hardware random number generation 8 + --------------------------------- 9 + 10 + .. kernel-doc:: include/rng.h 11 + :internal: 12 + 13 + Pseudo random number generation 14 + ------------------------------- 15 + 16 + .. kernel-doc:: include/rand.h 17 + :internal:
+3 -3
include/rand.h
··· 22 22 /** 23 23 * rand() - Get a 32-bit pseudo-random number 24 24 * 25 - * @returns next random number in the sequence 25 + * Return: next random number in the sequence 26 26 */ 27 27 unsigned int rand(void); 28 28 ··· 32 32 * This version of the function allows multiple sequences to be used at the 33 33 * same time, since it requires the caller to store the seed value. 34 34 * 35 - * @seed value to use, updated on exit 36 - * @returns next random number in the sequence 35 + * @seedp: seed value to use, updated on exit 36 + * Return: next random number in the sequence 37 37 */ 38 38 unsigned int rand_r(unsigned int *seedp); 39 39
+18 -8
include/rng.h
··· 10 10 11 11 /** 12 12 * dm_rng_read() - read a random number seed from the rng device 13 + * 14 + * The function blocks until the requested number of bytes is read. 15 + * 16 + * @dev: random number generator device 13 17 * @buffer: input buffer to put the read random seed into 14 - * @size: number of bytes of random seed read 15 - * 16 - * Return: 0 if OK, -ve on error 18 + * @size: number of random bytes to read 19 + * Return: 0 if OK, -ve on error 17 20 */ 18 21 int dm_rng_read(struct udevice *dev, void *buffer, size_t size); 19 22 20 - /* struct dm_rng_ops - Operations for the hwrng uclass */ 23 + /** 24 + * struct dm_rng_ops - operations for the hwrng uclass 25 + * 26 + * This structures contains the function implemented by a hardware random 27 + * number generation device. 28 + */ 21 29 struct dm_rng_ops { 22 30 /** 23 - * @read() - read a random number seed 31 + * @read: read a random bytes 24 32 * 25 - * @data: input buffer to read the random seed 26 - * @max: total number of bytes to read 33 + * The function blocks until the requested number of bytes is read. 27 34 * 28 - * Return: 0 if OK, -ve on error 35 + * @read.dev: random number generator device 36 + * @read.data: input buffer to read the random seed into 37 + * @read.max: number of random bytes to read 38 + * @read.Return: 0 if OK, -ve on error 29 39 */ 30 40 int (*read)(struct udevice *dev, void *data, size_t max); 31 41 };