[PATCH v3 1/8] dm: rng: Add random number generator(rng) uclass

Sughosh Ganu
2019-12-16T18:55:14Z

hi Patrick,

On Mon, 16 Dec 2019 at 17:43, Patrick DELAUNAY <patrick.delaunay@st.com>
wrote:

> Hi,
>
> > From: U-Boot <u-boot-bounces@lists.denx.de> On Behalf Of Sughosh Ganu
> > Sent: vendredi 13 dÃ©cembre 2019 08:14
> >
> > Add a uclass for reading a random number seed from a random number
> generator
> > device.
> >
> > Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
> > Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
> > ---
> > drivers/Kconfig | 2 ++
> > drivers/Makefile | 1 +
> > drivers/rng/Kconfig | 7 +++++++
> > drivers/rng/Makefile | 6 ++++++
> > drivers/rng/rng-uclass.c | 23 +++++++++++++++++++++++
> > include/dm/uclass-id.h | 1 +
> > include/rng.h | 30 ++++++++++++++++++++++++++++++
> > 7 files changed, 70 insertions(+)
> > create mode 100644 drivers/rng/Kconfig
> > create mode 100644 drivers/rng/Makefile create mode 100644
> drivers/rng/rng-
> > uclass.c create mode 100644 include/rng.h
>

<snip>

> > diff --git a/include/rng.h b/include/rng.h new file mode 100644 index
> > 0000000..61d5da9
> > --- /dev/null
> > +++ b/include/rng.h
> > @@ -0,0 +1,30 @@
> > +// SPDX-License-Identifier: GPL-2.0+
> > +/*
> > + * Copyright (c) 2019, Linaro Limited
> > + */
> > +
> > +#if !defined _RNG_H_
> > +#define _RNG_H_
> > +
> > +#include <dm.h>
> > +
> > +/**
> > + * dm_rng_read() - read a random number seed from the rng device
> > + * @buffer: input buffer to put the read random seed into
> > + * @size: number of bytes of random seed read
>
> Missing return value here, I propose:
>
> @return zero on success, or -ve error code.
>

Ok. Will add.

>
> > + *
> > + */
> > +int dm_rng_read(struct udevice *dev, void *buffer, size_t size);
> > +
> > +/* struct dm_rng_ops - Operations for the hwrng uclass */ struct
> > +dm_rng_ops {
> > + /**
> > + * @read() - read a random number seed
> > + *
> > + * @data: input buffer to read the random seed
> > + * @max: total number of bytes to read
>
> Missing return value here, I propose:
>
> @return zero on success, or -ve error code.
>

Ok. Will add.

-sughosh