Skip to content

Commit 5319aaa

Browse files
geertubroonie
authored andcommitted
regulator: lp87565: 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/5e8781d31c983caf6bdabe36c5552077422cb8da.1708002575.git.geert+renesas@glider.be Signed-off-by: Mark Brown <[email protected]>
1 parent 64db3e8 commit 5319aaa

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/regulator/lp87565-regulator.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
* Copyright (C) 2017 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>
@@ -99,7 +100,7 @@ static int lp87565_buck_set_ramp_delay(struct regulator_dev *rdev,
99100

100101
ret = regmap_update_bits(rdev->regmap, regulators[id].ctrl2_reg,
101102
LP87565_BUCK_CTRL_2_SLEW_RATE,
102-
reg << __ffs(LP87565_BUCK_CTRL_2_SLEW_RATE));
103+
FIELD_PREP(LP87565_BUCK_CTRL_2_SLEW_RATE, reg));
103104
if (ret) {
104105
dev_err(&rdev->dev, "SLEW RATE write failed: %d\n", ret);
105106
return ret;

0 commit comments

Comments
 (0)