Re: [PATCH 3/8] iio: magnetometer: ak8975: switch to using managed resources
From: Andy Shevchenko
Date: Sat May 09 2026 - 13:15:35 EST
On Sat, May 09, 2026 at 10:03:38AM +0100, Nuno Sá wrote:
> On Thu, 2026-05-07 at 16:35 +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.
...
> Maybe it would make sense to move this before devm_iio_device_register(). At the
> point we register the device, userspace can start to interact with the device where
> we have pm calls? Not that it is a problem (I think) but makes sense to me to enable
> PM before exposing the device.
When you called devm_iio_device_register(), it's already user space interaction
there, so device has to be prepared for that. Do we guarantee that device is
power enabled at that point?
--
With Best Regards,
Andy Shevchenko