diff options
author | Alexandru Ardelean <alexandru.ardelean@analog.com> | 2019-11-22 16:24:15 +0300 |
---|---|---|
committer | Jonathan Cameron <Jonathan.Cameron@huawei.com> | 2019-11-23 15:05:17 +0300 |
commit | 762ab093cbe26451175a5a63ea06c971bf973525 (patch) | |
tree | 4bc40c00e4f50aaf98af3249b07b8bb7e8a3ecef /include/linux/iio | |
parent | 6a4d6a7d6588d8c15501542da786ebff6602475c (diff) | |
download | linux-762ab093cbe26451175a5a63ea06c971bf973525.tar.xz |
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: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Diffstat (limited to 'include/linux/iio')
-rw-r--r-- | include/linux/iio/imu/adis.h | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/include/linux/iio/imu/adis.h b/include/linux/iio/imu/adis.h index db759957e1c1..4b5bc0e06e69 100644 --- a/include/linux/iio/imu/adis.h +++ b/include/linux/iio/imu/adis.h @@ -73,7 +73,24 @@ struct adis { int adis_init(struct adis *adis, struct iio_dev *indio_dev, 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, unsigned int val, unsigned int size); |