diff options
author | Alexandru Ardelean <alexandru.ardelean@analog.com> | 2019-11-22 16:24:14 +0300 |
---|---|---|
committer | Jonathan Cameron <Jonathan.Cameron@huawei.com> | 2019-11-23 15:02:05 +0300 |
commit | 6a4d6a7d6588d8c15501542da786ebff6602475c (patch) | |
tree | d6dfd2f0ef102ec50eaac9d192e8fe6fd04e06dd /include/linux/iio/imu/adis.h | |
parent | 100bfa38c8cb81ccbbd17ee4f0c1164f455f6039 (diff) | |
download | linux-6a4d6a7d6588d8c15501542da786ebff6602475c.tar.xz |
iio: imu: adis: create an unlocked version of adis_check_status()
This one also gets re-used in certain operations, so it makes sense to
have an unlocked version of this to group it with other
reads/writes/operations to have a single lock for the whole state change.
Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Diffstat (limited to 'include/linux/iio/imu/adis.h')
-rw-r--r-- | include/linux/iio/imu/adis.h | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/include/linux/iio/imu/adis.h b/include/linux/iio/imu/adis.h index 38ebe41092e1..db759957e1c1 100644 --- a/include/linux/iio/imu/adis.h +++ b/include/linux/iio/imu/adis.h @@ -267,7 +267,18 @@ static inline int adis_read_reg_32(struct adis *adis, unsigned int reg, } int adis_enable_irq(struct adis *adis, bool enable); -int adis_check_status(struct adis *adis); +int __adis_check_status(struct adis *adis); + +static inline int adis_check_status(struct adis *adis) +{ + int ret; + + mutex_lock(&adis->state_lock); + ret = __adis_check_status(adis); + mutex_unlock(&adis->state_lock); + + return ret; +} int adis_initial_startup(struct adis *adis); |