Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

regulator: lp87565: Use bitfield helpers

Use the FIELD_PREP() helper, instead open-coding the same operation.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://msgid.link/r/5e8781d31c983caf6bdabe36c5552077422cb8da.1708002575.git.geert+renesas@glider.be
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Geert Uytterhoeven and committed by
Mark Brown
5319aaa9 64db3e8d

+2 -1
+2 -1
drivers/regulator/lp87565-regulator.c
··· 5 5 * Copyright (C) 2017 Texas Instruments Incorporated - https://www.ti.com/ 6 6 */ 7 7 8 + #include <linux/bitfield.h> 8 9 #include <linux/module.h> 9 10 #include <linux/platform_device.h> 10 11 #include <linux/regmap.h> ··· 100 99 101 100 ret = regmap_update_bits(rdev->regmap, regulators[id].ctrl2_reg, 102 101 LP87565_BUCK_CTRL_2_SLEW_RATE, 103 - reg << __ffs(LP87565_BUCK_CTRL_2_SLEW_RATE)); 102 + FIELD_PREP(LP87565_BUCK_CTRL_2_SLEW_RATE, reg)); 104 103 if (ret) { 105 104 dev_err(&rdev->dev, "SLEW RATE write failed: %d\n", ret); 106 105 return ret;