From f885c8ada30fb481f0d8298001bf053d7cbb443e Mon Sep 17 00:00:00 2001 From: Ricardo Rivera-Matos Date: Fri, 10 May 2024 15:04:21 +0000 Subject: [PATCH] regulator: cp9314: Uses FIELD_GET to read CHIP_REV Use FIELD_GET macro to grab CHIP_REV bitfield. This change improves the readability of the source code and does not change functionality. Signed-off-by: Ricardo Rivera-Matos --- drivers/regulator/regulator_cp9314.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/regulator/regulator_cp9314.c b/drivers/regulator/regulator_cp9314.c index 0e155b17247..8944dcfb6d5 100644 --- a/drivers/regulator/regulator_cp9314.c +++ b/drivers/regulator/regulator_cp9314.c @@ -118,7 +118,7 @@ LOG_MODULE_REGISTER(CP9314, CONFIG_REGULATOR_LOG_LEVEL); #define CP9314_REG_BC_STS_C 0x62 #define CP9314_CHIP_REV_MASK GENMASK(7, 4) -#define CP9314_CHIP_REV_B0 0x10 +#define CP9314_CHIP_REV_B0 0x1 #define CP9314_REG_FORCE_SC_MISC 0x69 #define CP9314_FORCE_CSI_EN BIT(0) @@ -516,7 +516,7 @@ static int regulator_cp9314_init(const struct device *dev) return ret; } - value &= CP9314_CHIP_REV_MASK; + value = FIELD_GET(CP9314_CHIP_REV_MASK, value); switch (value) { case CP9314_CHIP_REV_B0: