| Date | Mon, 4 May 2026 14:13:41 +0300 | | From | Andy Shevchenko <> | | Subject | Re: [PATCH v4 13/17] iio: magnetometer: ak8975: switch to using managed resources |
| |
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;
?
> + /* > + * The device may not be runtime suspended when the driver is > + * removed, so we soft-stop the chip before hard-stopping the > + * regulators. > + */ > + ak8975_set_mode(data, POWER_DOWN); > + ak8975_power_off(data); > + } > +}
-- With Best Regards, Andy Shevchenko
|