Re: [PATCH v2 1/5] iio: imu: inv_icm42600: Simplify pm_runtime setup
From: Andy Shevchenko
Date: Sat Aug 09 2025 - 16:28:42 EST
On Sat, Aug 9, 2025 at 8:06 PM Jonathan Cameron <jic23@xxxxxxxxxx> wrote:
> 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:
...
> > > + 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
>
> 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);
>
> ?
Yes.
> 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.
While I agree in _this_ case, in general the check and return
immediately is more scalable for reading purposes, e.g., indentation
will be one level less. Also it won't require additional churn in
adding {, i.e. changing conditional line just for that.
--
With Best Regards,
Andy Shevchenko