Re: [PATCH v1 1/5] iio: accel: bma400: conversion to device-managed function

From: Andy Shevchenko
Date: Mon Mar 21 2022 - 04:31:42 EST


On Sat, Mar 19, 2022 at 8:10 PM Jagath Jog J <jagathjog1996@xxxxxxxxx> 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