On Sat, Mar 19, 2022 at 8:10 PM Jagath Jog J <[email protected]> wrote:
>
> This is a conversion to device-managed by using devm_iio_device_register
> inside probe function, now disabling the regulator and putting bma400 to
> power down via a devm_add_action_or_reset() hook.
>
> The dev_set_drvdata() call, bma400_remove() function and hooks in the I2C
> and SPI driver struct is removed as devm_iio_device_register function is
> used to automatically unregister on driver detach.
...
> +static void bma400_disable(void *data_ptr)
> +{
> + struct bma400_data *data = data_ptr;
> + int ret;
> + ret = bma400_set_power_mode(data, POWER_MODE_SLEEP);
> + if (ret)
> + dev_warn(data->dev, "Failed to put device into sleep mode (%pe)\n",
> + ERR_PTR(ret));
By what reason did you remove mutex around this call?
> + regulator_bulk_disable(ARRAY_SIZE(data->regulators), data->regulators);
> +}
--
With Best Regards,
Andy Shevchenko
Hello Andy,
On Mon, Mar 21, 2022 at 10:30:26AM +0200, Andy Shevchenko wrote:
> On Sat, Mar 19, 2022 at 8:10 PM Jagath Jog J <[email protected]> wrote:
> >
> > This is a conversion to device-managed by using devm_iio_device_register
> > inside probe function, now disabling the regulator and putting bma400 to
> > power down via a devm_add_action_or_reset() hook.
> >
> > The dev_set_drvdata() call, bma400_remove() function and hooks in the I2C
> > and SPI driver struct is removed as devm_iio_device_register function is
> > used to automatically unregister on driver detach.
>
> ...
>
> > +static void bma400_disable(void *data_ptr)
> > +{
> > + struct bma400_data *data = data_ptr;
> > + int ret;
>
> > + ret = bma400_set_power_mode(data, POWER_MODE_SLEEP);
> > + if (ret)
> > + dev_warn(data->dev, "Failed to put device into sleep mode (%pe)\n",
> > + ERR_PTR(ret));
>
> By what reason did you remove mutex around this call?
>
> > + regulator_bulk_disable(ARRAY_SIZE(data->regulators), data->regulators);
> > +}
Sorry my mistake, I missed this.
I will include the mutex calls in next patch version.
>
>
>
> --
> With Best Regards,
> Andy Shevchenko