Skip to content

Commit f885c8a

Browse files
rriveramcruscarlescufi
authored andcommitted
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 <[email protected]>
1 parent 0f6d6b2 commit f885c8a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/regulator/regulator_cp9314.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ LOG_MODULE_REGISTER(CP9314, CONFIG_REGULATOR_LOG_LEVEL);
118118

119119
#define CP9314_REG_BC_STS_C 0x62
120120
#define CP9314_CHIP_REV_MASK GENMASK(7, 4)
121-
#define CP9314_CHIP_REV_B0 0x10
121+
#define CP9314_CHIP_REV_B0 0x1
122122

123123
#define CP9314_REG_FORCE_SC_MISC 0x69
124124
#define CP9314_FORCE_CSI_EN BIT(0)
@@ -516,7 +516,7 @@ static int regulator_cp9314_init(const struct device *dev)
516516
return ret;
517517
}
518518

519-
value &= CP9314_CHIP_REV_MASK;
519+
value = FIELD_GET(CP9314_CHIP_REV_MASK, value);
520520

521521
switch (value) {
522522
case CP9314_CHIP_REV_B0:

0 commit comments

Comments
 (0)