Skip to content

Commit 2601b6f

Browse files
geertubroonie
authored andcommitted
regulator: lp873x: Use bitfield helpers
Use the FIELD_PREP() helper, instead open-coding the same operation. Signed-off-by: Geert Uytterhoeven <[email protected]> Link: https://msgid.link/r/15edeaa9a644c4025234088da3dabb023fce04ac.1708002503.git.geert+renesas@glider.be Signed-off-by: Mark Brown <[email protected]>
1 parent 5319aaa commit 2601b6f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/regulator/lp873x-regulator.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
* Copyright (C) 2016 Texas Instruments Incorporated - https://www.ti.com/
66
*/
77

8+
#include <linux/bitfield.h>
89
#include <linux/module.h>
910
#include <linux/platform_device.h>
1011
#include <linux/regmap.h>
@@ -93,7 +94,7 @@ static int lp873x_buck_set_ramp_delay(struct regulator_dev *rdev,
9394

9495
ret = regmap_update_bits(lp873->regmap, regulators[id].ctrl2_reg,
9596
LP873X_BUCK0_CTRL_2_BUCK0_SLEW_RATE,
96-
reg << __ffs(LP873X_BUCK0_CTRL_2_BUCK0_SLEW_RATE));
97+
FIELD_PREP(LP873X_BUCK0_CTRL_2_BUCK0_SLEW_RATE, reg));
9798
if (ret) {
9899
dev_err(lp873->dev, "SLEW RATE write failed: %d\n", ret);
99100
return ret;

0 commit comments

Comments
 (0)