Skip to content

Commit

Permalink
hwrng: imx-rngc - use bitfield macros to read rng type
Browse files Browse the repository at this point in the history
Use the mechanism from bitfield.h to read the rng type field in the
version_id register. This makes the code a tiny bit simpler.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
  • Loading branch information
martin-kaiser authored and herbertx committed May 24, 2023
1 parent 97ecafc commit cbd0778
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/char/hw_random/imx-rngc.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#define RNGC_FIFO 0x0014

/* the fields in the ver id register */
#define RNGC_TYPE_SHIFT 28
#define RNG_TYPE GENMASK(31, 28)
#define RNGC_VER_MAJ_SHIFT 8

/* the rng_type field */
Expand Down Expand Up @@ -251,7 +251,7 @@ static int imx_rngc_probe(struct platform_device *pdev)
return irq;

ver_id = readl(rngc->base + RNGC_VER_ID);
rng_type = ver_id >> RNGC_TYPE_SHIFT;
rng_type = FIELD_GET(RNG_TYPE, ver_id);
/*
* This driver supports only RNGC and RNGB. (There's a different
* driver for RNGA.)
Expand Down

0 comments on commit cbd0778

Please sign in to comment.