[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230511074300.ocfrmynne7e6wdkj@viti.kaiser.cx>
Date: Thu, 11 May 2023 09:43:00 +0200
From: Martin Kaiser <martin@...ser.cx>
To: Herbert Xu <herbert@...dor.apana.org.au>
Cc: linux-crypto@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/3] hwrng: imx-rngc - use bitfield macros to read fifo
level
Thus wrote Herbert Xu (herbert@...dor.apana.org.au):
> On Thu, Apr 27, 2023 at 08:53:55PM +0200, Martin Kaiser wrote:
> > @@ -133,9 +133,7 @@ static int imx_rngc_read(struct hwrng *rng, void *data, size_t max, bool wait)
> > break;
> > /* how many random numbers are in FIFO? [0-16] */
> > - level = (status & RNGC_STATUS_FIFO_LEVEL_MASK) >>
> > - RNGC_STATUS_FIFO_LEVEL_SHIFT;
> > -
> > + level = FIELD_GET(RNGC_STATUS_FIFO_LEVEL, status);
> Wouldn't it be simpler to just get rid of the shift?
Yes, we're only checking that level > 0, there's no need for the shift.
I'll submit a new version of the patch.
Thanks,
Martin
Powered by blists - more mailing lists