Re: [PATCH 3/8] iio: magnetometer: ak8975: switch to using managed resources
From: Joshua Crofts
Date: Fri May 08 2026 - 09:52:25 EST
On Fri, 8 May 2026 at 11:58, Andy Shevchenko
<andriy.shevchenko@xxxxxxxxxxxxxxx> wrote:
>
> On Thu, May 07, 2026 at 04:35:52PM +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.
> >
> > Additionally, remove any pm_runtime_get/put*() function calls that
> > dummy cycled the counter to autosuspend the device.
>
> ...
>
> > +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))
>
> Is this one a correct one?
> We also have pm_runtime_suspended(), which is different.
As we only require the status of the device and not the power.disable_depth,
pm_runtime_status_suspended() seems adequate.
--
Kind regards
CJD