Re: [PATCH v2 2/3] iio: imu: inv_mpu6050: control vdd supply using devm-helpers

From: Andy Shevchenko

Date: Wed Apr 01 2026 - 11:21:40 EST


On Wed, Apr 01, 2026 at 11:27:36AM +0300, Andrey Skvortsov wrote:
> vdd supply will be automatically disabled on error condition during a
> probe and on driver cleanup. Since the vdd handling is moved to
> devm-helpers, only vddio regulator has to be disabled in the
> driver-specific cleanup action.

...

> -static void inv_mpu_core_disable_regulator_action(void *_data)
> +static void inv_mpu_core_disable_regulator_vddio_action(void *_data)

You can rename now _data --> st...

> {
> struct inv_mpu6050_state *st = _data;

...and drop this.

> inv_mpu_core_disable_regulator_vddio(st);
> }

...

> - st->vdd_supply = devm_regulator_get(dev, "vdd");
> - if (IS_ERR(st->vdd_supply))
> - return dev_err_probe(dev, PTR_ERR(st->vdd_supply),
> - "Failed to get vdd regulator\n");
> -
> st->vddio_supply = devm_regulator_get(dev, "vddio");
> if (IS_ERR(st->vddio_supply))
> return dev_err_probe(dev, PTR_ERR(st->vddio_supply),
> "Failed to get vddio regulator\n");
>
> - result = regulator_enable(st->vdd_supply);
> - if (result) {
> - dev_err(dev, "Failed to enable vdd regulator: %d\n", result);
> - return result;
> - }
> + result = devm_regulator_get_enable(dev, "vdd");
> + if (result)
> + return dev_err_probe(dev, result, "Failed to enable vdd regulator\n");

I'm not that expert in regulator framework, but this change might be sensitive.
I dunno if regulator is exclusive or shared and if order of requesting may affect
anything. Just needs careful review from somebody more familiar with that.

--
With Best Regards,
Andy Shevchenko