Re: [PATCH v2 1/5] iio: imu: inv_icm42600: Simplify pm_runtime setup
From: Jonathan Cameron
Date: Sat Aug 09 2025 - 14:06:24 EST
On Fri, 8 Aug 2025 23:37:51 +0200
Andy Shevchenko <andy.shevchenko@xxxxxxxxx> wrote:
> On Fri, Aug 8, 2025 at 5:58 PM Sean Nyekjaer <sean@xxxxxxxxxx> wrote:
> >
> > Rework the power management in inv_icm42600_core_probe() to use
> > devm_pm_runtime_set_active_enabled(), which simplifies the runtime PM
> > setup by handling activation and enabling in one step.
> > Remove the separate inv_icm42600_disable_pm callback, as it's no longer
> > needed with the devm-managed approach.
> > Using devm_pm_runtime_enable() also fixes the missing disable of
> > autosuspend.
> > Update inv_icm42600_disable_vddio_reg() to only disable the regulator if
> > the device is not suspended i.e. powered-down, preventing unbalanced
> > disables.
> > Also remove redundant error msg on regulator_disable(), the regulator
> > framework already emits an error message when regulator_disable() fails.
> >
> > This simplifies the PM setup and avoids manipulating the usage counter
> > unnecessarily.
>
> ...
>
> > + struct device *dev = regmap_get_device(st->map);
> >
> > + if (!pm_runtime_status_suspended(dev))
> > + regulator_disable(st->vddio_supply);
>
> I would rather use positive conditional as it seems to me more scalable
Hi Andy,
>
To potentially save time when Sean looks at this. I don't follow. Do you mean
something like
if (pm_runtime_status_suspended(dev))
return;
regulator_disable(st->vddio_supply);
?
If so I'm not seeing why we'd want this to scale as it's a single use
devm_set_action_or_reset() callback doing just one thing.
Jonathan
> > }
>
>