Commit 762ab093 authored by Alexandru Ardelean's avatar Alexandru Ardelean Committed by Jonathan Cameron

iio: imu: adis: create an unlocked version of adis_reset()

The reset routine may also be important to be protected by the state-lock
and grouped with other operations, so create an unlocked version, so that
this can be done.
Signed-off-by: default avatarAlexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
parent 6a4d6a7d
...@@ -309,23 +309,23 @@ int __adis_check_status(struct adis *adis) ...@@ -309,23 +309,23 @@ int __adis_check_status(struct adis *adis)
EXPORT_SYMBOL_GPL(__adis_check_status); EXPORT_SYMBOL_GPL(__adis_check_status);
/** /**
* adis_reset() - Reset the device * __adis_reset() - Reset the device (unlocked version)
* @adis: The adis device * @adis: The adis device
* *
* Returns 0 on success, a negative error code otherwise * Returns 0 on success, a negative error code otherwise
*/ */
int adis_reset(struct adis *adis) int __adis_reset(struct adis *adis)
{ {
int ret; int ret;
ret = adis_write_reg_8(adis, adis->data->glob_cmd_reg, ret = __adis_write_reg_8(adis, adis->data->glob_cmd_reg,
ADIS_GLOB_CMD_SW_RESET); ADIS_GLOB_CMD_SW_RESET);
if (ret) if (ret)
dev_err(&adis->spi->dev, "Failed to reset device: %d\n", ret); dev_err(&adis->spi->dev, "Failed to reset device: %d\n", ret);
return ret; return ret;
} }
EXPORT_SYMBOL_GPL(adis_reset); EXPORT_SYMBOL_GPL(__adis_reset);
static int adis_self_test(struct adis *adis) static int adis_self_test(struct adis *adis)
{ {
......
...@@ -73,7 +73,24 @@ struct adis { ...@@ -73,7 +73,24 @@ struct adis {
int adis_init(struct adis *adis, struct iio_dev *indio_dev, int adis_init(struct adis *adis, struct iio_dev *indio_dev,
struct spi_device *spi, const struct adis_data *data); struct spi_device *spi, const struct adis_data *data);
int adis_reset(struct adis *adis); int __adis_reset(struct adis *adis);
/**
* adis_reset() - Reset the device
* @adis: The adis device
*
* Returns 0 on success, a negative error code otherwise
*/
static inline int adis_reset(struct adis *adis)
{
int ret;
mutex_lock(&adis->state_lock);
ret = __adis_reset(adis);
mutex_unlock(&adis->state_lock);
return ret;
}
int __adis_write_reg(struct adis *adis, unsigned int reg, int __adis_write_reg(struct adis *adis, unsigned int reg,
unsigned int val, unsigned int size); unsigned int val, unsigned int size);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment