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

regulator: anatop: Remove checking control_reg in [set|get]_voltage_sel

Remove checking control_reg in [set|get]_voltage_sel and then convert to use
regulator_[set|get]_voltage_sel_regmap for [set|get]_voltage_sel callbacks.

The anatop-reg-offset property is a required property rather than optional
property. So the question is what is the meaning of setting anatop-reg-offset
to 0? If 0 is a valid setting for anatop-reg-offset and it has special meaning,
we had better document it in the binding document. Otherwise, remove the testing
for control_reg in the driver.

No anatop voltage regulator node in the dts files set anatop-reg-offset to 0.
So I think it's safe to remove testing if control_reg is 0.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@linaro.org>

authored by

Axel Lin and committed by
Mark Brown
114c5748 d38018f2

+2 -23
+2 -23
drivers/regulator/anatop-regulator.c
··· 55 55 int sel; 56 56 }; 57 57 58 - static int anatop_regmap_set_voltage_sel(struct regulator_dev *reg, 59 - unsigned selector) 60 - { 61 - struct anatop_regulator *anatop_reg = rdev_get_drvdata(reg); 62 - 63 - if (!anatop_reg->control_reg) 64 - return -ENOTSUPP; 65 - 66 - return regulator_set_voltage_sel_regmap(reg, selector); 67 - } 68 - 69 58 static int anatop_regmap_set_voltage_time_sel(struct regulator_dev *reg, 70 59 unsigned int old_sel, 71 60 unsigned int new_sel) ··· 79 90 } 80 91 81 92 return ret; 82 - } 83 - 84 - static int anatop_regmap_get_voltage_sel(struct regulator_dev *reg) 85 - { 86 - struct anatop_regulator *anatop_reg = rdev_get_drvdata(reg); 87 - 88 - if (!anatop_reg->control_reg) 89 - return -ENOTSUPP; 90 - 91 - return regulator_get_voltage_sel_regmap(reg); 92 93 } 93 94 94 95 static int anatop_regmap_enable(struct regulator_dev *reg) ··· 157 178 } 158 179 159 180 static struct regulator_ops anatop_rops = { 160 - .set_voltage_sel = anatop_regmap_set_voltage_sel, 161 - .get_voltage_sel = anatop_regmap_get_voltage_sel, 181 + .set_voltage_sel = regulator_set_voltage_sel_regmap, 182 + .get_voltage_sel = regulator_get_voltage_sel_regmap, 162 183 .list_voltage = regulator_list_voltage_linear, 163 184 .map_voltage = regulator_map_voltage_linear, 164 185 };