On Mon, Mar 25, 2024 at 3:06 PM Jonathan Cameron <jic23@xxxxxxxxxx> wrote: > > > > > But given that this is a common pattern in many IIO drivers, maybe we > > make a devm_regulator_get_enable_get_voltage()? This would return the > > voltage on success or an error code. (If the regulator subsystem > > doesn't want this maybe we could have > > devm_iio_regulator_get_enable_get_voltage()). > > > > If the dev_err_probe() calls were included in > > devm_regulator_get_enable_get_voltage(), then the 10+ lines of code > > here and in many other drivers to get the regulator, enable it, add > > the reset action and get the voltage could be reduced to 3 lines. > > I like this proposal a lot. RFC, so it's visible outside the depths > of this thread? Yes, I can send an RFC separately so it doesn't hold up this patch/series. > Particularly good as it will keep the regulator opaque in the same > fashion as devm_regulator_get_enabled() > > As you say, we have a 'lot' of instances of this (quick grep > suggests > 50 in IIO alone and smaller numbers elsewhere). >