[PATCH 1/3] hwrng: atmel - Add a local variable for struct device pointer

Sakari Ailus sakari.ailus at linux.intel.com
Thu Apr 10 08:15:12 PDT 2025


Hi Herbert,

On Thu, Apr 10, 2025 at 03:42:53PM +0800, Herbert Xu wrote:
> On Thu, Apr 10, 2025 at 10:06:21AM +0300, Sakari Ailus wrote:
> > Add a local variable for a struct device pointer instead of obtaining the
> > hwrng priv field and casting it as a struct device pointer whenever it's
> > needed.
> > 
> > Signed-off-by: Sakari Ailus <sakari.ailus at linux.intel.com>
> > ---
> >  drivers/char/hw_random/atmel-rng.c | 9 +++++----
> >  1 file changed, 5 insertions(+), 4 deletions(-)
> > 
> > diff --git a/drivers/char/hw_random/atmel-rng.c b/drivers/char/hw_random/atmel-rng.c
> > index 143406bc6939..5192c39ebaeb 100644
> > --- a/drivers/char/hw_random/atmel-rng.c
> > +++ b/drivers/char/hw_random/atmel-rng.c
> > @@ -56,12 +56,13 @@ static int atmel_trng_read(struct hwrng *rng, void *buf, size_t max,
> >  			   bool wait)
> >  {
> >  	struct atmel_trng *trng = container_of(rng, struct atmel_trng, rng);
> > +	struct device *dev = (struct device *)trng->rng.priv;
> 
> Please stop using the priv field and instead add a struct device
> pointer to struct atmel_trng.

Thanks for the review. I'll do that in v2.

-- 
Regards,

Sakari Ailus



More information about the Linux-mediatek mailing list