Re: [PATCH v4 13/17] iio: magnetometer: ak8975: switch to using managed resources

Joshua Crofts
2026-05-04T11:28:42Z

On Mon, 4 May 2026 at 13:13, Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
>
> On Mon, May 04, 2026 at 11:48:25AM +0200, Joshua Crofts via B4 Relay wrote:
>
> > Switch the driver to use managed resources (devm_*) which simplifier
> > error handling and allows removing ak8975_remove() method from
> > the driver.
> >
> > Note, on error path we now also set mode to POWER_DOWN state which is
> > fine. Even if the device is in that mode, there is no problem to set
> > that mode again, it should be no-op.
>
> ...
>
> > +static void devm_ak8975_power_off(void *data)
> > +{
> > + struct ak8975_data *ak = data;
> > + struct device *dev = &ak->client->dev;
> > +
> > + /* Only power down if currently active */
> > + if (!pm_runtime_status_suspended(dev)) {
>
> if (pm_runtime_status_suspended(dev))
> return;
>
> ?

Good point.

--
Kind regards

CJD