summaryrefslogtreecommitdiff
path: root/drivers/char
diff options
context:
space:
mode:
authorMartin Kaiser <martin@kaiser.cx>2023-05-19 18:04:32 +0200
committerHerbert Xu <herbert@gondor.apana.org.au>2023-05-24 18:12:33 +0800
commitcbd077813505765273f639aef13a10d81107e1aa (patch)
tree8dafc3efdab976e8c45fd22c029e08827b073e3e /drivers/char
parent97ecafc4f6566f538bbde09d3a8baae4a3419eef (diff)
hwrng: imx-rngc - use bitfield macros to read rng type
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>
Diffstat (limited to 'drivers/char')
-rw-r--r--drivers/char/hw_random/imx-rngc.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/char/hw_random/imx-rngc.c b/drivers/char/hw_random/imx-rngc.c
index cf29c323453a..b5f7b91bd13e 100644
--- a/drivers/char/hw_random/imx-rngc.c
+++ b/drivers/char/hw_random/imx-rngc.c
@@ -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 */
@@ -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.)