[PATCH 1/3] hwrng: imx-rngc - use bitfield macros to read fifo level
Herbert Xu
herbert at gondor.apana.org.au
Wed May 10 22:16:45 PDT 2023
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?
Thanks,
--
Email: Herbert Xu <herbert at gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
More information about the linux-arm-kernel
mailing list